lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alok Bhandari <alokomprakashbhand...@gmail.com>
Subject Re: How to achieve exact string match query which includes spaces and quotes
Date Fri, 22 Jan 2016 12:55:19 GMT
Hello Binoy ,

I found that if I am using a StringField and index it using java
code/solr-admin it adds a \ before " , 
i.e. lest say I have string ==> test " , then it gets indexed as test \".
For all other special chars it does not do anything , so the trick which
worked for me is 
while searching I replace " with \" using this code text.replaceAll("\"",
"\\\\\"").

This makes sure that it matches the intended string , also if I use
ClientUtils then I need to make changes in indexing code also to escape
special chars as using ClientUtils to make exact search work. 

So I found just replacing " with \" does the trick for me.

Thanks.



--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-achieve-exact-string-match-query-which-includes-spaces-and-quotes-tp4250402p4252522.html
Sent from the Solr - User mailing list archive at Nabble.com.

Mime
View raw message