lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@lucene.com>
Subject Re: Split results based on the value of a field
Date Thu, 11 Sep 2003 21:01:48 GMT
Jon Pither wrote:
> I have a requirement whereupon I'd like to pull search results back and 
> split them up based on some keyword field. So for example, says there's 
> a field named 'category',  I'd like to be able to have the results 
> displayed as such:
> 
> Search Results for Category A:
> 1,
> 2,
> 3,
> 
> Search Results for Category B:
> 1,
> 2,
> 3.
> 
> The two ways I can think to do this are:
> 1) A post-process of the results collecting the first x amount of hits 
> for each category.
> 2) Running a different search per category.

You could put the text for category A documents in one field, and the 
text for category B documents in another field, then run two searches, 
one of each field.  Then, if you need to search both categories with 
merged results, construct a query that searches both fields.  If you 
never need to do that, you could even use two separate indexes.

Doug


Mime
View raw message