Terms faceting and EnumField

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Terms faceting and EnumField

Poornima Ponnuswamy
Hello,

We have solr 6.6 version.
Below is the field and field type that is defined in solr schema.
    <field name="ServiceRequestTypeCode" type="ServiceRequestTypeCode" indexed="true" stored="true" multiValued="false"/>
    <fieldType name="ServiceRequestTypeCode" class="solr.EnumField" enumsConfig="enumsConfig.xml" enumName="ServiceRequestTypeCode"/>

Below is the configuration for the enum
           <enum name="ServiceRequestTypeCode">
                  <value>  </value>
                  <value>servicerequestcorrective</value>
                  <value>servicerequestplanned</value>
                  <value>servicerequestinstallationandupgrade</value>
                  <value>servicerequestrecall</value>
                  <value>servicerequestother</value>
                  <value>servicerequestinquiry</value>
                  <value>servicerequestproactive</value>
                  <value>servicerequestsystemupdate</value>
                  <value>servicerequesticenteradmin</value>
                  <value>servicerequestonwatch</value>
                  <value>servicerequestfmi</value>
                  <value>servicerequestapplication</value>
           </enum>

When I try to invoke using the below request,
    http://localhost:8983/solr/activity01us/select?&json.facet={ServiceRequestTypeCode:{type:terms<http://localhost:8983/solr/activity01us/select?&json.facet=%7bServiceRequestTypeCode:%7btype:terms><http://localhost:8983/solr/activity01us/select?&json.facet={ServiceRequestTypeCode:{type:terms%3Chttp://localhost:8983/solr/activity01us/select?&json.facet=%7bServiceRequestTypeCode:%7btype:terms%3E>, field:ServiceRequestTypeCode, limit:100000}}&facet=on&indent=on&wt=json&q=*

 I am getting error
    "Expected numeric field type :ServiceRequestTypeCode{type=ServiceRequestTypeCode,properties=indexed,stored,omitNorms,omitTermFreqAndPositions}"

But when I try to do as below it works fine.

    http://localhost:8983/solr/activity01us/select?facet.field=ServiceRequestTypeCode&facet=on&indent=on&q=*:*&wt=json

    I would like to use json facet as it would help me in subfaceting.

    Any help would be appreciated


Reply | Threaded
Open this post in threaded view
|

Re: Terms faceting and EnumField

Poornima Ponnuswamy
I see a defect created for that. But I see its resolved. Am I doing anything wrong?

https://issues.apache.org/jira/browse/SOLR-7496


QUERY
http://localhost:8983/solr/activity01us/select?
&json.facet={ServiceRequestTypeCode:{type:terms, field:ServiceRequestTypeCode, limit:100000}}
&facet=on&indent=on&wt=json&q=*&rows=0

Below is the field and field type that is defined in solr schema.
    <field name="ServiceRequestTypeCode" type="ServiceRequestTypeCode" indexed="true" stored="true" multiValued="false"/>
    <fieldType name="ServiceRequestTypeCode" class="solr.EnumField" enumsConfig="enumsConfig.xml" enumName="ServiceRequestTypeCode"/>

Below is the configuration for the enum
           <enum name="ServiceRequestTypeCode">
                  <value>  </value>
                  <value>servicerequestcorrective</value>
                  <value>servicerequestplanned</value>
                  <value>servicerequestinstallationandupgrade</value>
                  <value>servicerequestrecall</value>
                  <value>servicerequestother</value>
                  <value>servicerequestinquiry</value>
                  <value>servicerequestproactive</value>
                  <value>servicerequestsystemupdate</value>
                  <value>servicerequesticenteradmin</value>
                  <value>servicerequestonwatch</value>
                  <value>servicerequestfmi</value>
                  <value>servicerequestapplication</value>
           </enum>

 I am getting error
    "Expected numeric field type :ServiceRequestTypeCode{type=ServiceRequestTypeCode,properties=indexed,stored,omitNorms,omitTermFreqAndPositions}"



________________________________
From: Poornima Ponnuswamy <[hidden email]>
Sent: Friday, May 22, 2020 7:01 AM
To: [hidden email] <[hidden email]>
Subject: Terms faceting and EnumField

Hello,

We have solr 6.6 version.
Below is the field and field type that is defined in solr schema.
    <field name="ServiceRequestTypeCode" type="ServiceRequestTypeCode" indexed="true" stored="true" multiValued="false"/>
    <fieldType name="ServiceRequestTypeCode" class="solr.EnumField" enumsConfig="enumsConfig.xml" enumName="ServiceRequestTypeCode"/>

Below is the configuration for the enum
           <enum name="ServiceRequestTypeCode">
                  <value>  </value>
                  <value>servicerequestcorrective</value>
                  <value>servicerequestplanned</value>
                  <value>servicerequestinstallationandupgrade</value>
                  <value>servicerequestrecall</value>
                  <value>servicerequestother</value>
                  <value>servicerequestinquiry</value>
                  <value>servicerequestproactive</value>
                  <value>servicerequestsystemupdate</value>
                  <value>servicerequesticenteradmin</value>
                  <value>servicerequestonwatch</value>
                  <value>servicerequestfmi</value>
                  <value>servicerequestapplication</value>
           </enum>

When I try to invoke using the below request,
    http://localhost:8983/solr/activity01us/select?&json.facet={ServiceRequestTypeCode:{type:terms<http://localhost:8983/solr/activity01us/select?&json.facet=%7bServiceRequestTypeCode:%7btype:terms><http://localhost:8983/solr/activity01us/select?&json.facet={ServiceRequestTypeCode:{type:terms%3Chttp://localhost:8983/solr/activity01us/select?&json.facet=%7bServiceRequestTypeCode:%7btype:terms%3E>, field:ServiceRequestTypeCode, limit:100000}}&facet=on&indent=on&wt=json&q=*

 I am getting error
    "Expected numeric field type :ServiceRequestTypeCode{type=ServiceRequestTypeCode,properties=indexed,stored,omitNorms,omitTermFreqAndPositions}"

But when I try to do as below it works fine.

    http://localhost:8983/solr/activity01us/select?facet.field=ServiceRequestTypeCode&facet=on&indent=on&q=*:*&wt=json

    I would like to use json facet as it would help me in subfaceting.

    Any help would be appreciated