You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by gnandre <ar...@gmail.com> on 2021/03/11 01:05:58 UTC

Solr custom query component does not return correct facet counts

I have a simple Solr query component that does some exact match processing
by replacing qf and pf params in incoming search requests with new values
that point to the fields that do not do stemming, synonymization etc.

This works as expected. However in a distributed context (not using
SolrCloud, just using shards param), although it works as expected, the
facets counts are off.

Facet counts are double of what they should be. Also, I noticed that I get
two "response" objects in JSON response in a distributed context. Please
note that I have already added following so that I do not get two responses
back:

  @Override
  public void process(ResponseBuilder rb) throws IOException
  {
    // do nothing - needed so we don't execute the query here.
  }

This is what my prepare function looks like:
  @Override
  public void prepare( ResponseBuilder rb ) throws IOException
  {
    if (exactMatchQueryProcessor != null) {
      exactMatchQueryProcessor.modifyForExactMatch(rb);
    }
  }

Re: Solr custom query component does not return correct facet counts

Posted by gnandre <ar...@gmail.com>.
I resolved this issue by extending the class to SearchComponent instead of
QueryComponent. It seems that SearchComponent sits at a higher level of
abstraction than QueryComponent and is useful when you want to work on a
layer above shards.

On Wed, Mar 10, 2021 at 8:05 PM gnandre <ar...@gmail.com> wrote:

> I have a simple Solr query component that does some exact match processing
> by replacing qf and pf params in incoming search requests with new values
> that point to the fields that do not do stemming, synonymization etc.
>
> This works as expected. However in a distributed context (not using
> SolrCloud, just using shards param), although it works as expected, the
> facets counts are off.
>
> Facet counts are double of what they should be. Also, I noticed that I get
> two "response" objects in JSON response in a distributed context. Please
> note that I have already added following so that I do not get two responses
> back:
>
>   @Override
>   public void process(ResponseBuilder rb) throws IOException
>   {
>     // do nothing - needed so we don't execute the query here.
>   }
>
> This is what my prepare function looks like:
>   @Override
>   public void prepare( ResponseBuilder rb ) throws IOException
>   {
>     if (exactMatchQueryProcessor != null) {
>       exactMatchQueryProcessor.modifyForExactMatch(rb);
>     }
>   }
>