Forum Discussion

derhallim's avatar
Jan 09, 2024

Unable search and filter items based on Chinese & Japanese languages

I have a SharePoint list that contains fields as translations for the Title field in different languages. Some of them are Chinese Simplified, Chinese Traditional and Japanese.

When I try to query the list and filter based on a value in these fields, my query doesn't work and return 0 items.

I am using PnP JS for my query. My code looks similar (not exactly) to this:

const _searchOnTitleQry = `(${Constants.mainTitle}:"${_searchText}*") OR`+
` (${Constants.termTitleCH}:"${_searchText}*") OR`+
` (${Constants.termTitleCHTR}:"${_searchText}*") OR`+
` (${Constants.termTitleJP}:"${_searchText}*") OR`+
` (${Constants.termTitleML}:"${_searchText}*")`;


const _searchTextEx = (isExactMatch) ? _searchOnExactMatchTitleQry : _searchOnTitleQry;
const _searchQuerySettings: ISearchQuery = {
    TrimDuplicates: true,
    EnableInterleaving: false,
    StartRow: _pageIndex,
    RowLimit: _rowLimit,
    SelectProperties: _selectedProperties,
    EnableSorting:true,
    SortList: [{Property:_sortByColumn, Direction: _sortByDirection}], 
    Culture: 2052, //Setting this to troubleshoot the Chinese simplified language
    
    Refiners: `${Constants.termDisplayAuthor},${Constants.refCreatedByAuthor},${Constants.refModifiedByEditor}`,
    
    RefinementFilters: [_refinementFltrs],
    
    ClientType: "ContentSearchRegular",
    
    QueryTemplate: `{searchterms} (path:${_listPath}) (ListId:{${_listId}} OR ListId:${_listId}) (contentclass:STS_ListItem)`          
}

const qBuild = SearchQueryBuilder(_searchTextEx, _searchQuerySettings);

let _results = await this.sp.search(qBuild);

return _results;

 

 

No RepliesBe the first to reply

Resources