You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by nithyavembu <ni...@yahoo.co.in> on 2007/08/29 14:05:41 UTC
How to use special characters during Solr Search?
Hi All,
I am facing a very big problem in search.
I want to give special characters in search text. I am able to give the
search text but i am not getting the related result.
I have three records namely
* priya
* priyadarshini
* priyamani
which i have indexed.
But while doing search the problem occuring.
Scenario 1 : I want to give "priya" with double quotes. The result should
be only priya which is 1.
My programming model normally written as (searchtext*) which searches
all records. So i given ("priya"*). But it was unable to parse in solr. So i
gave ("priya"\*) which gives the result only priya.
here " (quotes) are encoded and (\) escape character also encoded.
Scenario 2 : But i want to search normal as (priya*). But now my program
contains the fomat as
(searchtext\*). Now if i search as (priya\*), it should display all three
records. But it displaying only one record.
I cant write the program by special character and without special
character and its also not a indication for a good programmer i hope.
Is there any optimized technique. Please help me out. Thanks in advance.
with Regards,
V.Nithya.
--
View this message in context: http://www.nabble.com/How-to-use-special-characters-during-Solr-Search--tf4347326.html#a12385644
Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to use special characters during Solr Search?
Posted by Chris Hostetter <ho...@fucit.org>.
> Scenario 1 : I want to give "priya" with double quotes. The result should
> be only priya which is 1.
> My programming model normally written as (searchtext*) which searches
> all records. So i given ("priya"*). But it was unable to parse in solr. So i
> gave ("priya"\*) which gives the result only priya.
i don't understand your question ... if you want to search for: '"priya"
with double quotes' then why do you have your code add a '*' to the end?
attempting to guess what you mean: it wounds like you have code which
currently assumes that whenever the user types something in to search on,
you want to turn it into a prefix search (so you add a '*') but this
doesn't work if the user gives you characters that have meaning in the
search syntax (like quotes) ... it seems like the "correct" solution is to
fix your code so that you only make your previous assumption (about
wanting to do a prefix search) if the input doesn't contain any markup
characters.
-Hoss