Skip to content

Commit

Permalink
Integrate datahub
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Mar 30, 2022
1 parent 437e813 commit 8e36413
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/SearchBlock/SearchBlockView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ export default function SearchBlockView(props) {
},
};

console.log('config', registry);

// console.log('registry', registry);
return (
<BodyClass className="searchlib-page">
<div className="searchlib-block">
Expand Down
19 changes: 17 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'regenerator-runtime/runtime'; // compatibility with react-speech-recognition

import installConfig from '@eeacms/globalsearch';
import installGlobalsearch from '@eeacms/globalsearch';
import installDatahub from '@eeacms/datahub';
import { registry } from '@eeacms/search';
import codeSVG from '@plone/volto/icons/code.svg';
import SearchBlockView from './SearchBlock/SearchBlockView';
Expand Down Expand Up @@ -53,14 +54,28 @@ const applyConfig = (config) => {
return config;
};

// TODO: this should be moved into its own volto addon
export const installGlobalSearch = (config) => {
config.settings.searchlib = installConfig(config.settings.searchlib);
config.settings.searchlib = installGlobalsearch(config.settings.searchlib);

const { globalsearch } = config.settings.searchlib.searchui;

// Tweak the searchlib config to use the middleware instead of the index
globalsearch.elastic_index = '_es/globalsearch';

return config;
};

// TODO: this should be moved into its own volto addon
export const installDataHub = (config) => {
config.settings.searchlib = installDatahub(config.settings.searchlib);

const { datahub } = config.settings.searchlib.searchui;

// Tweak the searchlib config to use the middleware instead of the index
datahub.elastic_index = '_es/globalsearch';

return config;
};

export default applyConfig;

0 comments on commit 8e36413

Please sign in to comment.