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

Can I make autocomplete only to return suggestions that will return answer?

Vote:
 

We are using the built in autocomplete, but has extracted the code that the rest service do, and made our own service that returned the information in the way we wanted it. Maby this is not nessesary and I will change it if there are any better suggestions.

 public ActiveSolution.Lernia.LerniaSE.Entities.EPiServerFind.SearchResult<TinyResultItem> AutoCompleteSearch(string query, int take = 5)
        {
            var result = StatisticsClient.Instance.GetAutoComplete(query, take * 2);

            return new ActiveSolution.Lernia.LerniaSE.Entities.EPiServerFind.SearchResult<TinyResultItem>
            {
                ResultItems = result.Hits.GroupBy(g => g.Query.Replace("*", "").Replace("\\", "")).Select(h => new TinyResultItem() { LinkUrl = h.Key, Title = h.Key, SearchResultType = SearchResultType.Other }).OrderBy(o => o.Title.Length).Take(take).ToList()
            };
        }

    

The problem we have is that it is returning suggestions on words that will get no hits, for example if you go to http://www.lernia.se and type rekryteringskoordinator in the search field you will get a suggestion but if you search for it there will be no hits. It has been hits on that word before, but the page with that word has been deleted and is no more in the index.

Are there any way to fix so these suggestions will go away?

/Henrik

#85889
May 08, 2014 7:45
Vote:
 

Response from Henrik Lindström

They will go away eventually as the suggestion statistics have a time to live of 45/90/180 days depending on account type, but there is currently no way of removing suggestions that once had hits. You can of course hit a multisearch count query for each suggestion to check if it still exists (it should be fast and basically only be the round trip time to the server.

#86072
May 13, 2014 13:57
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.