Skip to content

Commit

Permalink
Edit Synonyms is broken #681
Browse files Browse the repository at this point in the history
  • Loading branch information
ComLock committed Dec 22, 2022
1 parent 475fd67 commit ad6c115
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export function useEditSynonymsState({
servicesBaseUrl,
thesaurusName
} :{
servicesBaseUrl :string
thesaurusName ?:string
servicesBaseUrl: string
thesaurusName?: string
}) {
//──────────────────────────────────────────────────────────────────────────
// State
Expand Down Expand Up @@ -151,28 +151,20 @@ export function useEditSynonymsState({
//console.debug('EditSynonyms result', result);
return {
aggregations,
column,
direction,
column, setColumn,
direction, setDirection,
end,
from,
from, setFrom,
isLoading,
languages,
languages, setLanguages,
memoizedQuerySynonyms,
page,
perPage,
page, setPage,
perPage, setPerPage,
result: state,
setColumn,
setDirection,
setFrom,
setLanguages,
setPage,
setPerPage,
setThesauri,
setTo,
sortAfterColumnClick,
start,
thesauri,
to,
thesauri, setThesauri,
to, setTo,
total,
totalPages
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import type {Glue} from '../Glue';

import {
addQueryFilter,
storage//,
//toStr
arrayIncludes,
storage,
// toStr,
} from '@enonic/js-utils';
import {PRINCIPAL_EXPLORER_READ} from '/lib/explorer/constants';
import {hasValue} from '/lib/explorer/query/hasValue';
Expand Down Expand Up @@ -109,8 +110,8 @@ export function addQuerySynonymsField({
_name: thesaurusName
});
for (let i = 0; i < allowedLanguages.length; i++) {
const locale = allowedLanguages[i];
if (!highlightLocales.includes(locale)) {
const locale = allowedLanguages[i];
if (!arrayIncludes(highlightLocales, locale)) {
highlightLocales.push(locale);
}
if (locale !== 'zxx' && !localeToStemmingLanguage[locale]) {
Expand All @@ -125,12 +126,12 @@ export function addQuerySynonymsField({
getSynonymsCount: false
});
for (let i = 0; i < hits.length; i++) { // TODO Refactor
const {
const {
allowedLanguages
} = hits[i];
for (let j = 0; j < allowedLanguages.length; j++) {
const locale = allowedLanguages[j];
if (!highlightLocales.includes(locale)) {
const locale = allowedLanguages[j];
if (!arrayIncludes(highlightLocales, locale)) {
highlightLocales.push(locale);
}
if (locale !== 'zxx' && !localeToStemmingLanguage[locale]) {
Expand All @@ -139,12 +140,12 @@ export function addQuerySynonymsField({
}
}
}
//log.debug('highlightLocales:%s', toStr(highlightLocales));
// log.debug('highlightLocales:%s', toStr(highlightLocales));
//log.debug('localeToStemmingLanguage:%s', toStr(localeToStemmingLanguage));

if (languages && languages.length) {
for (let i = 0; i < languages.length; i++) {
const locale = languages[i];
const locale = languages[i];
filters = addQueryFilter({
clause: 'must',
filters,
Expand Down

0 comments on commit ad6c115

Please sign in to comment.