Pregunta

I've setup Solr for autosuggestions. It needs to be able to suggest phrases and handle spelling errors. So far, I'm using a normally tokenized field for spelling suggestions (works fine) and a copy of the same field without tokenization to search on with wildcards for autosuggestion (e.g. *searchterm*). This also works ok, but due to wildcards, the scoring is always 1 for each document. In addition, normal scoring wouldn't actually make sense here. The natural way to score would be based on how many results would the suggested phrase generate if it were a search term itself. Something similar to what Solr's spellchecker is using. I don't think this is possible out of the box, but I have no real clue. Any ideas on how to achieve this? Or at least improve it? It's important that the suggestions remain full phrases.

¿Fue útil?

Solución

You can use TermsComponent with terms.prefix=searchterms or terms.regex=.*searchterm.* for suggestions. It returns the frequency of found terms.

Otros consejos

I guess this isn't exactly what you are looking for but if you have search log from the users of your search, you can use frequency as one of the boosting or just doing ordering by the frequency.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top