Skip to content

Commit

Permalink
FEATURE NMH-168: Hide licensed models from spark-nlp search [skip-test]
Browse files Browse the repository at this point in the history
  • Loading branch information
KshitizGIT authored and pabla committed Apr 7, 2023
1 parent 0e60c0b commit 34afcc5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/create_search_index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
working-directory: docs/_frontend
env:
SEARCH_ORIGIN: ${{ secrets.SEARCH_ORIGIN }}
ORIGIN: ${{ secrets.ORIGIN }}
run: |
yarn
yarn run build
Expand Down
2 changes: 1 addition & 1 deletion docs/_frontend/src/models/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const useFilterQuery = () => {
window.history.pushState(
nextParams,
window.title,
'/models' + toSearchString(nextParams)
'/models' + toSearchString(nextParams, false)
);
setParams(nextParams);
};
Expand Down
6 changes: 5 additions & 1 deletion docs/_frontend/src/models/common.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const SEARCH_ORIGIN = process.env.SEARCH_ORIGIN;
export const ORIGIN = process.env.ORIGIN;

export const toSearchString = (params) => {
export const toSearchString = (params, includeOrigin = true) => {
const searchParams = Object.keys(params).reduce((acc, k) => {
if (params[k]) {
switch (k) {
Expand Down Expand Up @@ -34,6 +35,9 @@ export const toSearchString = (params) => {
return acc;
}, new URLSearchParams());

if (includeOrigin && ORIGIN) {
searchParams.append('origin', ORIGIN);
}
const search = searchParams.toString();
return search ? '?' + search : '';
};
1 change: 1 addition & 0 deletions docs/_frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ module.exports = (env, argv) => {
SEARCH_ORIGIN:
process.env.SEARCH_ORIGIN ||
'https://search.modelshub.johnsnowlabs.com',
ORIGIN: process.env.ORIGIN,
}),
isProduction &&
new MiniCssExtractPlugin({
Expand Down

0 comments on commit 34afcc5

Please sign in to comment.