How can I use Lucene for personal name (first name, last name) search?
- by os111
I'm writing a search feature for a database of NFL players.
The user enters a search string like "Jason Campbell" or "Campbell" or "Jason".
I'm having trouble getting the appropriate results.
Which Analyzer should I use when indexing? Which Query when querying? Should I distinguish between first name and last name or just index the full name string?
I'd like the following behavior:
Query: "Jason Campbell" - Result: exact match for 1 player, Jason Campbell
Query: "Campbell" - Result: all players with Campbell in their name
Query: "Jason" - Result: all players with Jason in their name
Query: "Cambel" [misspelled] - Result: all players with Campbell in their name