huwred
07/20/2023, 8:08 AMif (_examineManager.TryGetIndex("ForumIndex", out var index))
{
var searcher = index.Searcher;
var criteria = searcher.CreateQuery(IndexTypes.Content, BooleanOperation.And);
var examineQuery = criteria.NodeTypeAlias("forumPost");
if (!string.IsNullOrEmpty(query))
{
if (textFields.Count > 1)
{
string[] terms = query.Split(' ');
examineQuery.And().GroupedOr(textFields, terms);
}
else
{
examineQuery.And().Field(textFields.First(), query.MultipleCharacterWildcard());
}
}
results = examineQuery.Execute();
}
Jemayn
07/20/2023, 8:27 AMcsharp
results = examineQuery.Execute();
and then you can get the full lucene query string. You can use that to test whether the specific search gets any results in the backoffice.
The backoffice index searcher accepts lucene stringsAmbert
07/20/2023, 8:43 AMAmbert
07/20/2023, 8:44 AMAmbert
07/20/2023, 8:44 AMhuwred
07/20/2023, 9:05 AMhuwred
07/20/2023, 9:09 AM+__NodeTypeAlias:forumpost +message:test*
which returns data in the back officeJemayn
07/20/2023, 9:27 AMsearcher.CreateQuery(IndexTypes.Content, BooleanOperation.And);
it should atleast have +__IndexType: content
, also given that you have a custom index - are you sure that it has that indextype?Mike Chambers
07/20/2023, 9:44 AMstring keyword = "aa bb cc"
.GroupedOr(new[] { "nodeName" }, keyword.Escape(), keyword.Boost(12))
results in
{ Category: content, LuceneQuery: +__NodeTypeAlias:tenderpage +((nodeName:"aa bb cc" ((nodeName:aa nodeName:bb nodeName:cc)^12.0)) }
huwred
07/20/2023, 9:46 AMhuwred
07/20/2023, 9:50 AM+__IndexType: content +__NodeTypeAlias:forumpost +message:test*
doesn't return results, so what have I done wrong?huwred
07/20/2023, 9:51 AMhuwred
07/20/2023, 9:57 AMsearcher.CreateQuery("forum", BooleanOperation.And);
😄 Thanks for the pointers.huwred
07/20/2023, 9:59 AMJemayn
07/20/2023, 3:16 PM