Hi Mikhail, Thanks for your explanation! I fully understand now.
Best regards, Mingchun 2025年2月6日(木) 15:55 Mikhail Khludnev <m...@apache.org>: > Hello Mingchun. > Perhaps it can not "uninvert" (obtain docValues/fieldcache -like > representation) for a text field. > facet=enum uses inverted index to deal with text fields: it just loops term > dictionary and check an intersection count between result docset and term's > docset. > From the other side: analysis is not applied for string fields that does > not allow to apply a tokenizer. > However if an application code create pathes /a /a/b /a/b/c itself, > faceting over doc values will work. > > On Thu, Feb 6, 2025 at 2:56 AM Mingchun Zhao <mingchun.zha...@gmail.com> > wrote: > > > 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 > > > > > -- > Sincerely yours > Mikhail Khludnev >