This would be very nice since I've a customer complaining of getting too many resuts on searches due to this functionality. When the user is searching for "kindergarden" he/she is not interested in the 150 pages returned due to the hit on "garden", only the 12 which is about kindergarden.
Hi,
we are aware of this and will try to improve the relevance handling for Find. For now, what you could do as a workaround would be to boost hits that are exact matches. Some ways to achieve this could be using something like
searchClient.UnifiedSearchFor(query).MatchBoosting(x => x.Field.Match(query), 2)
or
searchClient.UnifiedSearchFor(query).MatchBoosting(x => x.AnyWordBeginsWith(query), 2);
That way you could make sure that the exact matches are at least put on top.
/Viktor
Yes, less results but more precise ones is definitely something that I would want too!
I'm also trying to get exact matches at the top of my result list.
Using stemming and as suggested
.BoostMatching(x => x.TitleTextField.Match(query), 2).
But I'm not getting the results quite right.
If query is "foo" it seems that it boost documents with the exact TitleTextField = "foo"
but not "This is also foo".
Is that the expected behaviour since it's not a 100% exact match on the whole string?
And is there something like .AnyWordMatch(query) that I should be using?
The resultlist currently looks something like
1. foo
2. foobar
3. this is also foo
I would like it to be
1. foo
2. this is also foo
3. foobar
This did the trick for me. =)
1. Add a custom filter
public static DelegateFilterBuilder AnyWordMatchCaseInsensitive(this string value, string valueToMatch) { DelegateFilterBuilder delegateFilterBuilder = new DelegateFilterBuilder((string field) => new EPiServer.Find.Api.Querying.Filters.TermFilter(field, valueToMatch.ToLowerInvariant())); delegateFilterBuilder.FieldNameMethod = ((Expression expression, IClientConventions conventions) => conventions.FieldNameConvention.GetFieldNameForAnalyzed(expression)); return delegateFilterBuilder; }
2. Boost
search.BoostMatching(x => x.TitleTextField.AnyWordMatchCaseInsensitive(query), 2)
Is it possible to configure stemming to use "AND" as default operator for compound words?
F.E. My search results:
I want's to have 3 results for "butterfly" query.