I have a search case where it's desirable to anchor the query at the
beginning and end of the string but allow slop in the middle. For example,
I have field "friends" with a list of names in it as strings:
"A User"
"B User"
"A B User"
"C User D"
"C User"
The user needs to be able to enter a query like "A User" and have it match
"A User" and "A B User" but not others (the reason for this is that they
typically get the first initial correct and last name but may not know any
middle initials). A search for "C User" should not match "C User D". This
is in an application I'm porting from solr to Elasticsearch, in solr I had
written a span query plugin to construct these and then surrounded each
name with tokens: "^^^ A User $$$" so I could anchor span terms on the
beginning and end of the strings.
I'm wondering what the translation of this is to elasticsearch, any help
greatly appreciated.
Let me know how it went and don't hesitate to ask if you need any further
information
Cheers
Luca
On Thursday, August 22, 2013 9:20:58 PM UTC+2, Paul Dlug wrote:
I have a search case where it's desirable to anchor the query at the
beginning and end of the string but allow slop in the middle. For example,
I have field "friends" with a list of names in it as strings:
"A User"
"B User"
"A B User"
"C User D"
"C User"
The user needs to be able to enter a query like "A User" and have it match
"A User" and "A B User" but not others (the reason for this is that they
typically get the first initial correct and last name but may not know any
middle initials). A search for "C User" should not match "C User D". This
is in an application I'm porting from solr to Elasticsearch, in solr I had
written a span query plugin to construct these and then surrounded each
name with tokens: "^^^ A User $$$" so I could anchor span terms on the
beginning and end of the strings.
I'm wondering what the translation of this is to elasticsearch, any help
greatly appreciated.
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.