Thanks for the help Nik, It appears that when I do that, it is returning an IBooleanOperation for the results (query in your example) and I'm not sure how to work with that.
This is what I have: var results = searcher.CreateQuery("content").ManagedQuery(searchQuery).And().GroupedOr(new[] { "__NodeTypeAlias" }, new[] { "pcGridLayout", "accordion", "accordionItem", "pcSubscriptions" });
Hi Blake, you need to finish your query with .Execute(), like var results = searcher.CreateQuery("content").ManagedQuery(searchQuery).And().GroupedOr(new[] { "__NodeTypeAlias" }, new[] { "pcGridLayout", "accordion", "accordionItem", "pcSubscriptions" }).Execute();
Well I'm so glad that was an easy fix. I have been staring at this too long! That worked, thank you so much! :) You and Nik are great! On to the next steps!
I am having an issue with multiple search terms. Please see below the code I am using. It is not working.
var searchResults = Searcher.CreateQuery("content").NodeTypeAlias("aNNONCES").And().Field("quartier", searchTerm2).Or().Field("quartier", "Telfair").Execute();
Examine search query for multiple document types
I'm trying to write a search query for examine in version 8 that picks up on multiple document types but can't quite see how it works.
var results = searcher.CreateQuery("content") .NodeTypeAlias("goodReadPage").Or() .NodeTypeAlias("caseStudyPage").And()......
Any help would be appreciated.
Me too. Any luck figuring this out?
Hi Blake,
You should be able to do something like this:
var query = searcher.CreateQuery("content").ManagedQuery(searchTerm) .And().GroupedOr(new [] {"__NodeTypeAlias"}, new [] {"nodeAlias1", "nodeAlias2", "nodeAlias3"});
The ManagedQuery option will search all fields in the index.
Does this help?
Thanks
Nik
Thanks for the help Nik, It appears that when I do that, it is returning an IBooleanOperation for the results (query in your example) and I'm not sure how to work with that.
This is what I have:
var results = searcher.CreateQuery("content").ManagedQuery(searchQuery).And().GroupedOr(new[] { "__NodeTypeAlias" }, new[] { "pcGridLayout", "accordion", "accordionItem", "pcSubscriptions" });
Hi Blake, you need to finish your query with
.Execute()
, likevar results = searcher.CreateQuery("content").ManagedQuery(searchQuery).And().GroupedOr(new[] { "__NodeTypeAlias" }, new[] { "pcGridLayout", "accordion", "accordionItem", "pcSubscriptions" }).Execute();
Well I'm so glad that was an easy fix. I have been staring at this too long! That worked, thank you so much! :) You and Nik are great! On to the next steps!
Hello
I am having an issue with multiple search terms. Please see below the code I am using. It is not working.
var searchResults = Searcher.CreateQuery("content").NodeTypeAlias("aNNONCES").And().Field("quartier", searchTerm2).Or().Field("quartier", "Telfair").Execute();
Do you have any idea of how it can be done?
Thanks A.
Hi All,
I posted a blog about this here. https://www.umbrajobs.com/blog/posts/2020/july/umbraco-8-examine-how-to-search-multiple-doctypes/
Thank you for updating this topic
is working on a reply...