SOLR - PathHierarchyTokenizerFactory Facet Query
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_pat开发者_StackOverflow社区h" 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"
What happens if you remove the faceting parameters? Does it return all documents also?
From my opinion faceting should not have an effect on the search results. It seems to me that the filter query you passed in the fq parameter is not working for some reason.
精彩评论