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

Find + Autocomplete suggestion

Vote:
 

I have below code which I used to populate search type ahead. This more or less works fine but I have been looking for built in autocomplete feautre which is part of statistics. Wondering how can I club the autocomplete in my current code and provide results to my application. I am using Find 13.4.3

I am looking for search to be in a specific order:

  1. Autocomplete with suggestions
  2. Query should search with starts with first then contains
  3. Wildcard
  4. Fuzzy
  5. Any filters

I have mostly correct but not optimum results but not in any specific order and hoping any suggestions to make my search experience better

Code I have:

        public async Task<IContentResult<IContent>> PreviewResultsAsync(string query, int pageSize, CultureInfo culture)
        {

            var customFilter = BuildCustomFilter();

           var Search = _findClient.Search<IContent>(ConvertToFindLanguage(culture))                                                                                 
                .For(query)
                .InField(f => f.Name(), 500)
                .UsingSynonyms()
                .WildCardSearch($"*{query}*", f => f.Name(), null ,true)
                .FuzzySearch($"*{query}*", f => f.Name(), 5)
                .FilterForVisitor()
                .Filter(x =>
                    x.MatchTypeHierarchy(typeof(IMyContentTypes)) |
                    x.MatchType(typeof(MyPageTypeA)) |
                    x.MatchType(typeof(MyPageTypeB)) |
                    x.MatchType(typeof(MyPageTypeC))
                )
                .Filter(customFilter) //Specific filter for one of my content types
                .Take(pageSize < 1 ? 10 : pageSize)
                .Track()
                .ApplyBestBets();

            return await Task.Run(() => Search.GetContentResult(cacheForSeconds: 500));
        }

#260614
Aug 15, 2021 3:08
Vote:
 

Hi Dileep,

When you say the results are mostly correct but not optimal, can you elaborate a little more on your expectations?

When you submit the keyword search query to Search & Navigation (Find), Find will it will order the results by the relevancy score it assigns relative to your query. In your query, you are just searching via the Name() so the relvancy scores assigned may be quite similar. 

Consider incorporating Boostings into your query.

 Boosting with filters (Find 9) | Optimizely Developer Community

Use Boostings to boost the relvancy of items that meet the criteria of a result you expect to see high on the results.

As an improvement, you can make a boositng value CMS editable to you can find the optimal value.

Even better you can use Experiments to measure the success of various CMS editable boosting values.

Thanks

#260995
Aug 23, 2021 10:47
Vote:
 

Hi Dileep,

Also make sure you have click tracking properly implemented as Find takes these statistics into account when assigning relevancy.

Is Click Tracking working in your EPiServer Find implementation? – Johnny Mullaney

Thanks

#261091
Aug 25, 2021 9:31
Vote:
 

Thanks for the update and I will check out the links shared. 

Meanwhile am looking to see how should I use the AutoComplete feature along with my Typed Search.

The issue am seeing is Ex: If I search for Ken and I have a page with Kenny Moore, I would expect this to be the first result rather first result being Chicken. As I type more words it comes back with relevant results on top. My preference would be to display type as you search in the results. Let me know if anything doesn't make sense

#261317
Aug 30, 2021 14:47
* 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.