Does anyone know how to search multiple doc types in Umbraco 8. I tried a couple of different ways. The usual way which used to work for Umbraco 7 doesn't seem to be working.
Sometimes it feels like I am guessing with Examine until I get it right.
Here is what I have tried.
This is what I used to use for Umbraco 7 (not working for 8)
var examineQuery = criteria.GroupedOr(new string[] { "_docTypeAliasFieldName" }, new string[] { "contentPage", "blogDetailsPage", "eventDetailsPage", "officeDetailsPage", "sectorDetailsPage", "serviceDetailsPage", "staffDetailsPage" });
I had a stab in the dark here and tried this.
var examineQuery = criteria.NodeTypeAlias("contentPage").Or().NodeTypeAlias("blogDetailsPage").Or().NodeTypeAlias("eventDetailsPage").Or().NodeTypeAlias("officeDetailsPage").Or().NodeTypeAlias("sectorDetailsPage").Or().NodeTypeAlias("serviceDetailsPage").Or().NodeTypeAlias("staffDetailsPage");
var criteria = searcher.CreateQuery(IndexTypes.Content, BooleanOperation.And);
to
var criteria = searcher.CreateQuery(IndexTypes.Content, BooleanOperation.Or);
EG.
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");
Umbraco 8 Examine How to Search Multiple DocTypes
Hi Guys,
Does anyone know how to search multiple doc types in Umbraco 8. I tried a couple of different ways. The usual way which used to work for Umbraco 7 doesn't seem to be working.
Sometimes it feels like I am guessing with Examine until I get it right.
Here is what I have tried.
This is what I used to use for Umbraco 7 (not working for 8)
I had a stab in the dark here and tried this.
Thanks in Advanced.
Regards
David
Hi,
I also tried this and no results are returned.
Hi Guys,
It looks like I was on the right track.
This is what worked. I need to change.
to
EG.
Hope this helps someone.
Regards
David
I also posted a blog article about this here. https://www.umbrajobs.com/blog/posts/2020/july/umbraco-8-examine-how-to-search-multiple-doctypes/
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.