I have a requirement to support filtering search results by first letter. This is relatively simple by adding a field to each index that represents the first letter for that relevant index and then adding a filter to the search.

The hard part is that I need to list all the letters you can filter BY. So if there are no names that start with S, it shouldn't appear as an option. Is there a simple and performant way to get a set of all the unique values for a Field in the Hits returned? There would probably only be low number of unique values.

So let's say I have the following in my index:

letter, personName
m, mike smith
p, paul smith
g, george smith
g, glenda smith

I need to be able to display to the user that they can filter based on M, P or G within their search for George.

I could do a compromise and for search results above a certain level, show all letters and numbers, but it won't always give correct values. Imagine this edge case: A search for george has 50,000 results, but only a couple people had george as their last name. Not many of the letters would be valid filters.

Thanks for any ideas or approaches I overlooked.

Paul Sundling


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to