lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Sundling (Webdaddy)" <...@tkz.net>
Subject filtering by first letter
Date Fri, 23 Feb 2007 20:25:52 GMT
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message