I have been trying to perform a query on a field that is configured to be solr.PathHierarchyTokenizerFactory, but the query just returns all records. It seems that doing a facet query is just not working. Does anyone have a way of accomplishing this? I'm using the PathHierarchy to implement category/subcategory facets.
<fieldType name="text_path" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
</analyzer>
</fieldType>
<field name="libraries" type="text_path" indexed="true" stored="true" multiValued="true" />
And
http://linux2:8984/solr/select?q=*:*&rows=0&fq=libraries:"/test/subtest"&facet=true&facet.field=libraries&f.libraries.facet.sort=true&f.libraries.facet.limit=-1&f.libraries.facet.mincount=-1
Thanks
Change your text_path field definition to apply the PathHierarchyTokenizerFactory at index time only (example below). Your issue is that your queries are being processed by the tokenizer so that fq=libraries:"/test/subtest" actually queries against fq=libraries:(/test/subtest OR /test).
<fieldType name="text_path" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
</analyzer>
</fieldType>
Note the analyzer type="Index"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With