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 go2jun <go...@gmail.com> on 2013/09/23 19:49:54 UTC

How to sort over all documents by score after Result Grouping / Field Collapsing

Hi, I have solr documents like this:

 <field name="id" type="string" stored="true" multiValued="false"
indexed="true"/>
 <field name="name" type="text" stored="true" multiValued="false"
indexed="true"/>
 <field name="source_id" type="int" stored="true" multiValued="false"
indexed="true"/>

I know I can use solr Result Grouping / Field Collapsing to get the top 2
result by grouping by source_id. Within each groups, documents sorted by
scroe by query like this:
http://localhost:8983/solr/select?q=bank&group.field=source_id&group=true&group.limit=2&group.main=true&sort=score

My question is:

1. Is it possible to sort overall documents after I do above grouping?
2. Is there any other ways to implement above functions(by using solr
functions directly)?
3. Is it possible to implement this by writing java code something like
customized request handler to do this?

Thanks in advance,

Jun 





--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-sort-over-all-documents-by-score-after-Result-Grouping-Field-Collapsing-tp4091593.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to sort over all documents by score after Result Grouping / Field Collapsing

Posted by Erick Erickson <er...@gmail.com>.
Nope, there's nothing in Solr that does this for you already,
you need to do something custom. You could write a component
that did this as the last step of writing the data to the client,
but that just moves the action from your front-end to custom
code in Solr that you have to maintain too, so I don't see the
benefit.

Best,
Erick

On Tue, Sep 24, 2013 at 11:46 AM, go2jun <go...@gmail.com> wrote:
> Thanks Erick for your response.
>
> My goal is
> 1. try to search from solr. In the search result, we would like show no more
> than two results from the same source id.
> 2. For the search results, we would like all these results sorted by their
> score.
>
> So If I use solr result grouping to get the top two result from each group,
> then I need to un-group them.
>
> So my question is there any pure solr solution to handle this? I prefer it
> handle by solr other than my application, because the search result are very
> large.
>
> Thanks!
> Jun
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/How-to-sort-over-all-documents-by-score-after-Result-Grouping-Field-Collapsing-tp4091593p4091784.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to sort over all documents by score after Result Grouping / Field Collapsing

Posted by go2jun <go...@gmail.com>.
Thanks Erick for your response.

My goal is
1. try to search from solr. In the search result, we would like show no more
than two results from the same source id.
2. For the search results, we would like all these results sorted by their
score.

So If I use solr result grouping to get the top two result from each group,
then I need to un-group them.

So my question is there any pure solr solution to handle this? I prefer it
handle by solr other than my application, because the search result are very
large.

Thanks!
Jun




--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-sort-over-all-documents-by-score-after-Result-Grouping-Field-Collapsing-tp4091593p4091784.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to sort over all documents by score after Result Grouping / Field Collapsing

Posted by Erick Erickson <er...@gmail.com>.
It's not clear what you're trying to do. Do you want to un-group the results?
By that I mean are you trying to take the grouped results you get back and
display them in one flat list ordered by score?

If that's the case, the simplest thing to do would be to do this on
the application
side with the results, it should be quite straight-forward.

And you have not stated the user-level problem you're trying to solve, this
may be an XY problem.

Best,
Erick

On Mon, Sep 23, 2013 at 1:49 PM, go2jun <go...@gmail.com> wrote:
> Hi, I have solr documents like this:
>
>  <field name="id" type="string" stored="true" multiValued="false"
> indexed="true"/>
>  <field name="name" type="text" stored="true" multiValued="false"
> indexed="true"/>
>  <field name="source_id" type="int" stored="true" multiValued="false"
> indexed="true"/>
>
> I know I can use solr Result Grouping / Field Collapsing to get the top 2
> result by grouping by source_id. Within each groups, documents sorted by
> scroe by query like this:
> http://localhost:8983/solr/select?q=bank&group.field=source_id&group=true&group.limit=2&group.main=true&sort=score
>
> My question is:
>
> 1. Is it possible to sort overall documents after I do above grouping?
> 2. Is there any other ways to implement above functions(by using solr
> functions directly)?
> 3. Is it possible to implement this by writing java code something like
> customized request handler to do this?
>
> Thanks in advance,
>
> Jun
>
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/How-to-sort-over-all-documents-by-score-after-Result-Grouping-Field-Collapsing-tp4091593.html
> Sent from the Solr - User mailing list archive at Nabble.com.