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 Gustav <xb...@sharklasers.com> on 2012/09/20 15:05:42 UTC

"&" char in querystring

Good Morning Everyone!
Again, i need your help Lucene comunity! 
I have a query string just like this: q="johnson & johnson" and when i use
debugQuery=true i realize that the Solrparse breaks the string exactly in
the "&" char, changing my query to q="Johnson", i would like to know, is
there any way to avoid this?



--
View this message in context: http://lucene.472066.n3.nabble.com/char-in-querystring-tp4009174.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: "&" char in querystring

Posted by Jack Krupansky <ja...@basetechnology.com>.
Ah... you are probably not "encoding" the & and % in your URL, so they are 
being eaten when the URL is parsed. Use % followed by the 2-digit hex ASCII 
character code. & should be %26 and % should be %25.

-- Jack Krupansky

-----Original Message----- 
From: Gustav
Sent: Thursday, September 20, 2012 10:13 AM
To: solr-user@lucene.apache.org
Subject: Re: "&" char in querystring

Hello Jack,
My the fieldtype is configured as following:

    <fieldType class="solr.TextField" name="exact_search"
positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.ISOLatin1AccentFilterFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

What other filter could i use to preserve the "&" char?



Another problem that came up, is when i search for ?q="0,5%" it gives an
error:
HTTP Status 400 - missing query string

Probably because of the "%" char, is there any way to escape it?




--
View this message in context: 
http://lucene.472066.n3.nabble.com/char-in-querystring-tp4009174p4009191.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: "&" char in querystring

Posted by Gustav <xb...@sharklasers.com>.
Hello Jack, 
My the fieldtype is configured as following:

    <fieldType class="solr.TextField" name="exact_search"
positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.ISOLatin1AccentFilterFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

What other filter could i use to preserve the "&" char?



Another problem that came up, is when i search for ?q="0,5%" it gives an
error:
HTTP Status 400 - missing query string

Probably because of the "%" char, is there any way to escape it?




--
View this message in context: http://lucene.472066.n3.nabble.com/char-in-querystring-tp4009174p4009191.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: "&" char in querystring

Posted by Jack Krupansky <ja...@basetechnology.com>.
Use a field type whose analyzer preserves the &. What field type are you 
using?

-- Jack Krupansky

-----Original Message----- 
From: Gustav
Sent: Thursday, September 20, 2012 9:05 AM
To: solr-user@lucene.apache.org
Subject: "&" char in querystring

Good Morning Everyone!
Again, i need your help Lucene comunity!
I have a query string just like this: q="johnson & johnson" and when i use
debugQuery=true i realize that the Solrparse breaks the string exactly in
the "&" char, changing my query to q="Johnson", i would like to know, is
there any way to avoid this?



--
View this message in context: 
http://lucene.472066.n3.nabble.com/char-in-querystring-tp4009174.html
Sent from the Solr - User mailing list archive at Nabble.com.