Hi Michael,
Thanks for your responsible recommendation.
Yes, we could use TextField in our application but still hope to use
SortableTextField due to its Sorting functions
I have read your previous comments (Mar, 2019) in
https://issues.apache.org/jira/browse/SOLR-13056
Could your previous patch solve or partially solve the problem?
Kind regards,
Zhiqing

On Tue, 26 Apr 2022 at 01:03, Michael Gibney <[email protected]>
wrote:

> I was hoping that would "just work"; since it didn't, I dug a little more
> and I'm afraid that explicitly setting`method:uif` has no effect -- if
> docValues are there, they will be used:
>
>
> https://github.com/apache/solr/blob/c99af207c761ec34812ef1cc3054eb2804b7448b/solr/core/src/java/org/apache/solr/search/facet/FacetField.java#L161-L167
>
> Pending SOLR-8362 (or some other more narrow solution?), I think the only
> responsible recommendation is: don't use SortableTextField for faceting.
> Would it work to use TextField instead? TextField has to be uninverted, but
> at least it meets the requirement of indexed values being compatible with
> values over which bulk facet collection takes place.
>
> On Mon, Apr 25, 2022 at 3:52 PM WU, Zhiqing <[email protected]> wrote:
>
> > Hi Michael,
> > Thanks for your quick reply and related information.
> > I added "method":"uif" at 3 different places but it does not address my
> > problem -
> > 1.
> > {
> >   "query": "*:*",
> >   "method":"uif",
> >   "facet": {
> >     "categories": {
> >       "type": "terms",
> >       "field": "name_txt_sort",
> >       "limit": -1,
> >       "facet": {
> >         "sex_s": {
> >           "type": "terms",
> >           "field": "sex_s",
> >           "limit": -1
> >         }
> >       }
> >     }
> >   }
> > }
> >
> > Response:
> > "error":{
> >     "metadata":[
> >       "error-class"...]}
> >
> > 2.
> > {
> >   "query": "*:*",
> >   "facet": {
> >     "method":"uif",
> >     "categories": {
> >       "type": "terms",
> >       "field": "name_txt_sort",
> >       "limit": -1,
> >       "facet": {
> >         "sex_s": {
> >           "type": "terms",
> >           "field": "sex_s",
> >           "limit": -1
> >         }
> >       }
> >     }
> >   }
> > }
> >
> > Response:
> > "error":{
> >     "metadata":[
> >       "error-class", ...
> >
> > 3.
> > {
> >   "query": "*:*",
> >   "facet": {
> >     "categories": {
> >       "method":"uif",
> >       "type": "terms",
> >       "field": "name_txt_sort",
> >       "limit": -1,
> >       "facet": {
> >         "sex_s": {
> >           "type": "terms",
> >           "field": "sex_s",
> >           "limit": -1
> >         }
> >       }
> >     }
> >   }
> > }
> >
> > Response:
> > "facets":{
> >     "count":3,
> >     "categories":{
> >       "buckets":[{
> >           "val":"Amelia Harris",
> >           "count":1},
> >         {
> >           "val":"George Smith",
> >           "count":1},
> >         {
> >           "val":"Olivia Wilson",
> >           "count":1}]}}}
> >
> > Should I try "method":"uif" at another place?
> > Kind regards,
> > Zhiqing
> >
> > On Mon, 25 Apr 2022 at 17:47, Michael Gibney <[email protected]>
> > wrote:
> >
> > > 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