I haven't checked if it works, but even if it did, that would kinda defeat
the purpose -- namely not repeating enum values
in multiple places, and have them all contained in the single spot
(enumConfig.xml)

2019-01-06, sk, 11:43 David Santamauro <david.santama...@gmail.com> rašė:

> Seeing that the field is an enumeration, couldn't you just use a set of
> facet.query(s)?
>
>   ?q=*:*
>   &fq=user_s:Bar
>   &facet=true
>   &facet.query=enumfield:A
>   &facet.query=enumfield:B
>   &facet.mincount=0
>
> //
>
> On 1/5/19, 3:01 PM, "Arvydas Silanskas" <nma.arvydas.silans...@gmail.com>
> wrote:
>
>     Thanks for your reply.
>
>     No, not exactly what I want.
>
>     Consider I have enum defined as
>
>     <enum name="Enum">
>         <value>A</value>
>         <value>B</value>
>     </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",
>             "enumfield":"A",
>             "user_s":"Foo",
>             "id":"2ebc0754-e7d8-405e-9962-99c6cd1d9275",
>             "_version_":1621850725207244800},
>           {
>             "name_s":"Doc 2",
>             "user_s":"Bar",
>             "id":"0536827a-703a-456e-9087-71b85b63c58b",
>             "_version_":1621850725397037056}]
>
>     notice how there are no documents that have "enumfield":"B".
>     Now, if I execute query
>     "facet.field=enumfield&facet=on&fq=user_s:Bar&indent=on&q=*:*&wt=json",
>     my facet response's fields look like this:
>
>     "facet_fields":{
>           "enumfield":[
>             "A",0]}
>
>     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
>     "facet_fields":{
>           "enumfield":[
>             "A",0,
>             "B", 0]}
>
>
>     2019-01-05, št, 19:42 Erick Erickson <erickerick...@gmail.com> 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
>     > <nma.arvydas.silans...@gmail.com> 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.
>     >
>
>

Reply via email to