You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Sergio García Maroto <ma...@gmail.com> on 2021/09/22 14:14:52 UTC

Use case counting items in a field

Hi,

I am wondering if the following use case can be solve with Solr.  I have
been researching and couldn´t find anyhting.

Let´s say I have a Person Collection with different fields and one of them
is a list of paper IDS, which are ids for papers this person wrote .
Each Person document contains
Name,
Surname,
PaperIDS

If i have a list of papers IDS and I do a query like below. I will get all
people who wrote any of those papers.

PaperIDS:2001001121
OR  PaperIDS  :2001001169 OR
PaperIDS  :2001015385

Would it be possible sort these results by people who was involved in the
most number of papers?


Regards,
Sergio Maroto

Re: Use case counting items in a field

Posted by Joel Bernstein <jo...@gmail.com>.
If you're looking for something closer to Jaccard similarity you could use
https://nightlies.apache.org/solr/draft-guides/solr-reference-guide-main/other-parsers.html#minhash-query-parser


Joel Bernstein
http://joelsolr.blogspot.com/


On Fri, Sep 24, 2021 at 4:20 PM Joel Bernstein <jo...@gmail.com> wrote:

> I think what you're looking for is a constant score query. Something like
> this:
>
> (PaperIDS:2001001121)^=1
> OR  (PaperIDS :2001001169)^=1 OR
> (PaperIDS :2001015385)^=1
>
> This will add 1 to the score each time a paper matches. This is basically
> an overlap score.
>
> Or did you mean rank by the person that had the most papers in the field,
> instead of matching the query?
>
>
>
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
>
> On Wed, Sep 22, 2021 at 10:16 AM Sergio García Maroto <ma...@gmail.com>
> wrote:
>
>> Hi,
>>
>> I am wondering if the following use case can be solve with Solr.  I have
>> been researching and couldn´t find anyhting.
>>
>> Let´s say I have a Person Collection with different fields and one of them
>> is a list of paper IDS, which are ids for papers this person wrote .
>> Each Person document contains
>> Name,
>> Surname,
>> PaperIDS
>>
>> If i have a list of papers IDS and I do a query like below. I will get all
>> people who wrote any of those papers.
>>
>> PaperIDS:2001001121
>> OR  PaperIDS  :2001001169 OR
>> PaperIDS  :2001015385
>>
>> Would it be possible sort these results by people who was involved in the
>> most number of papers?
>>
>>
>> Regards,
>> Sergio Maroto
>>
>

Re: Use case counting items in a field

Posted by Joel Bernstein <jo...@gmail.com>.
I think what you're looking for is a constant score query. Something like
this:

(PaperIDS:2001001121)^=1
OR  (PaperIDS :2001001169)^=1 OR
(PaperIDS :2001015385)^=1

This will add 1 to the score each time a paper matches. This is basically
an overlap score.

Or did you mean rank by the person that had the most papers in the field,
instead of matching the query?




Joel Bernstein
http://joelsolr.blogspot.com/


On Wed, Sep 22, 2021 at 10:16 AM Sergio García Maroto <ma...@gmail.com>
wrote:

> Hi,
>
> I am wondering if the following use case can be solve with Solr.  I have
> been researching and couldn´t find anyhting.
>
> Let´s say I have a Person Collection with different fields and one of them
> is a list of paper IDS, which are ids for papers this person wrote .
> Each Person document contains
> Name,
> Surname,
> PaperIDS
>
> If i have a list of papers IDS and I do a query like below. I will get all
> people who wrote any of those papers.
>
> PaperIDS:2001001121
> OR  PaperIDS  :2001001169 OR
> PaperIDS  :2001015385
>
> Would it be possible sort these results by people who was involved in the
> most number of papers?
>
>
> Regards,
> Sergio Maroto
>