This is related to https://issues.apache.org/jira/browse/SOLR-13056

I'm curious: if you set `method:uif` on the top-level facet, are you able
to achieve the desired results? (Note that `method:uif` incurs the same
heap memory overhead -- uninverting the indexed values -- as faceting over
a regular TextField). Doing this (if it works as I think it might) could
address the core problem with faceting on SortableTextField: that DocValues
for SortableTextField are appropriate for _sorting_, but are different from
the _indexed_ values that would be used for refinement and nested domain
filtering.

See also https://issues.apache.org/jira/browse/SOLR-8362

On Mon, Apr 25, 2022 at 11:59 AM WU, Zhiqing <[email protected]> wrote:

> Hello,
> I do not know why Nested Facets (
> https://solr.apache.org/guide/8_11/json-facet-api.html#nested-facets) does
> not work for _txt_sort field (SortableTextField).
>
> To reproduce the problem,
> I created a new collection (Config set: _default) and add the following to
> the collection
> {
>     "name_txt_sort": ["Amelia Harris"],
>     "name_txt": ["Amelia Harris"],
>     "sex_s": "female"
> },
> {
>     "name_txt_sort": ["Olivia Wilson"],
>     "name_txt": ["Olivia Wilson"],
>     "sex_s": "female"
> },
> {
>     "name_txt_sort": ["George Smith"],
>     "name_txt": ["George Smith"],
>     "sex_s": "male"
> }
>
> If my query is:
> {
>   "query": "*:*",
>   "facet": {
>     "categories": {
>       "type": "terms",
>       "field": "name_txt",
>       "limit": -1,
>       "facet": {
>         "sex_s": {
>           "type": "terms",
>           "field": "sex_s",
>           "limit": -1
>         }
>       }
>     }
>   }
> }
>
> The output is correct:
> ============================
> "facets":{
>     "count":3,
>     "categories":{
>       "buckets":[{
>           "val":"amelia",
>           "count":1,
>           "sex_s":{
>             "buckets":[{
>                 "val":"female",
>                 "count":1}]}},
>         {
>           "val":"george",
>           "count":1,
>            ...
> ============================
>
> However, if I change
> "field": "name_txt"
> to
> "field": "name_txt_sort"
> in my query, only one level group result is shown:
> ================================
>   "facets":{
>     "count":3,
>     "categories":{
>       "buckets":[{
>           "val":"Amelia Harris",
>           "count":1},
>         {
>           "val":"George Smith",
>           "count":1},
>         {
>           "val":"Olivia Wilson",
>           "count":1}]}}}
> ====================================
>
> I know for _txt field, its fieldType is "text_general" and class is
> "solr.TextField"
>   for _txt_sort field, its fieldType is "text_gen_sort" and class is
> "solr.SortableTextField"
>
> It seems SortableTextField will influence Nested Facets but I could not
> find any related document.
> Is it a bug or SortableTextField is not acceptable in Nested Facets?
> Many thanks in advance.
> Kind regards,
> Zhiqing
>

Reply via email to