This question was asked before, but my reply to the original post was never
accepted by the mailing list. So, sorry to re-ask same question again on a
new post.
I want to return the doc with exactly matched title, but allowing case
insensitive and redundant white space between words. That is, all of these
queries: "this is my test TITLE", "this is my test title" and "this is
my test title" will match the doc.
My initial idea is to define a custom analyzer with keyword tonenizer and
lowercase filter:
"settings" : {
"analysis" : {
"analyzer" : {
"lowercase_keyword" : {
"type" : "custom",
"tokenizer" : "keyword",
"filter" : "lowercase"
}
}
}
}
and use lowercase_keyword analyzer for title filed:
"properties" : {
"title" : {
"type" : "string",
"analyzer" : "lowercase_keyword"
}
}
It works well for both "this is my test TITLE" and "this is my test title".
But does not work for redundant white spaces case like "this is my
test title".
How can I define my custom analyzer to achieve my goal?
This question was asked before, but my reply to the original post was never accepted by the mailing list. So, sorry to re-ask same question again on a new post.
I want to return the doc with exactly matched title, but allowing case insensitive and redundant white space between words. That is, all of these queries: "this is my test TITLE", "this is my test title" and "this is my test title" will match the doc.
My initial idea is to define a custom analyzer with keyword tonenizer and lowercase filter:
"settings" : {
"analysis" : {
"analyzer" : {
"lowercase_keyword" : {
"type" : "custom",
"tokenizer" : "keyword",
"filter" : "lowercase"
}
}
}
}
and use lowercase_keyword analyzer for title filed:
"properties" : {
"title" : {
"type" : "string",
"analyzer" : "lowercase_keyword"
}
}
It works well for both "this is my test TITLE" and "this is my test title". But does not work for redundant white spaces case like "this is my test title".
How can I define my custom analyzer to achieve my goal?
Thanks David.
But unfortunately, it does not work.
I tried with _analyze API, if the input is “this is test Title”,
the output is:
{"tokens":[{"token":"this is test
title","start_offset":0,"end_offset":30,"type":"word","position":1}]}
On Friday, February 27, 2015 at 5:43:10 PM UTC+8, David Pilato wrote:
Le 27 févr. 2015 à 10:40, Xudong You <xudon...@gmail.com <javascript:>> a
écrit :
I have document like this:
{"Title":"This is my test title"}
This question was asked before, but my reply to the original post was
never accepted by the mailing list. So, sorry to re-ask same question
again on a new post.
I want to return the doc with exactly matched title, but allowing case
insensitive and redundant white space between words. That is, all of these
queries: "this is my test TITLE", "this is my test title" and "this is
my test title" will match the doc.
My initial idea is to define a custom analyzer with keyword tonenizer and
lowercase filter:
"settings" : {
"analysis" : {
"analyzer" : {
"lowercase_keyword" : {
"type" : "custom",
"tokenizer" : "keyword",
"filter" : "lowercase"
}
}
}
}
and use lowercase_keyword analyzer for title filed:
"properties" : {
"title" : {
"type" : "string",
"analyzer" : "lowercase_keyword"
}
}
It works well for both "this is my test TITLE" and "this is my test
title". But does not work for redundant white spaces case like "this is
my test title".
How can I define my custom analyzer to achieve my goal?
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.