Build a DelegateFilterBuilder that uses stemming

Vote:
 

Hello,

Using FIND 13.0.5

I want to keep it simple and do not want to mention too many details.

My simple question is how to have a DelegeateFilterBuilder that uses stemming.

Here is my first try and it did not work:

        public static DelegateFilterBuilder MatchUsingStemming(this string property, string searchTerm)
        {
            QueryStringQuery query = new QueryStringQuery((FieldFilterValue)searchTerm.Quote())
            {
                RawQuery = searchTerm
            };

            DelegateFilterBuilder delegateFilterBuilder = new DelegateFilterBuilder((string field) => new QueryFilter(query));
            delegateFilterBuilder.FieldNameMethod = ((Expression expression, IClientConventions conventions) => conventions.FieldNameConvention.GetFieldNameForSearch(expression, Language.English));
            return delegateFilterBuilder;
        }

Thanks!

#203118
Edited, Apr 09, 2019 16:47
Vote:
 

I was able to make it work by setting the DefaultField in 'query' object as following:

        public static DelegateFilterBuilder MatchUsingStemming(this string property, string fieldName, string searchTerm)
        {
            QueryStringQuery query = new QueryStringQuery((FieldFilterValue)searchTerm.Quote())
            {
                RawQuery = searchTerm,
                DefaultField = SearchClient.Instance.Conventions.FieldNameConvention.GetFieldNameForSearch(GetExpression<SearchProduct>(fieldName), Language.English)
            };

            DelegateFilterBuilder delegateFilterBuilder = new DelegateFilterBuilder((string field) => new QueryFilter(query));
            return delegateFilterBuilder;
        }

#203181
Apr 10, 2019 15:15
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.