atom feed5 messages in org.apache.lucene.solr-userRe: Group results by field?
FromSent OnAttachments
Matthew RunoMay 2, 2007 3:55 pm 
Brian WhitmanMay 2, 2007 3:57 pm 
Tom HillMay 2, 2007 4:15 pm 
Matthew RunoMay 2, 2007 4:16 pm 
Matthew RunoMay 2, 2007 4:48 pm 
Subject:Re: Group results by field?
From:Tom Hill (solr@zvents.com)
Date:May 2, 2007 4:15:28 pm
List:org.apache.lucene.solr-user

Hi Matthew,

You might be able to just get away with just using facets, depending on whether your goal is to provide a clickable list of styles_ids to the user, or if you want to only return one search result for each style_id.

For a list of clickable styles, it's basic faceting, and works really well.

http://wiki.apache.org/solr/SimpleFacetParameters Facet on style_id, present the list of facets to the user, and if the user selects style_id =37, then reissue the query with one more clause (+style_id:37)

If you want the ability to only show one search result from each group, then you might consider the structure of your data. Is each style/size a separate record? Or is each style a record with multi-valued sizes? The latter might give you what you really want.

Or, if you really want to remove dups from search results, you could do what I've done.I ended up modifying SolrIndexSearcher, and replacing FieldSortedHitQueue, and ScorePriorityQueue with versions that remove dups based in a particular field.

Tom

On 5/2/07, Matthew Runo <mru@zappos.com> wrote:

Hello!

I was wondering - is it possible to search and group the results by a given field?

For example, I have an index with several million records. Most of them are different sizes of the same style_id.

I'd love to be able to do.. group.by=style_id or something like that in the results, and provide the style_id as a clickable link to see all the sizes of that style.

Any ideas?