Simple Solr schema problem for autocomplete

后端 未结 2 1056
死守一世寂寞
死守一世寂寞 2021-01-03 10:32

I have a very simple SQL table that I want to import into Solr but because of the features I want for search I can\'t determine the best schema.

The user will start

2条回答
  •  被撕碎了的回忆
    2021-01-03 11:04

    what do you want to know exactly?

    if your question is how to get your data there? easiest way is posting xml files....

    how do you define your schema.xml? you dont have to, there are pre-defined wildcard fields for strings, they end with _s i think.

    how do you form the query?... well as easy as myfield_string:"boa*"

    obviously xml? why? json is smaller and just as good for this purpose!

    have you checked out the official tutorial? http://lucene.apache.org/solr/tutorial.html

    do you want to do an autosuggesting for words or whole documents?

    first is very easy. solr even has its very optimized handler for that. check out this tutorial: http://www.mattweber.org/2009/05/02/solr-autosuggest-with-termscomponent-and-jquery/

    second one gets more interesting. what if someone types "collection of boats" or something like that? i personally would recommend using dismax handler with a wildcard at the end for autosuggesting. then words are in logical OR conjunction and the not finished word is matched at the beginning...

提交回复
热议问题