November Happy Hour will be moved to Thursday December 5th.

Stemming and compound word

Vote:
 

Is it possible to configure stemming to use "AND" as default operator for compound words?

F.E. My search results:

  • "butterfly"- 339 results
  • "butter" - 125 results
  • "fly" - 217 results
  • "butter fly" - 3 results (with AND as default operator)

I want's to have 3 results for "butterfly" query.

#140451
Oct 20, 2015 13:09
Vote:
 

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.

#140688
Oct 27, 2015 15:16
Vote:
 

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

#140849
Nov 02, 2015 10:03
Vote:
 

Yes, less results but more precise ones is definitely something that I would want too!

#140910
Nov 03, 2015 17:28
Vote:
 

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

#142040
Nov 27, 2015 11:21
Vote:
 

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)
#142042
Nov 27, 2015 11:46
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.