简体   繁体   中英

Lucene search result not optimal

I know the different parts of lucene and how to use them but I have one problem left. Lucene is running in my online shop and does a good job. Now I want to optimize the search result from my search function with a single search field, where the user can input anything he wants to search for. Since now I'm combining different search approaches to get the results like phrase and fuzzy search. the problem is I get always a huge resultset back. I want a smaller result list with the best hits. I can achieve this when I leave fuzzy. Then I've got a great search result but when the user types something wrong the result is empty.

There must be a solution to get a small resultset with great score and also combine it with fuzzy search if the hits are bad?!

What do I have to think of? Which way should I go? What's the best solution for that situation?

One approach is to first search using a non-fuzzy query. If that search returns a reasonable number of hits, then you are done.

If that first search returns 0 hits, then try searching again by combining searches where each individual search term is fuzzed once -- for example, if you have "ABC", the second search would be something like "(A~ AND B AND C) OR (A AND B~ AND C) OR (A AND B AND C~)". That would minimize the fuzziness introduced while still fuzzing each search term.

Please note that I have not tried this method, but I have tried a similar method where your second search drops each search term once so you handle search terms that are not in the index at all -- "(A AND B) OR (A AND C) OR (B AND C)".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM