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 tasmaniski <ta...@gmail.com> on 2013/12/25 16:18:42 UTC

Grouping results with group.limit return wrong numFound ?

Hi All, When I perform a search with grouping result in a groups and do limit
results in one group I got that *numFound* is the same as I didn't use
limit.looks like SOLR first perform search and calculate numFound and that
group and limit the results.I do not know if this is a bug or a feature
:)But I cannot use pagination and other stuff.Is there any workaround or I
missed something ?Example:I want to search book title and limit the search
to 3 results per one publisher.q=book_title: solr
php&group=true&group.field=publisher&group.limit=3&group.main=trueI have for
apress publisher 20 results but I show only 3 that works OKBut in numFound I
still have 20 for apress publisher...



--
View this message in context: http://lucene.472066.n3.nabble.com/Grouping-results-with-group-limit-return-wrong-numFound-tp4108174.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Grouping results with group.limit return wrong numFound ?

Posted by Chris Hostetter <ho...@fucit.org>.
I'm not sure if i'm completley following this thread, but i wanted to 
point out hte existence of this bug in case it's causing problems in 
your specific case...

https://issues.apache.org/jira/browse/SOLR-4310

...there is a patch on that issue, but some unresolved questions about 
wether it works correctly in distributed cases.  If youd like to try it 
out and post comments about ewther it works for you (or even better: help 
write some additional tests) that would be helpful towards getting it 
committed.


: Date: Tue, 31 Dec 2013 08:07:50 -0800 (PST)
: From: tasmaniski <ta...@gmail.com>
: Reply-To: solr-user@lucene.apache.org
: To: solr-user@lucene.apache.org
: Subject: Re: Grouping results with group.limit return wrong numFound ?
: 
: @kamaci
: Ofcourse. That is the problem. 
: 
: "group.limit is: the number of results (documents) to return for each
: group."
: NumFound is number of total found, but *not* sum number of *return for each
: group.*
: 
: @Liu Bo
: seems to be the is only workaround for problem but 
: it's to much expensive to go through all the groups and calculate total
: number of found/returned (I use PHP for client:) ).
: 
: @iorixxx 
: Yes, I consider that (group.ngroups=true) 
: but in some group I have number of found result  lesser than limit.
: 
: 
: 
: --
: View this message in context: http://lucene.472066.n3.nabble.com/Grouping-results-with-group-limit-return-wrong-numFound-tp4108174p4108906.html
: Sent from the Solr - User mailing list archive at Nabble.com.
: 

-Hoss
http://www.lucidworks.com/

Re: Grouping results with group.limit return wrong numFound ?

Posted by tasmaniski <ta...@gmail.com>.
Hi and thanks all, 

There is no easy solution implemented in Solr for my problem.
I will try "namedistinct" you said, might improve workaround solution.

Perhaps, the main problem are the names  :)  
because *group.limit*  do same as basic  rows
<http://wiki.apache.org/solr/CommonQueryParameters#rows>   and 
group.offset do same as basic  start
<http://wiki.apache.org/solr/CommonQueryParameters#start>  . 
Should be called group.rows and group.start.

So, group.limit isn't real limit, it's only NumRows to return. 


offtopics:
Maybe, we have a bug.
I noticed that *group.offset* doesn't work if we use *group.main=true*



--
View this message in context: http://lucene.472066.n3.nabble.com/Grouping-results-with-group-limit-return-wrong-numFound-tp4108174p4109316.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Grouping results with group.limit return wrong numFound ?

Posted by Ahmet Arslan <io...@yahoo.com>.

Hi Liu,

Aha now I see ... old format does not display that info.
For faceting solution https://issues.apache.org/jira/browse/SOLR-2242 could be relevant.

By the way how are these things in CollapsingQueryParser? 

https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-CollapsingQueryParser?



On Thursday, January 2, 2014 6:07 AM, Liu Bo <di...@gmail.com> wrote:

hi @Ahmet

I've thought about using group.ngroups=true , but when you use
group.main=true, there's no "ngroups" field in the response.

and according to http://wiki.apache.org/solr/FieldCollapsing, the result
might not be correct in solrcloud.

I don't like using facet for this but seems have to...


On 1 January 2014 00:35, Ahmet Arslan <io...@yahoo.com> wrote:

> Hi Tasmaniski,
>
> I don't follow. How come Liu's faceting workaround and n.groups=true
> produce different results?
>
>
>
>
>
>
> On Tuesday, December 31, 2013 6:08 PM, tasmaniski <ta...@gmail.com>
> wrote:
> @kamaci
> Ofcourse. That is the problem.
>
> "group.limit is: the number of results (documents) to return for each
> group."
> NumFound is number of total found, but *not* sum number of *return for each
> group.*
>
> @Liu Bo
> seems to be the is only workaround for problem but
> it's to much expensive to go through all the groups and calculate total
> number of found/returned (I use PHP for client:) ).
>
> @iorixxx
> Yes, I consider that (group.ngroups=true)
> but in some group I have number of found result  lesser than limit.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Grouping-results-with-group-limit-return-wrong-numFound-tp4108174p4108906.html
>
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>


-- 
All the best


Liu Bo

Re: Grouping results with group.limit return wrong numFound ?

Posted by Liu Bo <di...@gmail.com>.
hi @Ahmet

I've thought about using group.ngroups=true , but when you use
group.main=true, there's no "ngroups" field in the response.

and according to http://wiki.apache.org/solr/FieldCollapsing, the result
might not be correct in solrcloud.

I don't like using facet for this but seems have to...


On 1 January 2014 00:35, Ahmet Arslan <io...@yahoo.com> wrote:

> Hi Tasmaniski,
>
> I don't follow. How come Liu's faceting workaround and n.groups=true
> produce different results?
>
>
>
>
>
>
> On Tuesday, December 31, 2013 6:08 PM, tasmaniski <ta...@gmail.com>
> wrote:
> @kamaci
> Ofcourse. That is the problem.
>
> "group.limit is: the number of results (documents) to return for each
> group."
> NumFound is number of total found, but *not* sum number of *return for each
> group.*
>
> @Liu Bo
> seems to be the is only workaround for problem but
> it's to much expensive to go through all the groups and calculate total
> number of found/returned (I use PHP for client:) ).
>
> @iorixxx
> Yes, I consider that (group.ngroups=true)
> but in some group I have number of found result  lesser than limit.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Grouping-results-with-group-limit-return-wrong-numFound-tp4108174p4108906.html
>
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>


-- 
All the best

Liu Bo

Re: Grouping results with group.limit return wrong numFound ?

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi Tasmaniski,

I don't follow. How come Liu's faceting workaround and n.groups=true produce different results?






On Tuesday, December 31, 2013 6:08 PM, tasmaniski <ta...@gmail.com> wrote:
@kamaci
Ofcourse. That is the problem. 

"group.limit is: the number of results (documents) to return for each
group."
NumFound is number of total found, but *not* sum number of *return for each
group.*

@Liu Bo
seems to be the is only workaround for problem but 
it's to much expensive to go through all the groups and calculate total
number of found/returned (I use PHP for client:) ).

@iorixxx 
Yes, I consider that (group.ngroups=true) 
but in some group I have number of found result  lesser than limit.



--
View this message in context: http://lucene.472066.n3.nabble.com/Grouping-results-with-group-limit-return-wrong-numFound-tp4108174p4108906.html

Sent from the Solr - User mailing list archive at Nabble.com.


Re: Grouping results with group.limit return wrong numFound ?

Posted by tasmaniski <ta...@gmail.com>.
@kamaci
Ofcourse. That is the problem. 

"group.limit is: the number of results (documents) to return for each
group."
NumFound is number of total found, but *not* sum number of *return for each
group.*

@Liu Bo
seems to be the is only workaround for problem but 
it's to much expensive to go through all the groups and calculate total
number of found/returned (I use PHP for client:) ).

@iorixxx 
Yes, I consider that (group.ngroups=true) 
but in some group I have number of found result  lesser than limit.



--
View this message in context: http://lucene.472066.n3.nabble.com/Grouping-results-with-group-limit-return-wrong-numFound-tp4108174p4108906.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Grouping results with group.limit return wrong numFound ?

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi Liu,

Did you consider using group.ngroups=true ? It should give the same number as your faceting solution. 


Ahmet


On Tuesday, December 31, 2013 10:22 AM, Liu Bo <di...@gmail.com> wrote:
Hi

I've met the same problem, and I've googled it around but not found direct
solution.

But there's a work around, do a facet on your group field, with parameters
like

   <str name="facet">true</str>
   <str name="facet.field">your_field</str>
   <str name="facet.limit">-1</str>
   <str name="facet.mincount">1</str>

and then count how many facted pairs in the response. This should be the
same with the number of documents after grouping.

Cheers

Bold





On 31 December 2013 06:40, Furkan KAMACI <fu...@gmail.com> wrote:

> Hi;
>
> group.limit is: the number of results (documents) to return for each group.
> Defaults to 1. Did you check the page here:
> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=32604232
>
> Thanks;
> Furkan KAMACI
>
>
> 25 Aralık 2013 Çarşamba tarihinde tasmaniski <ta...@gmail.com> adlı
> kullanıcı şöyle yazdı:
> > Hi All, When I perform a search with grouping result in a groups and do
> limit
> > results in one group I got that *numFound* is the same as I didn't use
> > limit.looks like SOLR first perform search and calculate numFound and
> that
> > group and limit the results.I do not know if this is a bug or a feature
> > :)But I cannot use pagination and other stuff.Is there any workaround or
> I
> > missed something ?Example:I want to search book title and limit the
> search
> > to 3 results per one publisher.q=book_title: solr
> > php&group=true&group.field=publisher&group.limit=3&group.main=trueI have
> for
> > apress publisher 20 results but I show only 3 that works OKBut in
> numFound I
> > still have 20 for apress publisher...
> >
> >
> >
> > --
> > View this message in context:
>
> http://lucene.472066.n3.nabble.com/Grouping-results-with-group-limit-return-wrong-numFound-tp4108174.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
All the best

Liu Bo 

Re: Grouping results with group.limit return wrong numFound ?

Posted by Liu Bo <di...@gmail.com>.
Hi

I've met the same problem, and I've googled it around but not found direct
solution.

But there's a work around, do a facet on your group field, with parameters
like

   <str name="facet">true</str>
   <str name="facet.field">your_field</str>
   <str name="facet.limit">-1</str>
   <str name="facet.mincount">1</str>

and then count how many facted pairs in the response. This should be the
same with the number of documents after grouping.

Cheers

Bold




On 31 December 2013 06:40, Furkan KAMACI <fu...@gmail.com> wrote:

> Hi;
>
> group.limit is: the number of results (documents) to return for each group.
> Defaults to 1. Did you check the page here:
> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=32604232
>
> Thanks;
> Furkan KAMACI
>
>
> 25 Aralık 2013 Çarşamba tarihinde tasmaniski <ta...@gmail.com> adlı
> kullanıcı şöyle yazdı:
> > Hi All, When I perform a search with grouping result in a groups and do
> limit
> > results in one group I got that *numFound* is the same as I didn't use
> > limit.looks like SOLR first perform search and calculate numFound and
> that
> > group and limit the results.I do not know if this is a bug or a feature
> > :)But I cannot use pagination and other stuff.Is there any workaround or
> I
> > missed something ?Example:I want to search book title and limit the
> search
> > to 3 results per one publisher.q=book_title: solr
> > php&group=true&group.field=publisher&group.limit=3&group.main=trueI have
> for
> > apress publisher 20 results but I show only 3 that works OKBut in
> numFound I
> > still have 20 for apress publisher...
> >
> >
> >
> > --
> > View this message in context:
>
> http://lucene.472066.n3.nabble.com/Grouping-results-with-group-limit-return-wrong-numFound-tp4108174.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
All the best

Liu Bo

Re: Grouping results with group.limit return wrong numFound ?

Posted by Furkan KAMACI <fu...@gmail.com>.
Hi;

group.limit is: the number of results (documents) to return for each group.
Defaults to 1. Did you check the page here:
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=32604232

Thanks;
Furkan KAMACI


25 Aralık 2013 Çarşamba tarihinde tasmaniski <ta...@gmail.com> adlı
kullanıcı şöyle yazdı:
> Hi All, When I perform a search with grouping result in a groups and do
limit
> results in one group I got that *numFound* is the same as I didn't use
> limit.looks like SOLR first perform search and calculate numFound and that
> group and limit the results.I do not know if this is a bug or a feature
> :)But I cannot use pagination and other stuff.Is there any workaround or I
> missed something ?Example:I want to search book title and limit the search
> to 3 results per one publisher.q=book_title: solr
> php&group=true&group.field=publisher&group.limit=3&group.main=trueI have
for
> apress publisher 20 results but I show only 3 that works OKBut in
numFound I
> still have 20 for apress publisher...
>
>
>
> --
> View this message in context:
http://lucene.472066.n3.nabble.com/Grouping-results-with-group-limit-return-wrong-numFound-tp4108174.html
> Sent from the Solr - User mailing list archive at Nabble.com.