Suppose I have a query "a system and method for retrieving". A phrase
query will return a hit only if a document contains all the terms in
the phrase. But what if I have a document which has the term:
"a system for retrieving"
but no mention of the keyword "method" anywhere in the document. Is
there any way to do a phrase query while allowing "deletion" of
certain terms so that i'd be able to match the above? I can think of
taking the long query and running smaller sub-phrase queries on it in
sequence, but I was wondering if there was a way to get this behavior
out of the box.
By default, a QueryString query is a OR query. So, I think your assertion : "A phrase query will return a hit only if a document contains all the terms in the phrase." is false.
If you query for "a system for retrieving", it will return your document.
Suppose I have a query "a system and method for retrieving". A phrase
query will return a hit only if a document contains all the terms in
the phrase. But what if I have a document which has the term:
"a system for retrieving"
but no mention of the keyword "method" anywhere in the document. Is
there any way to do a phrase query while allowing "deletion" of
certain terms so that i'd be able to match the above? I can think of
taking the long query and running smaller sub-phrase queries on it in
sequence, but I was wondering if there was a way to get this behavior
out of the box.
By default, a QueryString query is a OR query. So, I think your assertion : "A phrase query will return a hit only if a document contains all the terms in the phrase." is false.
If you query for "a system for retrieving", it will return your document.
Suppose I have a query "a system and method for retrieving". A phrase
query will return a hit only if a document contains all the terms in
the phrase. But what if I have a document which has the term:
"a system for retrieving"
but no mention of the keyword "method" anywhere in the document. Is
there any way to do a phrase query while allowing "deletion" of
certain terms so that i'd be able to match the above? I can think of
taking the long query and running smaller sub-phrase queries on it in
sequence, but I was wondering if there was a way to get this behavior
out of the box.
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.