lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arvydas Silanskas <>
Subject Re: Is it possible to force solr show all facet values for the field with an enum type?
Date Sat, 05 Jan 2019 20:01:31 GMT
Thanks for your reply.

No, not exactly what I want.

Consider I have enum defined as

<enum name="Enum">

and correspondingly I have defined a fieldtype "enumType" that uses this
enum, and a field "enumfield" that is of type "enumType". Consider my index
is like this:

        "name_s":"Doc 1",
        "name_s":"Doc 2",

notice how there are no documents that have "enumfield":"B".
Now, if I execute query
my facet response's fields look like this:


There is no "B" key -- and that's my problem. It tells me about other
facet values if they're filtered out by fq, but it tells me nothing
about facet values that aren't present in any doc.

My question is how to force the response to be
        "B", 0]}

2019-01-05, št, 19:42 Erick Erickson <> rašė:

> So really the results you want are q=*:*&facet.field=enumField right?
> You could fire that query in parallel and combine the two in your app,
> perhaps caching the result if the index isn't changing very rapidly.
> Facets were designed with the idea that they'd only count for docs
> that were hits, so there's no built-in way to do what you want. Which, BTW,
> could be _very_ expensive in the general case. The query would
> have to count up, say, the hits for 100M documents...
> Best,
> Erick
> On Sat, Jan 5, 2019 at 1:53 AM Arvydas Silanskas
> <> wrote:
> >
> > Hello,
> > I have an enum solr fieldtype. When I do a facet search, I want that all
> > the enum values appear in the facet -- and setting field.mincount = 0 is
> > not enough. It only works, if there exist a document with the matching
> > value for the field, but it was filtered out by current query (and then
> I'm
> > returned that facet value with the count 0). But can I make it to also
> > return the values that literally none of the documents in the index have?
> > The values, that only appear in the enum declaration xml.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message