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 Claudio R <us...@yahoo.com.br.INVALID> on 2019/06/14 13:54:18 UTC
Facet on multicore search when one field exists only in one of
cores
Hi,
I am using Solr 6.6.0 in mode standalone with 2 cores.
The first core has the schema:
id
fieldA
fieldB
The second core has the schema:
id
fieldA
fieldC
When I try this request to get facet of fields: fieldA, fieldB and fieldC on multicore search, I get error:
http://localhost:8983/solr/core1/select?q=*:*&shards=localhost:8983/solr/core1,localhost:8983/solr/core2&fl=*,[shard]&facet=true&facet.field=fieldA&facet.field=fieldB&facet.field=fieldC
<str name="msg">Error from server at http://localhost:8983/solr/core2: undefined field: "fieldB"</str>
<int name="code">400</int>
Is there any config / parameter in Solr to avoid this throw exception on facet of multicore when one field not exists in a core?
If I have this documents on cores:
core1:
id: "10"
fieldA: "productA"
fieldB: "value1"
core2:
id: "23"
fieldA: "productA"
fieldC: "value2"
I wish get a response like this:
Facet
fieldA
productA (2)
fieldB
value1 (1)
fieldC
value2 (1)
Re: Facet on multicore search when one field exists only in one of
cores
Posted by Claudio R <us...@yahoo.com.br.INVALID>.
Hi Shawn,Thank you very much for your quick answer.The use of dynamic field "ignored" works, but it does not seem to be the correct way to solve the problem.We will try to equalize the cores.
Em sexta-feira, 14 de junho de 2019 11:18:40 BRT, Shawn Heisey <ap...@elyograg.org> escreveu:
On 6/14/2019 7:54 AM, Claudio R wrote:
> When I try this request to get facet of fields: fieldA, fieldB and fieldC on multicore search, I get error:
>
> http://localhost:8983/solr/core1/select?q=*:*&shards=localhost:8983/solr/core1,localhost:8983/solr/core2&fl=*,[shard]&facet=true&facet.field=fieldA&facet.field=fieldB&facet.field=fieldC
>
> <str name="msg">Error from server at http://localhost:8983/solr/core2: undefined field: "fieldB"</str>
> <int name="code">400</int>
>
> Is there any config / parameter in Solr to avoid this throw exception on facet of multicore when one field not exists in a core?
Distributed queries must have compatible schemas in all the shards
referenced. If all fields referenced in the query are not covered by
every one of those schemas, you're going to get an error. This is just
basic error-checking.
The only fix would be to correct the schemas. You could add the missing
field, or if you want all invalid fields ignored, simply set up a
dynamicField named "*" that connects to a type that's ignored. This
should work:
<dynamicField name="*" type="ignored"/>
<fieldType name="ignored" stored="false" indexed="false"
docValues="false" multiValued="true" class="solr.StrField" />
I haven't actually tried this so I can't be SURE it will work, but I
think it would.
A note for devs: In the 8.1.0 _default configset, the "ignored" type
does not have docValues="false" ... and I think docValues defaults to
true on the StrField class. I think that MIGHT be a problem. Worth an
issue?
Thanks,
Shawn
Re: Facet on multicore search when one field exists only in one of
cores
Posted by Shawn Heisey <ap...@elyograg.org>.
On 6/14/2019 7:54 AM, Claudio R wrote:
> When I try this request to get facet of fields: fieldA, fieldB and fieldC on multicore search, I get error:
>
> http://localhost:8983/solr/core1/select?q=*:*&shards=localhost:8983/solr/core1,localhost:8983/solr/core2&fl=*,[shard]&facet=true&facet.field=fieldA&facet.field=fieldB&facet.field=fieldC
>
> <str name="msg">Error from server at http://localhost:8983/solr/core2: undefined field: "fieldB"</str>
> <int name="code">400</int>
>
> Is there any config / parameter in Solr to avoid this throw exception on facet of multicore when one field not exists in a core?
Distributed queries must have compatible schemas in all the shards
referenced. If all fields referenced in the query are not covered by
every one of those schemas, you're going to get an error. This is just
basic error-checking.
The only fix would be to correct the schemas. You could add the missing
field, or if you want all invalid fields ignored, simply set up a
dynamicField named "*" that connects to a type that's ignored. This
should work:
<dynamicField name="*" type="ignored"/>
<fieldType name="ignored" stored="false" indexed="false"
docValues="false" multiValued="true" class="solr.StrField" />
I haven't actually tried this so I can't be SURE it will work, but I
think it would.
A note for devs: In the 8.1.0 _default configset, the "ignored" type
does not have docValues="false" ... and I think docValues defaults to
true on the StrField class. I think that MIGHT be a problem. Worth an
issue?
Thanks,
Shawn