biola/buweb-content-models — pull request #7 by jesilz (2014-06-07 05:40:56+00:00)
Title: supports better person searches

indexed a few more versions of a person's name and added a custom analyzer with an edgeNGram filter to support partial search matches. for DIR-56

Instructions: run `Person.import force: true` to apply the new mapping to your elasticsearch person index

To really test the search replace the profile-publisher app's SearchQuery.query() method with the following:
```ruby
def query
if term.present?
{
multi_match: {
query: term,
type: 'cross_fields',
operator: 'and',
analyzer: 'standard',
fields: [
"title^4",
"*_name",
"*_initial",
"preferred_name^4",
"aliases",
"subtitle^2",
"department",
"location",
"email",
"phone",
"description"]
}
}
else
{ match_all: {} }
end
end
```

and then run some searches using the first part of someone's name (example: "will" to find "William") or combinations like "j doe" or "john d"