Field and query_string don't use configured analyzer


(Matt Weber) #1

I have a field configured using an analyzer that does keyword tokenization and lowercasing. When I attempt to perform a search against this field using a field or query_string query, I don't get the expected result. Specifying the analyzer for the query does not help. If I do a text query against this field, everything works as expected. Am I doing something wrong?

My config, mapping, test document, and test queries can be found in this gist:

Thanks!

--
Matt Weber
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


(Matt Weber) #2

Forgot to mention that I am using 0.19.0.RC2.

--
Matt Weber
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Wednesday, February 15, 2012 at 11:06 AM, Matt Weber wrote:

I have a field configured using an analyzer that does keyword tokenization and lowercasing. When I attempt to perform a search against this field using a field or query_string query, I don't get the expected result. Specifying the analyzer for the query does not help. If I do a text query against this field, everything works as expected. Am I doing something wrong?

My config, mapping, test document, and test queries can be found in this gist:
https://gist.github.com/1838124

Thanks!

--
Matt Weber
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


(Shay Banon) #3

This happens because the Lucene query parser parses the text based on whitepsaces first in order to parse the syntax supported by it. So, the query ends up being on "matt" and "weber". You can wrap it in " characters to explicit state its a phrase, I commented on the gist with one that works.

The text query does not suffer it since it just takes the text and uses the relevant analyzer on it.

On Wednesday, February 15, 2012 at 9:06 PM, Matt Weber wrote:

I have a field configured using an analyzer that does keyword tokenization and lowercasing. When I attempt to perform a search against this field using a field or query_string query, I don't get the expected result. Specifying the analyzer for the query does not help. If I do a text query against this field, everything works as expected. Am I doing something wrong?

My config, mapping, test document, and test queries can be found in this gist:
https://gist.github.com/1838124

Thanks!

--
Matt Weber
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


(Matt Weber) #4

Works perfect, thank you! Something so simpleā€¦

--
Matt Weber
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Wednesday, February 15, 2012 at 12:02 PM, Shay Banon wrote:

This happens because the Lucene query parser parses the text based on whitepsaces first in order to parse the syntax supported by it. So, the query ends up being on "matt" and "weber". You can wrap it in " characters to explicit state its a phrase, I commented on the gist with one that works.

The text query does not suffer it since it just takes the text and uses the relevant analyzer on it.

On Wednesday, February 15, 2012 at 9:06 PM, Matt Weber wrote:

I have a field configured using an analyzer that does keyword tokenization and lowercasing. When I attempt to perform a search against this field using a field or query_string query, I don't get the expected result. Specifying the analyzer for the query does not help. If I do a text query against this field, everything works as expected. Am I doing something wrong?

My config, mapping, test document, and test queries can be found in this gist:
https://gist.github.com/1838124

Thanks!

--
Matt Weber
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


(system) #5