lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Baranczak <>
Subject grouping search results
Date Tue, 09 May 2006 17:46:25 GMT
The documents in my index will contain a "category" field. (We can  
assume that the number of possible categories will be small - 10 or  
so max - and that they'll be known in advance.) I need to be able to  
present the search results to the end user like this:

- top 10 results in category "x":
	1. sdfsdfsd
	2. dfgdgfdfg
	3. [...]
- top 10 results in category "y":
	1. gffgdgf
	2. kjhjkkghj

The first thing I thought of was to construct a boolean AND query for  
every possible category (from the user's query and a term query for  
the category); but this seems like it might be causing a lot of  
redundant work. My next idea was to create a QueryFilter from the  
user's query, and run a search for each category with this filter and  
a term query. Since the QueryFilter is supposed to cache results,  
this should theoretically be more efficient. So my questions to the  
Lucene gurus are:

1) Will the QueryFilter method really be more efficient?

2) Is there yet another way to accomplish what I need?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message