I want to search two of my doc types that exist in the ExternalSearch index.
I'm getting back results for all doctypes.
Here's my query:
ISearchCriteria searchCriteria = searcher.CreateSearchCriteria(BooleanOperation.Or);
// TODO : This bit of the query doesn't work - returns all node types
var query = searchCriteria.NodeTypeAlias("Product").Or().NodeTypeAlias("Service");
query = query.And().GroupedOr(new[] {"title", "description"}, new[] { term });
searchCriteria = query.Compile();
var relatedProducts = Umbraco.ContentQuery.TypedSearch(searchCriteria).Take(count).ToList();
Can anyone see what is wrong? I've tried all sorts of combinations with no luck. I only seem to be able to search 1 or all.
Unable to get Examine to filter by multiple doc types
Hi
I want to search two of my doc types that exist in the ExternalSearch index.
I'm getting back results for all doctypes.
Here's my query:
Can anyone see what is wrong? I've tried all sorts of combinations with no luck. I only seem to be able to search 1 or all.
Any ideas?
Hi Rob,
Have a look at this : http://our.umbraco.org/forum/developers/api-questions/47684-Clarification-on-limiting-Examine-search-to-particular-document-type
Hope that helps!
Hi,
I think that the problem is with this line:
I would suggest replacing it with:
Let me know if this worked out for you. Doron
Thanks for the responses, I also had to change the default operation to BooleanOperation.And as otherwise the generated query looked like this:
and still returned other doc types.
is working on a reply...