简体   繁体   中英

Solr search query

in this code I'm searching the word 'the gimme' from the field 'name'

SolrQuery slrQuery = new SolrQuery("name:the gimme");
System.out.println(slrQuery.toString());

the result q=name%3Athe+gimme so the space characters was transformed to '+', solr return the fields that have the word 'the' or 'gimme' but I need filds have only 'the gimme'

can I have a solution? Thanks.

You have to decide between search and "phrased search". If you like to match the exact term the gimme you have to use phrased search. How this works depends on the query parser, you are using. Try:

SolrQuery slrQuery = new SolrQuery("name:\"the gimme\"");

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