lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zheng Lin Edwin Yeo <edwinye...@gmail.com>
Subject Re: Error when searching with special characters
Date Fri, 01 Jul 2016 07:51:26 GMT
Hi Ere,

Yes, this works.
Thanks for your reply.

Regards,
Edwin


On 1 July 2016 at 15:00, Ere Maijala <ere.maijala@helsinki.fi> wrote:

> You need to make sure you encode things properly in the URL. You can't
> just place an ampersand there because it's the parameter delimiter in a
> URL. If you're unsure, use e.g. http://meyerweb.com/eric/tools/dencoder/
> to encode your search terms. You'll see that "r&d" will become %22r%26d%22.
> Escaping the ampersand for Solr is another thing. If that's needed, you'll
> need to URL encode "r\&d" so that it becomes %22r%5C%26d%22.
>
> --Ere
>
>
> 1.7.2016, 7.13, Zheng Lin Edwin Yeo kirjoitti:
>
>> Hi,
>>
>> When I use defType=edismax, and using debug mode by setting debug=True, I
>> found that the search for "r&d" is actually done to search on just the
>> character "r".
>>
>> http://localhost:8983/solr/collection1/highlight?q=
>> "r&d"&debugQuery=true&defType=edismax
>>
>>   "debug":{
>>     "rawquerystring":"\"r",
>>     "querystring":"\"r",
>>     "parsedquery":"(+DisjunctionMaxQuery((text:r)))/no_coord",
>>     "parsedquery_toString":"+(text:r)"
>>
>>
>> Even if I search with escape character, it is of no help.
>>
>> http://localhost:8983/solr/collection1/highlight?q=
>> "r\&d"&debugQuery=true&defType=edismax
>>
>>   "debug":{
>>     "rawquerystring":"\"r\\",
>>     "querystring":"\"r\\",
>>     "parsedquery":"(+DisjunctionMaxQuery((text:r)))/no_coord",
>>     "parsedquery_toString":"+(text:r)",
>>
>>
>>
>> But if I'm using other symbols like "r*d", then the search is ok.
>>
>> http://localhost:8983/solr/collection1/highlight?q=
>> "r*d"&debugQuery=true&defType=edismax
>>
>>   "debug":{
>>     "rawquerystring":"\"r*d\"",
>>     "querystring":"\"r*d\"",
>>     "parsedquery":"(+DisjunctionMaxQuery((text:\"r d\")))/no_coord",
>>     "parsedquery_toString":"+(text:\"r d\")",
>>
>>
>> What could be the reason behind this?
>>
>>
>> Regards,
>> Edwin
>>
>>
>> On 20 June 2016 at 02:12, Ahmet Arslan <iorixxx@yahoo.com> wrote:
>>
>> Hi,
>>>
>>> It is better to create a failing junit test case before opening jira.
>>>
>>> ahmet
>>>
>>>
>>> On Sunday, June 19, 2016 4:44 PM, Zheng Lin Edwin Yeo <
>>> edwinyeozl@gmail.com> wrote:
>>>
>>>
>>> Yes, it throws the parse exception even if the query is properly escaped
>>> for ampersand (&) for defType=lucene.
>>>
>>> Should we treat this as a bug, and create a JIRA>
>>>
>>> Regards,
>>> Edwin
>>>
>>>
>>>
>>> On 19 June 2016 at 08:07, Ahmet Arslan <iorixxx@yahoo.com> wrote:
>>>
>>>
>>>
>>> If properly escaped ampersand throws parse exception, this could be a
>>> bug.
>>>
>>>
>>>
>>> On Saturday, June 18, 2016 7:12 PM, Zheng Lin Edwin Yeo <
>>> edwinyeozl@gmail.com> wrote:
>>> Hi,
>>>
>>> It does not work with the back slash too.
>>>
>>> But I found that it does not work for defType=lucene.
>>> It will work if the defType=dismax or edismax.
>>>
>>> What could be the reason that it did not work with the default
>>> defType=lucene?
>>>
>>> Regards,
>>> Edwin
>>>
>>>
>>>
>>> On 18 June 2016 at 01:04, Ahmet Arslan <iorixxx@yahoo.com.invalid>
>>> wrote:
>>>
>>> Hi,
>>>>
>>>> May be URL encoding issue?
>>>> By the way, I would use back slash to escape special characters.
>>>>
>>>> Ahmet
>>>>
>>>> On Friday, June 17, 2016 10:08 AM, Zheng Lin Edwin Yeo <
>>>> edwinyeozl@gmail.com> wrote:
>>>>
>>>>
>>>>
>>>> Hi,
>>>>
>>>> I encountered this error when I tried to search with special characters,
>>>> like "&" and "#".
>>>>
>>>> {
>>>>   "responseHeader":{
>>>>     "status":400,
>>>>     "QTime":0},
>>>>   "error":{
>>>>     "msg":"org.apache.solr.search.SyntaxError: Cannot parse
>>>> '\"Research ': Lexical error at line 1, column 11.  Encountered: <EOF>
>>>> after : \"\\\"Research \"",
>>>>     "code":400}}
>>>>
>>>>
>>>> I have done the search by putting inverted commands, like: q="Research &
>>>> Development"
>>>>
>>>> What could be the issue here?
>>>>
>>>> I'm facing this problem in both Solr 5.4.0 and Solr 6.0.1.
>>>>
>>>>
>>>> Regards,
>>>> Edwin
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>
> --
> Ere Maijala
> Kansalliskirjasto / The National Library of Finland
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message