Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm trying to tweak an Examine search query and for this I'm using the fluent API. I'm close to a solution but there is just one thing I can't get my head around.
I'm using the code below to split the user's search query into seperate terms and since I have multiple indexed fields I'm using the GroupedOr method to create the search criteria.
var searchTerms = searchQuery.Split(' ');
foreach (string term in searchTerms)
if (termQueries == null)
termQueries = searcher.CreateSearchCriteria()
termQueries = termQueries.Or()
This would result in the following Lucene query:
+(bodyText:hello* message:hello*) (bodyText:world* message:world*) ...
As you can see the first group is required (+) and the second group is optional (or). The query I'm trying to create however should leave both groups optional, but at least 1 group is required, like so:
+((bodyText:hello* message:hello*) (bodyText:world* message:world*)) ...
Any ideas how this can be accomplished using the fluent API?
Suggestions, anyone? *bump* :-)
I dont know if this ressource could help you out with you issue. http://our.umbraco.org/forum/developers/extending-umbraco/19329-Search-multiple-fields-for-multiple-terms-with-examine
The thread discusses the grouping of terms/fields, but does not contain any info on how those groups can be grouped together.
I'm not even sure if that can be done with the fluent API, but I would prefer not having to assemble the Lucene query myself.
Perhaps there's a totally different approach to what I'm trying to achieve... Just haven't found one yet :-)
Thanks for the pointer though
When you create your search criteria do u passed on Boolean.Or becuase the default is Boolean.And
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted