Query for the name search

(mfeingold) #1

I have a document with 2 fields - first name and last name.

For the last name I would like to use exact match, phonetic match and
(may be) wild card - specifically * in the end. I would also like to
do fuzzy search with edit distance no more than 2 char.

For the first name I want the same plus name synonyms (Beth vs Lisa).

Here is my settings file I used for indexing the data https://gist.github.com/1154453

What I am struggling with now is how to build a query out of the
string with the first name and the last name. I can (I think) build
reasonable query I can use to run the name string separately against
first name or last name. How should I combine them so that record John
John does not jump in front of John Smith when I run the query string
"John Smith"?

In other words when the document matches both fields how can I
differentiate between 2 different terms from the query string matching
each field vs the same term matching both fields.

Also how can I account for the order in which they match - if the
terms in the query string are in the order of first name than last
name - I would like to give it a bigger rank than if the order is

Can it be done?

(system) #2