-
-
Save xou/33fd7aab7afe3cebb28b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<enumsConfig> | |
<enum name="auState"> | |
<value>ACT</value> | |
<value>NSW</value> | |
<value>NT</value> | |
<value>QLD</value> | |
<value>SA</value> | |
<value>TAS</value> | |
<value>VIC</value> | |
<value>WA</value> | |
</enum> | |
</enumsConfig> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<schema name="facet-bug" version="0.1"> | |
<field name="id" type="long" indexed="true" required="true" stored="true" multiValued="false" /> | |
<field name="name" type="cistring" indexed="true" stored="true" multiValued="false" /> | |
<field name="state" type="auState" indexed="true" multiValued="false" docValues="true" /> | |
<field name="insertdate" type="date" indexed="true" multiValued="false" /> | |
<fieldType name="date" class="solr.TrieDateField" /> | |
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/> | |
<fieldType name="cistring" class="solr.TextField" sortMissingLast="true"> | |
<analyzer type="index"> | |
<tokenizer class="solr.StandardTokenizerFactory"/> | |
<filter class="solr.LowerCaseFilterFactory"/> | |
<filter class="solr.ReversedWildcardFilterFactory" /> | |
</analyzer> | |
<analyzer type="query"> | |
<tokenizer class="solr.StandardTokenizerFactory"/> | |
<filter class="solr.LowerCaseFilterFactory"/> | |
<filter class="solr.ReversedWildcardFilterFactory" /> | |
</analyzer> | |
</fieldType> | |
<fieldType name="auState" class="solr.EnumField" enumsConfig="enumConfig.xml" enumName="auState" /> | |
<uniqueKey>id</uniqueKey> | |
<defaultSearchField>name</defaultSearchField> | |
</schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<config> | |
<luceneMatchVersion>5.2.0</luceneMatchVersion> | |
<requestHandler name="standard" class="solr.SearchHandler" default="true"> | |
<lst name="defaults"> | |
<str name="echoParams">explicit</str> | |
<int name="rows">100</int> | |
<str name="fl">*</str> | |
<str name="version">2.1</str> | |
</lst> | |
</requestHandler> | |
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id":2, | |
"name":"asd", | |
"state":"QLD"}, | |
{ | |
"id":3, | |
"name":"asd", | |
"state":"WA"}, | |
{ | |
"id":1, | |
"state":"QLD", | |
"name":"HelloWorld", | |
"insertdate":"2016-01-06T23:37:36.655Z"}, | |
{ | |
"id":12, | |
"state":"QLD", | |
"name":"HelloWorld2", | |
"insertdate":"2016-01-06T23:37:48.023Z"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"First testrun (using facet.field) works, second one (using JSON api) does not" | |
curl http://localhost:8983/solr/core1/select -d 'q=*:*&wt=json&indent=true&facet=on&rows=0&facet.field=state&facet.field=insertdate' | |
{ | |
"responseHeader":{ | |
"status":0, | |
"QTime":20, | |
"params":{ | |
"q":"*:*", | |
"facet.field":["state", | |
"insertdate"], | |
"indent":"true", | |
"rows":"0", | |
"wt":"json", | |
"facet":"on"}}, | |
"response":{"numFound":4,"start":0,"docs":[] | |
}, | |
"facet_counts":{ | |
"facet_queries":{}, | |
"facet_fields":{ | |
"state":[ | |
"QLD",3, | |
"WA",1], | |
"insertdate":[ | |
"2016-01-06T23:37:36.655Z",1, | |
"2016-01-06T23:37:48.023Z",1]}, | |
"facet_dates":{}, | |
"facet_ranges":{}, | |
"facet_intervals":{}, | |
"facet_heatmaps":{}}} | |
curl http://localhost:8983/solr/core1/select -d 'q=*:*&wt=json&indent=true&rows=10& | |
json.facet={ | |
states: {field: state}, dates: {field: insertdate} | |
}' | |
{ | |
"responseHeader":{ | |
"status":400, | |
"QTime":12, | |
"params":{ | |
"q":"*:*", | |
"json.facet":"{\n states: {field: state}, dates: {field: insertdate}\n}", | |
"indent":"true", | |
"rows":"10", | |
"wt":"json"}}, | |
"response":{"numFound":4,"start":0,"docs":[ | |
{ | |
"id":2, | |
"name":"asd", | |
"state":"QLD"}, | |
{ | |
"id":3, | |
"name":"asd", | |
"state":"WA"}, | |
{ | |
"id":1, | |
"state":"QLD", | |
"name":"HelloWorld", | |
"insertdate":"2016-01-06T23:37:36.655Z"}, | |
{ | |
"id":12, | |
"state":"QLD", | |
"name":"HelloWorld2", | |
"insertdate":"2016-01-06T23:37:48.023Z"}] | |
}, | |
"error":{ | |
"msg":"Expected numeric field type :state{type=auState,properties=indexed,stored,docValues}", | |
"code":400}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It works when the enum field is dropped from the JSON query: