RE: Facet searcher is returning Chinese characters array for localised field

thumbnail
Jamie Sammons, modified 3 Years ago. New Member Posts: 9 Join Date: 1/19/22 Recent Posts

I am using 7.4 u 31 with MySQL. I am adding a field as a keyword in the indexer document. As shown below:

document.addLocalizedKeyword(FIELD_NAME, FIELD_VALUE, false, true);

as I debugged a code I can see the field is stored in the document as null. But when I was debugging the Liferay source in populate method in class DefaultSearchResponseTranslator I can see below field name as below:

"FIELD_NAME_en_GB_sortable": [
      "KkhITEZUMjABDAHcCwA="
    ],

when I remove _sortable from the field name I am getting the below error even if I am using the keyword field already:

Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead

I am using below code to get the search filter facets:

FacetedSearcher createFacetedSearcher = facetedSearcherManager.createFacetedSearcher();
		searchContext.setFacets(facets);
		createFacetedSearcher.search(searchContext);

Can anyone please sugesst what could be the issue.

In postman, I am getting below response on _search URL:

"aggregations": {
        "FIELD_NAME_en_GB_sortable": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
                {
                    "key":"ᜠᆓ䙆倎瀤��",
                    "doc_count": 3
                },
                {
                    "key":"⌤಑!怸��",
                    "doc_count": 3
                },
                {
                    "key":"ᔤሓ࣊䌣\b〇㠖��",
                    "doc_count": 2
                },
                {
                    "key":"∣ᐁو䑥ᆱ怐璈㑆☡ઔ݈摀࣐ݳ޹䃜܀��",
                    "doc_count": 2
                },
                {
                    "key":"᠙ஐ݈䌣\b〇㠖��",
                    "doc_count": 1
                }
            ]
        }
    }

 

thumbnail
Jamie Sammons, modified 3 Years ago. Expert Posts: 308 Join Date: 2/13/13 Recent Posts

Hi Prashant, can you try to clarify your question better? In your post title you're talking about Chinese characters being returned, while your post doesn't seem to mention anything related. I probably won't be the expert to help you here but you may get a better answer if you clean up the question and make it clear what you are trying to do and what's not working.