Hi,

Why does faceting not work in Solr 9.8 when using PathHierarchyTokenizer
for facet.field without specifying the facet.method=enum parameter?

Here are the details:

- fieldType

```xml
<fieldType name="path_hierarchy" class="solr.TextField">
<analyzer type="index">
<tokenizer name="pathHierarchy" delimiter="/"/>
</analyzer>
<analyzer type="query">
<tokenizer name="keyword"/>
</analyzer>
</fieldType>
```

- field

```xml
<field name="category_path" type="path_hierarchy" indexed="true" stored=
"false" required="false" multiValued="false"/>
```

- index data

```json
[
{
"id": "1",
"category_path": "foo/bar/baz"
}
]
```

- query without facet.method=enum

```bash
curl "
http://localhost:8983/solr/core/select?q=*:*&facet=true&facet.field=category_path
"
```

```json
"facet_counts":{
"facet_queries":{ },
"facet_fields":{
"category_path":[ ]
},
"facet_ranges":{ },
"facet_intervals":{ },
"facet_heatmaps":{ }
}
```

- query with facet.method=enum

```bash
curl "
http://localhost:8983/solr/core/select?q=*:*&facet=true&facet.field=category_path&facet.method=enum
"
```

```json
"facet_counts":{
"facet_queries":{ },
"facet_fields":{
"category_path":["foo",1,"foo/bar",1,"foo/bar/baz",1]
},
"facet_ranges":{ },
"facet_intervals":{ },
"facet_heatmaps":{ }
}
```

Regards,
Mingchun

Reply via email to