You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by oleg_gnatovskiy <ol...@citysearch.com> on 2008/05/13 03:58:39 UTC

Field Grouping

Hello. I was wondering if there is a way to get solr to return fields with
the same value for a particular field together. For example I might want to
have all the documents with exactly the same name field all returned next to
each other. Is this possible? Thanks!
-- 
View this message in context: http://www.nabble.com/Field-Grouping-tp17199592p17199592.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Field Grouping

Posted by Uri Boness <ub...@gmail.com>.
Hi,

I'm actually quite interested in this feature. What is the ranking 
strategy for the group? is it based on the highest ranking document with 
in the group? is it configurable?

cheers,
Uri

oleg_gnatovskiy wrote:
> Yes, that is the patch I am trying to get to work. It doesn't have a feature
> for distributed search.
>
>
> ryantxu wrote:
>   
>> You may want to check "field collapsing"
>> https://issues.apache.org/jira/browse/SOLR-236
>>
>> There is a patch that works against 1.2, but the one for trunk needs  
>> some work before it can work...
>>
>> ryan
>>
>>
>> On May 13, 2008, at 2:46 PM, oleg_gnatovskiy wrote:
>>     
>>> There is an XSLT example here:
>>> http://wiki.apache.org/solr/XsltResponseWriter
>>> , but it doesn't seem like that would work either... This example  
>>> would only
>>> do a group by for the current page. If I use Solr for pagination,  
>>> this would
>>> not work for me.
>>>
>>>
>>> oleg_gnatovskiy wrote:
>>>       
>>>> But I don't want the search results to be ranked based on that  
>>>> field. I
>>>> only want all the documents with the same value grouped together...  
>>>> The
>>>> way my system is set up, most documents will have that field empty.  
>>>> Thus,
>>>> if Is rot by it, those documents that have a value will bubble to the
>>>> top...
>>>>
>>>>
>>>>
>>>> Yonik Seeley wrote:
>>>>         
>>>>> On Mon, May 12, 2008 at 9:58 PM, oleg_gnatovskiy
>>>>> <ol...@citysearch.com> wrote:
>>>>>           
>>>>>> Hello. I was wondering if there is a way to get solr to return  
>>>>>> fields
>>>>>> with
>>>>>> the same value for a particular field together. For example I might
>>>>>> want to
>>>>>> have all the documents with exactly the same name field all  
>>>>>> returned
>>>>>> next to
>>>>>> each other. Is this possible? Thanks!
>>>>>>             
>>>>> Sort by that field.  Since you can only sort by fields with a single
>>>>> term at most (this rules out full-text fields), you might want to  
>>>>> do a
>>>>> copyField of the "name" field to something like a "name_s" field  
>>>>> which
>>>>> is of type string (which can be sorted on).
>>>>>
>>>>> -Yonik
>>>>>
>>>>>
>>>>>           
>>>>         
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/Field-Grouping-tp17199592p17215641.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>
>>>       
>>
>>     
>
>   


Re: Field Grouping

Posted by oleg_gnatovskiy <ol...@citysearch.com>.
Yes, that is the patch I am trying to get to work. It doesn't have a feature
for distributed search.


ryantxu wrote:
> 
> You may want to check "field collapsing"
> https://issues.apache.org/jira/browse/SOLR-236
> 
> There is a patch that works against 1.2, but the one for trunk needs  
> some work before it can work...
> 
> ryan
> 
> 
> On May 13, 2008, at 2:46 PM, oleg_gnatovskiy wrote:
>>
>> There is an XSLT example here:
>> http://wiki.apache.org/solr/XsltResponseWriter
>> , but it doesn't seem like that would work either... This example  
>> would only
>> do a group by for the current page. If I use Solr for pagination,  
>> this would
>> not work for me.
>>
>>
>> oleg_gnatovskiy wrote:
>>>
>>> But I don't want the search results to be ranked based on that  
>>> field. I
>>> only want all the documents with the same value grouped together...  
>>> The
>>> way my system is set up, most documents will have that field empty.  
>>> Thus,
>>> if Is rot by it, those documents that have a value will bubble to the
>>> top...
>>>
>>>
>>>
>>> Yonik Seeley wrote:
>>>>
>>>> On Mon, May 12, 2008 at 9:58 PM, oleg_gnatovskiy
>>>> <ol...@citysearch.com> wrote:
>>>>> Hello. I was wondering if there is a way to get solr to return  
>>>>> fields
>>>>> with
>>>>> the same value for a particular field together. For example I might
>>>>> want to
>>>>> have all the documents with exactly the same name field all  
>>>>> returned
>>>>> next to
>>>>> each other. Is this possible? Thanks!
>>>>
>>>> Sort by that field.  Since you can only sort by fields with a single
>>>> term at most (this rules out full-text fields), you might want to  
>>>> do a
>>>> copyField of the "name" field to something like a "name_s" field  
>>>> which
>>>> is of type string (which can be sorted on).
>>>>
>>>> -Yonik
>>>>
>>>>
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Field-Grouping-tp17199592p17215641.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Field-Grouping-tp17199592p17244589.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Field Grouping

Posted by Ryan McKinley <ry...@gmail.com>.
You may want to check "field collapsing"
https://issues.apache.org/jira/browse/SOLR-236

There is a patch that works against 1.2, but the one for trunk needs  
some work before it can work...

ryan


On May 13, 2008, at 2:46 PM, oleg_gnatovskiy wrote:
>
> There is an XSLT example here: http://wiki.apache.org/solr/XsltResponseWriter
> , but it doesn't seem like that would work either... This example  
> would only
> do a group by for the current page. If I use Solr for pagination,  
> this would
> not work for me.
>
>
> oleg_gnatovskiy wrote:
>>
>> But I don't want the search results to be ranked based on that  
>> field. I
>> only want all the documents with the same value grouped together...  
>> The
>> way my system is set up, most documents will have that field empty.  
>> Thus,
>> if Is rot by it, those documents that have a value will bubble to the
>> top...
>>
>>
>>
>> Yonik Seeley wrote:
>>>
>>> On Mon, May 12, 2008 at 9:58 PM, oleg_gnatovskiy
>>> <ol...@citysearch.com> wrote:
>>>> Hello. I was wondering if there is a way to get solr to return  
>>>> fields
>>>> with
>>>> the same value for a particular field together. For example I might
>>>> want to
>>>> have all the documents with exactly the same name field all  
>>>> returned
>>>> next to
>>>> each other. Is this possible? Thanks!
>>>
>>> Sort by that field.  Since you can only sort by fields with a single
>>> term at most (this rules out full-text fields), you might want to  
>>> do a
>>> copyField of the "name" field to something like a "name_s" field  
>>> which
>>> is of type string (which can be sorted on).
>>>
>>> -Yonik
>>>
>>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Field-Grouping-tp17199592p17215641.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: Field Grouping

Posted by oleg_gnatovskiy <ol...@citysearch.com>.
There is an XSLT example here: http://wiki.apache.org/solr/XsltResponseWriter
, but it doesn't seem like that would work either... This example would only
do a group by for the current page. If I use Solr for pagination, this would
not work for me.


oleg_gnatovskiy wrote:
> 
> But I don't want the search results to be ranked based on that field. I
> only want all the documents with the same value grouped together... The
> way my system is set up, most documents will have that field empty. Thus,
> if Is rot by it, those documents that have a value will bubble to the
> top...
> 
> 
> 
> Yonik Seeley wrote:
>> 
>> On Mon, May 12, 2008 at 9:58 PM, oleg_gnatovskiy
>> <ol...@citysearch.com> wrote:
>>>  Hello. I was wondering if there is a way to get solr to return fields
>>> with
>>>  the same value for a particular field together. For example I might
>>> want to
>>>  have all the documents with exactly the same name field all returned
>>> next to
>>>  each other. Is this possible? Thanks!
>> 
>> Sort by that field.  Since you can only sort by fields with a single
>> term at most (this rules out full-text fields), you might want to do a
>> copyField of the "name" field to something like a "name_s" field which
>> is of type string (which can be sorted on).
>> 
>> -Yonik
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Field-Grouping-tp17199592p17215641.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Field Grouping

Posted by oleg_gnatovskiy <ol...@citysearch.com>.
But I don't want the search results to be ranked based on that field. I only
want all the documents with the same value grouped together... The way my
system is set up, most documents will have that field empty. Thus, if Is rot
by it, those documents that have a value will bubble to the top...



Yonik Seeley wrote:
> 
> On Mon, May 12, 2008 at 9:58 PM, oleg_gnatovskiy
> <ol...@citysearch.com> wrote:
>>  Hello. I was wondering if there is a way to get solr to return fields
>> with
>>  the same value for a particular field together. For example I might want
>> to
>>  have all the documents with exactly the same name field all returned
>> next to
>>  each other. Is this possible? Thanks!
> 
> Sort by that field.  Since you can only sort by fields with a single
> term at most (this rules out full-text fields), you might want to do a
> copyField of the "name" field to something like a "name_s" field which
> is of type string (which can be sorted on).
> 
> -Yonik
> 
> 

-- 
View this message in context: http://www.nabble.com/Field-Grouping-tp17199592p17201424.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Field Grouping

Posted by Yonik Seeley <yo...@apache.org>.
On Mon, May 12, 2008 at 9:58 PM, oleg_gnatovskiy
<ol...@citysearch.com> wrote:
>  Hello. I was wondering if there is a way to get solr to return fields with
>  the same value for a particular field together. For example I might want to
>  have all the documents with exactly the same name field all returned next to
>  each other. Is this possible? Thanks!

Sort by that field.  Since you can only sort by fields with a single
term at most (this rules out full-text fields), you might want to do a
copyField of the "name" field to something like a "name_s" field which
is of type string (which can be sorted on).

-Yonik