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:
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: config · GitHub
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: config · GitHub
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: config · GitHub
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.