diff --git a/src/modules/universal-discovery/components/search/search.component.js b/src/modules/universal-discovery/components/search/search.component.js
index 20faba38..008a2abc 100644
--- a/src/modules/universal-discovery/components/search/search.component.js
+++ b/src/modules/universal-discovery/components/search/search.component.js
@@ -19,6 +19,7 @@ export default class SearchComponent extends Component {
this.onRequireItemsCount = this.onRequireItemsCount.bind(this);
this.toggleSubmitButtonState = this.toggleSubmitButtonState.bind(this);
this.setSearchInputRef = this.setSearchInputRef.bind(this);
+ this.setSearchLanguageRef = this.setSearchLanguageRef.bind(this);
}
/**
@@ -37,6 +38,7 @@ export default class SearchComponent extends Component {
}
const searchText = this._refSearchInput.value;
+ const languageCode = this._refSearchLanguage.value;
const query = {
FullTextCriterion: searchText,
};
@@ -49,7 +51,7 @@ export default class SearchComponent extends Component {
() => ({ isSearching: true, lastSearchText: searchText }),
() => {
const promise = new Promise((resolve) =>
- this.props.findContentBySearchQuery(this.props.restInfo, query, resolve, this.props.searchResultsLimit)
+ this.props.findContentBySearchQuery(this.props.restInfo, query, resolve, this.props.searchResultsLimit, languageCode)
);
promise
@@ -86,6 +88,32 @@ export default class SearchComponent extends Component {
}
}
+ /**
+ * Renders the language filter
+ *
+ * @method renderLanguageFilter
+ */
+ renderLanguageFilter() {
+ const { languages } = this.props;
+ const selectAttrs = {
+ className: 'form-control',
+ ref: this.setSearchLanguageRef
+ };
+ const options = languages.priority.map((value) => {
+ const language = languages.mappings[value];
+
+ return ;
+ });
+
+ return (
+
+
+
+ );
+ }
+
/**
* Renders the submit button
*
@@ -136,6 +164,16 @@ export default class SearchComponent extends Component {
this._refSearchInput = ref;
}
+ /**
+ * Set a reference to the language filter HTMLElement node
+ *
+ * @method setSearchLanguageRef
+ * @param {HTMLElement} ref
+ */
+ setSearchLanguageRef(ref) {
+ this._refSearchLanguage = ref;
+ }
+
renderSearchTips() {
const { items } = this.state;
@@ -200,7 +238,7 @@ export default class SearchComponent extends Component {
{ query: lastSearchText },
'search'
);
-
+
return (
+ {this.renderLanguageFilter()}
{this.renderSubmitBtn()}
{this.renderResultsTable()}
@@ -261,4 +300,5 @@ SearchComponent.propTypes = {
onItemRemove: PropTypes.func.isRequired,
multiple: PropTypes.bool.isRequired,
allowedContentTypes: PropTypes.array.isRequired,
+ languages: PropTypes.object.isRequired,
};
diff --git a/src/modules/universal-discovery/components/tab-content/search.panel.component.js b/src/modules/universal-discovery/components/tab-content/search.panel.component.js
index a56a3e6b..2e3ad4ee 100644
--- a/src/modules/universal-discovery/components/tab-content/search.panel.component.js
+++ b/src/modules/universal-discovery/components/tab-content/search.panel.component.js
@@ -20,6 +20,7 @@ const SearchPanelComponent = (props) => {
canSelectContent,
allowedContentTypes,
onItemRemove,
+ languages,
} = props;
const searchAttrs = Object.assign(
{},
@@ -37,6 +38,7 @@ const SearchPanelComponent = (props) => {
canSelectContent,
allowedContentTypes,
onItemRemove,
+ languages,
}
);
@@ -71,6 +73,7 @@ SearchPanelComponent.propTypes = {
canSelectContent: PropTypes.func.isRequired,
onItemRemove: PropTypes.func.isRequired,
allowedContentTypes: PropTypes.array.isRequired,
+ languages: PropTypes.object.isRequired,
};
export default SearchPanelComponent;
diff --git a/src/modules/universal-discovery/services/universal.discovery.service.js b/src/modules/universal-discovery/services/universal.discovery.service.js
index 292dfdb1..50e3c612 100644
--- a/src/modules/universal-discovery/services/universal.discovery.service.js
+++ b/src/modules/universal-discovery/services/universal.discovery.service.js
@@ -196,11 +196,15 @@ export const findLocationsByParentLocationId = (
* @param {Object} query Object containing query criterions
* @param {Function} callback
* @param {Number} limit
+ * @param {String} LanguageCode
*/
-export const findContentBySearchQuery = ({ token, siteaccess }, query, callback, limit = QUERY_LIMIT) => {
+export const findContentBySearchQuery = ({ token, siteaccess }, query, callback, limit = QUERY_LIMIT, languageCode = null) => {
+ const useAlwaysAvailable = true;
const body = JSON.stringify({
ViewInput: {
identifier: `udw-locations-by-search-query-${query.FullTextCriterion}`,
+ languageCode,
+ useAlwaysAvailable,
public: false,
LocationQuery: {
Criteria: {},
diff --git a/src/modules/universal-discovery/universal.discovery.module.js b/src/modules/universal-discovery/universal.discovery.module.js
index ec35a2a7..959e5196 100644
--- a/src/modules/universal-discovery/universal.discovery.module.js
+++ b/src/modules/universal-discovery/universal.discovery.module.js
@@ -813,7 +813,7 @@ export default class UniversalDiscoveryModule extends Component {
} = this.props;
const { userBookmarksItems, userBookmarksCount, contentTypesMap } = this.state;
const browsePanelConfig = { id: TAB_BROWSE, panel: FinderPanelComponent, attrs: { sortFieldMappings, sortOrderMappings } };
- const searchPanelConfig = { id: TAB_SEARCH, panel: SearchPanelComponent };
+ const searchPanelConfig = { id: TAB_SEARCH, panel: SearchPanelComponent, attrs: { languages } };
const bookmarksPanelConfig = {
id: TAB_BOOKMARKS,
panel: BookmarksPanelComponent,