var searcher = index.GetSearcher();
var criteria = searcher.CreateQuery(IndexTypes.Content, BooleanOperation.Or);
var examineQuery = criteria.NodeTypeAlias("contentPage").Or().NodeTypeAlias("blogDetailsPage").Or().NodeTypeAlias("eventDetailsPage").Or().NodeTypeAlias("officeDetailsPage").Or().NodeTypeAlias("sectorDetailsPage").Or().NodeTypeAlias("serviceDetailsPage").Or().NodeTypeAlias("staffDetailsPage");
how to search for multiple document types with examine?
I want to search for documents of several types with Examine.
I have tried the below with And() and Or() but it does not work. Searching for a single document types works fine.
David,
Can you do
And report back output this will give you the generated lucene query string and it will give you more information.
You can also then try running that query directly on the index using luke for lucene tool.
Regards
Ismail
Here is the query and lucene string:
This only searches the first alias I specify.
David,
You need a GroupedOr. Also you are doing at the end an in memory sort which is not as efficient as getting lucene to do it for you.
Lets get the groupedor working first then we can look at the sort.
Regards
Ismail
Hi Guys,
I posted a blog article about this here. https://www.umbrajobs.com/blog/posts/2020/july/umbraco-8-examine-how-to-search-multiple-doctypes/
This is what you need.
is working on a reply...