Skip to content

Commit

Permalink
Search in language fields, but do filter on language only if isMultil…
Browse files Browse the repository at this point in the history
…ingual
  • Loading branch information
ksuess committed Apr 12, 2024
1 parent 7f118d4 commit 186d1af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/components/Searchkit/CustomESRequestSerializer.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { extend, isEmpty, keyBy, trim } from 'lodash';
import { getObjectFromObjectList } from '../helpers.jsx';

import config from '@plone/volto/registry';

const volto_config = config;

export class CustomESRequestSerializer {
constructor(config) {
this.reviewstatemapping = config.reviewstatemapping;
Expand Down Expand Up @@ -254,7 +258,8 @@ export class CustomESRequestSerializer {
// Generate terms of global filters
let terms = [];
// If isMultilingual, search only in language
this.language && terms.push({

this.language && volto_config.settings.isMultilingual && terms.push({
terms: {
language: [this.language],
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Views/FacetedSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ const FacetedSearch = ({ data, overriddenComponents }) => {
};

// TODO Check if check on client could be made simpler
const language = useSelector((state) => config.settings.isMultilingual ? state.intl.locale : null);
const language = useSelector((state) => state.intl.locale);
const [isClient, setIsClient] = React.useState(null);
React.useEffect(() => setIsClient(true), []);

Expand Down

0 comments on commit 186d1af

Please sign in to comment.