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 Chris Ulicny <cu...@iq.media> on 2017/02/08 13:27:17 UTC

Facets and docValues

I've been trying to figure out how exactly docValues help with facet
queries, and I only seem to find mention that they are beneficial to facet
performance without many specifics. What I'd like to know is whether it
applies to all fields used in the facet or just fields that are faceted on.

For example, consider if we have the following facet

catfacet:{
    type: terms,
    field: category,
    facet: {
        x_sum:"sum(x)",
        y_sum:"sum(y)"
    }
}

Is it beneficial to have docValues enabled for all three fields used or
some specific subset of them?

Thanks.

Re: Facets and docValues

Posted by Erick Erickson <er...@gmail.com>.
Yes, all three fields should be docValues. The point of docValues is
to keep from "uninverting" the docValues structure in Java's heap. Any
time you have to answer the question "What is the value in
docX.fieldY" it should be a docValues field. The way facets (and
funciton queries for tha t matter work) is that the doc is scored. If
the doc has a non-zero score, the values in fields need to be
evaluated. So picture:
1> score doc X
2> if score is non-zero then for docx, field category, add one to the
facet bucket for that value. For x and y add them to the facet stat.

Best,
Erick

On Wed, Feb 8, 2017 at 5:27 AM, Chris Ulicny <cu...@iq.media> wrote:
> I've been trying to figure out how exactly docValues help with facet
> queries, and I only seem to find mention that they are beneficial to facet
> performance without many specifics. What I'd like to know is whether it
> applies to all fields used in the facet or just fields that are faceted on.
>
> For example, consider if we have the following facet
>
> catfacet:{
>     type: terms,
>     field: category,
>     facet: {
>         x_sum:"sum(x)",
>         y_sum:"sum(y)"
>     }
> }
>
> Is it beneficial to have docValues enabled for all three fields used or
> some specific subset of them?
>
> Thanks.