You might take a look at grouping, aka field collapsing. Faceting gives you counts for various values in a field, but not a mixture of documents, whereas grouping will return you the top N members of each group which sounds like what you're after.
Best Erick On Mon, Nov 21, 2011 at 5:04 AM, Ian Lea <ian....@gmail.com> wrote: > Running two queries is fine, as is looping through the results list. > I don't think it is clear that one in necessarily "better" than the > other. Faceting generally works by looping through results because > you typically don't know in advance what values will be present. > > -- > Ian, > > > 2011/11/21 liugangc <liuga...@gmail.com>: >> hi,faceted search is like group by in SQL, and also need query two time to >> get two list in your situation. I think there isn't better way to solve >> your problem. >> >> -- >> gang liu >> email: liuga...@gmail.com >> >> >> >> At 2011-11-21 09:35:08,"Felipe Carvalho" <felipe.carva...@gmail.com> wrote: >>>Hello, >>> I'm working on a people finder app over an index built of Person >>>documents. Among other attributes (name, gender, phone, ...) I have a >>>hiringType attribute, which possible values are EMPLOYEE and CONSULTANT. >>> When I run a "name" search over these documents, I need to render two >>>lists: employees that match the search criteria and consultants that match >>>the criteria. >>> I'm running Lucene 3.4, is there a way for Lucene to hand me over those >>>lists of documents separately on the same query? >>> Currently I run the query and then loop through the results, separating >>>employees and consultants in two lists, is there a better way to do this? >>> A heard a colleague saying Solr supports this through "faceted search" >>>(I'm not sure this is the right name), is there such thing on Lucene as >>>well? (unfortunately using Solr is not an option for this app) >>> >>>Thanks! >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org