0

I am looking for way to match a very specific expression or word in my solr collection. Here is an example : I want the query to return me : "Paris" And not : "Paris is great" And not : "I like Paris"

Thanks :)

1

2 Answers 2

1

If you only want exact matches, make sure the field type is defined as string. A string field will not do any tokenization or use any filters, and will only generate hits when the query is exactly the same as the value indexed.

Sign up to request clarification or add additional context in comments.

2 Comments

I changed my schema.xml to define the field type as string, but even after restarting Solr, the results do not match exactly. Am I doing something wrong here ?
You'll have to reindex before the results will change.
0

You need to use KeywordTokenizer

This tokenizer treats the entire text field as a single token

https://lucene.apache.org/solr/guide/6_6/tokenizers.html#Tokenizers-KeywordTokenizer

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.