Hi Shalin,

Thank you for your answer.

I'm already using custom hashing to make sure all the docs that are going
to be grouped together are on the same shard. During index I make sure the
uniqueKey is something like:

    productId!skuId

so all the skus belonging to the same product will end up on the same
shard. At query time I will then group on the product id (I want all the
skus grouped by their owning product).

While working correctly the above did not fix the problem :/

What I have found by selectively switching off my grouping instructions to
SOLR is that the problem is in the

  group.limit=-1

that I append to each query.

This query (with all the skus sharing the same product sharded correctly on
the same shard) does not work:

 http://localhost:9766/skus/product_looks_for_sale?

 q=newsale&distrib=true&fl=doc_id,%20id&group=true&*group.limit=-1*

while this works fine:

  http://localhost:9766/skus/product_looks_for_sale?
  q=new-sale&start=0&distrib=true&fl=doc_id,%20id&group=true&
*group.limit=100*

AFAIK the -1 is only yo tell SOLR to give back all the matching docs in a
group so given that I do not think I will have more than 100s skus in a
single product I'm going to fix this issue setting the limit to 100.

Would be nice to know why the -1 makes the query fail anyway :)

Any thought ?

Thank you,
Ugo



On Mon, Mar 24, 2014 at 6:30 AM, Shalin Shekhar Mangar <
shalinman...@gmail.com> wrote:

> The Grouping feature only works if groups are in the same shard.
> Perhaps that is the problem here?
>
> I could find https://issues.apache.org/jira/browse/SOLR-4164 which
> says that once the sharding was fixed, the problem went away. We
> should come up with a better exception message though.
>
> On Fri, Mar 21, 2014 at 10:49 PM, Ugo Matrangolo
> <ugo.matrang...@gmail.com> wrote:
> > Hi,
> >
> > I have a two shard collection running and I'm getting this error on each
> > query:
> >
> > 2014-03-21 17:08:42,018 [qtp-75] ERROR
> > org.apache.solr.servlet.SolrDispatchFilter  -
> > *null:java.lang.IllegalArgumentException:
> > numHits must be > 0; please use TotalHitCountCollector if you just need
> the
> > total hit count*
> >         at
> >
> org.apache.lucene.search.TopFieldCollector.create(TopFieldCollector.java:1130)
> >         at
> >
> org.apache.lucene.search.TopFieldCollector.create(TopFieldCollector.java:1079)
> >         at
> >
> org.apache.lucene.search.grouping.AbstractSecondPassGroupingCollector.<init>(AbstractSecondPassGroupingCollector.java:75)
> >         at
> >
> org.apache.lucene.search.grouping.term.TermSecondPassGroupingCollector.<init>(TermSecondPassGroupingCollector.java:49)
> >         at
> >
> org.apache.solr.search.grouping.distributed.command.TopGroupsFieldCommand.create(TopGroupsFieldCommand.java:129)
> >         at
> >
> org.apache.solr.search.grouping.CommandHandler.execute(CommandHandler.java:142)
> >         at
> >
> org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:387)
> >         at
> >
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:214)
> >         at
> >
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
> >         at org.apache.solr.core.SolrCore.execute(SolrCore.java:1916)
> >         at
> >
> org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:780)
> >
> > Note that I'm using grouping and disabling it fixed the problem.
> >
> > I was aware that SolrCloud does not fully supports grouping in a
> > distributed setup but I was expecting incorrect results (that have to
> > addressed with custom hashing afaik) and not an error.
> >
> > Does anyone see this error before?
> >
> > Ugo
>
>
>
> --
> Regards,
> Shalin Shekhar Mangar.
>

Reply via email to