4

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

javanna
  • 59,145
  • 14
  • 144
  • 125
Vince
  • 165
  • 1
  • 14

2 Answers2

10

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"

John Douthat
  • 40,711
  • 10
  • 69
  • 66
Kenneth Ito
  • 5,201
  • 2
  • 25
  • 44
0

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.

Jan Rasehorn
  • 311
  • 2
  • 6