lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: How to achieve exact string match query which includes spaces and quotes
Date Wed, 13 Jan 2016 17:05:44 GMT
what _does_ matter is getting all that through the parser which means
you have to enclose things in quotes and escape them.

For instance, consider this query  stringFIeld:abc "i am not"

this will get parsed as
stringField:abc defaultTextField:"i am not".

To get around this you need to make sure the entire search gets
through the parser as a _single_ token by enclosing in quotes. But
then of course you have confusion because you have quotes in your
search term so you need to escape those, something like
stringField:"abc \"i am not\""

Here's a list for Lucene 5
https://lucene.apache.org/core/5_1_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Escaping_Special_Characters

Best,
Erick

On Wed, Jan 13, 2016 at 3:39 AM, Binoy Dalal <binoydalal93@gmail.com> wrote:
> No.
>
> On Wed, 13 Jan 2016, 16:58 Alok Bhandari <alokomprakashbhandari@gmail.com>
> wrote:
>
>> Hi Binoy thanks.
>>
>> But does it matter which query-parser I use , shall I use "lucene" parser
>> or
>> "edismax" parser.
>>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/How-to-achieve-exact-string-match-query-which-includes-spaces-and-quotes-tp4250402p4250405.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
> --
> Regards,
> Binoy Dalal

Mime
View raw message