{"action":"created","issue":{"url":"https://api.github.com/repos/themotleyfool/Lucene.Net.Linq/issues/80","labels_url":"https://api.github.com/repos/themotleyfool/Lucene.Net.Linq/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/themotleyfool/Lucene.Net.Linq/issues/80/comments","events_url":"https://api.github.com/repos/themotleyfool/Lucene.Net.Linq/issues/80/events","html_url":"https://github.com/themotleyfool/Lucene.Net.Linq/issues/80","id":90670903,"number":80,"title":"Unable to search within IEnumerable<int> field","user":{"login":"xumix","id":250118,"avatar_url":"https://avatars.githubusercontent.com/u/250118?v=3","gravatar_id":"","url":"https://api.github.com/users/xumix","html_url":"https://github.com/xumix","followers_url":"https://api.github.com/users/xumix/followers","following_url":"https://api.github.com/users/xumix/following{/other_user}","gists_url":"https://api.github.com/users/xumix/gists{/gist_id}","starred_url":"https://api.github.com/users/xumix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xumix/subscriptions","organizations_url":"https://api.github.com/users/xumix/orgs","repos_url":"https://api.github.com/users/xumix/repos","events_url":"https://api.github.com/users/xumix/events{/privacy}","received_events_url":"https://api.github.com/users/xumix/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/themotleyfool/Lucene.Net.Linq/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/themotleyfool/Lucene.Net.Linq/labels/release-ready","name":"release-ready","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-24T13:07:05Z","updated_at":"2015-06-30T16:51:21Z","closed_at":"2015-06-30T16:04:33Z","body":"The model looks like\r\n```\r\npublic IEnumerable<int> AccommodationAges { get; set; }\r\npublic decimal TotalPriceMin { get; set; }\r\npublic decimal TotalPriceMax { get; set; }\r\n```\r\nthe query:\r\n```\r\ntourMap.Property(p => p.AccommodationAges).Stored().NotAnalyzed();\r\ntourMap.Property(p => p.TotalPriceMin).Stored().NotAnalyzed();\r\ntourMap.Property(p => p.TotalPriceMax).Stored().NotAnalyzed();\r\n\r\nvar q = session.Query().Where(t => t.TotalPriceMin >= 10 && t.TotalPriceMax <= 1000000);\r\n\t\t\t\tfor (int i = 2; i < 10; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar age = i;\r\n\t\t\t\t\tq = q.Where(t => t.AccommodationAges.Contains(age));\r\n\t\t\t\t}\r\nvar search = q.ToArray();\r\n```\r\nThe error:\r\n```\r\nSystem.InvalidOperationException occurred\r\n  HResult=-2146233079\r\n  Message=The binary operator Equal is not defined for the types 'System.Collections.Generic.IEnumerable`1[System.Int32]' and 'System.Int32'.\r\n  Source=System.Core\r\n  StackTrace:\r\n       at System.Linq.Expressions.Expression.GetEqualityComparisonOperator(ExpressionType binaryType, String opName, Expression left, Expression right, Boolean liftToNull)\r\n       at System.Linq.Expressions.Expression.Equal(Expression left, Expression right, Boolean liftToNull, MethodInfo method)\r\n       at System.Linq.Expressions.Expression.MakeBinary(ExpressionType binaryType, Expression left, Expression right, Boolean liftToNull, MethodInfo method, LambdaExpression conversion)\r\n       at System.Linq.Expressions.Expression.MakeBinary(ExpressionType binaryType, Expression left, Expression right)\r\n       at Lucene.Net.Linq.Transformation.TreeVisitors.SubQueryContainsTreeVisitor.VisitSubQueryExpression(SubQueryExpression expression)\r\n       at Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitExpression(Expression expression)\r\n       at Remotion.Linq.Clauses.WhereClause.TransformExpressions(Func`2 transformation)\r\n       at Lucene.Net.Linq.Transformation.QueryModelTransformer.VisitWhereClause(WhereClause whereClause, QueryModel queryModel, Int32 index)\r\n       at Remotion.Linq.Clauses.WhereClause.Accept(IQueryModelVisitor visitor, QueryModel queryModel, Int32 index)\r\n       at Remotion.Linq.QueryModelVisitorBase.VisitBodyClauses(ObservableCollection`1 bodyClauses, QueryModel queryModel)\r\n       at Remotion.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel queryModel)\r\n       at Remotion.Linq.QueryModel.Accept(IQueryModelVisitor visitor)\r\n       at Lucene.Net.Linq.Transformation.QueryModelTransformer.TransformQueryModel(QueryModel queryModel)\r\n       at Lucene.Net.Linq.LuceneQueryExecutorBase`1.PrepareQuery(QueryModel queryModel)\r\n       at Lucene.Net.Linq.LuceneQueryExecutorBase`1.<ExecuteCollection>d__3`1.MoveNext()\r\n       at System.Linq.Buffer`1..ctor(IEnumerable`1 source)\r\n       at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)\r\n       at RestChild.Booking.Logic.Indexing.TourIndexer.IndexTours() in c:\\Projects\\RestChild\\RestChild.Booking.Logic\\Indexing\\TourIndexer.cs:line 211\r\n  InnerException: \r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/themotleyfool/Lucene.Net.Linq/issues/comments/117253519","html_url":"https://github.com/themotleyfool/Lucene.Net.Linq/issues/80#issuecomment-117253519","issue_url":"https://api.github.com/repos/themotleyfool/Lucene.Net.Linq/issues/80","id":117253519,"user":{"login":"xumix","id":250118,"avatar_url":"https://avatars.githubusercontent.com/u/250118?v=3","gravatar_id":"","url":"https://api.github.com/users/xumix","html_url":"https://github.com/xumix","followers_url":"https://api.github.com/users/xumix/followers","following_url":"https://api.github.com/users/xumix/following{/other_user}","gists_url":"https://api.github.com/users/xumix/gists{/gist_id}","starred_url":"https://api.github.com/users/xumix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xumix/subscriptions","organizations_url":"https://api.github.com/users/xumix/orgs","repos_url":"https://api.github.com/users/xumix/repos","events_url":"https://api.github.com/users/xumix/events{/privacy}","received_events_url":"https://api.github.com/users/xumix/received_events","type":"User","site_admin":false},"created_at":"2015-06-30T16:51:21Z","updated_at":"2015-06-30T16:51:21Z","body":"Well, there is opposite situation now:\r\n```\r\nquery = query.Where(q => q.SubjectId.HasValue && parameter.Programs.Contains(q.SubjectId.Value));\r\n```\r\n\r\n```\r\nSystem.InvalidCastException occurred\r\n  HResult=-2147467262\r\n  Message=Unable to cast object of type 'System.Linq.Expressions.UnaryExpression' to type 'System.Linq.Expressions.ConstantExpression'.\r\n  Source=Lucene.Net.Linq\r\n  StackTrace:\r\n       at Lucene.Net.Linq.Transformation.TreeVisitors.SubQueryContainsTreeVisitor.VisitSubQueryExpression(SubQueryExpression expression)\r\n       at Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitExpression(Expression expression)\r\n       at Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitBinaryExpression(BinaryExpression expression)\r\n       at Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitExpression(Expression expression)\r\n       at Remotion.Linq.Clauses.WhereClause.TransformExpressions(Func`2 transformation)\r\n       at Lucene.Net.Linq.Transformation.QueryModelTransformer.VisitWhereClause(WhereClause whereClause, QueryModel queryModel, Int32 index)\r\n       at Remotion.Linq.Clauses.WhereClause.Accept(IQueryModelVisitor visitor, QueryModel queryModel, Int32 index)\r\n       at Remotion.Linq.QueryModelVisitorBase.VisitBodyClauses(ObservableCollection`1 bodyClauses, QueryModel queryModel)\r\n       at Remotion.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel queryModel)\r\n       at Remotion.Linq.QueryModel.Accept(IQueryModelVisitor visitor)\r\n       at Lucene.Net.Linq.LuceneQueryExecutorBase`1.PrepareQuery(QueryModel queryModel)\r\n       at Lucene.Net.Linq.LuceneQueryExecutorBase`1.<ExecuteCollection>d__3`1.MoveNext()\r\n       at System.Linq.Buffer`1..ctor(IEnumerable`1 source)\r\n       at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)\r\n       at RestChild.Booking.Logic.TourSearchService.SearchTours(SearchToursParams parameter) in c:\\Projects\\RestChild\\RestChild.Booking.Logic\\TourSearchService.cs:line 90\r\n  InnerException: \r\n```"}}