Solr Search Field Best Practices

I am using solr for an enterprise application. So far, this works well, as I use the ngram field to search. It works correctly for partial queries (matches indexed ngrams). But the problem I have is how to ensure that exact queries match ?. For example, the query β€œTest 1” should match exactly as when the user enters it with double quotes. Currently, since I used some tokenizers and filters, double quotes are filtered out, there is no difference in the requests "test 1", "tEst 1" or "TEST 1" (this is due to the analyzer circuit I use, but it is necessary to work with ngrams and partial search),

I am currently looking for an ngram request field. What needs to be done to match requests exactly, what should I do? What is the best practice ?. I currently believe that you need to identify double quotes from the client side and change the request field to the original field (using ngrams). But I feel that there must be a better way to do this, since the problem I have is a common one, and solr is a complete enterprise level search engine.

0
source share
1 answer

To do this, there may be another field and add string as a fieldType for it and index it with the same.

If you want to make an exact match, you can query in the above field.

And if you want to do a partial search .. you can request an earlier field that is indexed by ngram.

OR .. Here is another way you can try.

You determined the current field type using ngram. While indexing, you can define the ngram tokenizer, and for the request you specify the Tokenizer keyword and the lower case filter factory.

When indexing, the text will be tokened, but when the query is executed, it will not.

0
source

All Articles