How to have Solr autocomplete on whole phrase when query contains multiple terms?

后端 未结 3 1850
离开以前
离开以前 2021-01-30 12:12

I\'ve looked through a ton of examples and other questions here and from them, I\'ve got my config very close to what I need but I\'m missing one last little bit that I\'m havin

3条回答
  •  伪装坚强ぢ
    2021-01-30 12:19

    I've tried this many times and I came to the conclusion that is not possible out of the box. I found a workaround for that:

    I indexed the data adding sopecial chars between each word so that they would not be tokenized. For example:

    solarzzzzzzpowered
    solarzzzzzzglass
    solarzzzzzzglobe
    

    then when you compose your query you make sure you add the same amount of chars between the two words you type, for example solr gl become solarzzzzzzgl.

    This will achieve the behavious that you are asking.

    Another option would be not to use the autosuggestion field and make a custom field for yourself, but then you will have to manage the wildcard search and all the indexation by yourself and is not too convenient in terms of time and performance.

提交回复
热议问题