Skip to content

Commit

Permalink
fix to autocomplete path and meta tags
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinvanschoren committed Oct 24, 2023
1 parent 0f105e8 commit 08899eb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/src/components/search/CoreFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { withSearch } from "@elastic/react-search-ui";
const CoreFilter = ({ addFilter, setFilter, removeFilter, setSearchTerm }) => {
useEffect(() => {
// An example list of user IDs
const userIds = ["1", "2"];
const userIds = [1, 2];
// Clear previous filters for user_id field
removeFilter("id");
removeFilter("ids");
Expand All @@ -13,7 +13,7 @@ const CoreFilter = ({ addFilter, setFilter, removeFilter, setSearchTerm }) => {
removeFilter("user_id.keyword");
// Apply the filter using the `terms` filter type
//addFilter("user_id", userIds, "any");
setFilter("user_id", userIds, "any");
addFilter("user_id", userIds, "any");
}, [addFilter, setFilter, removeFilter, setSearchTerm]);

return <div></div>;
Expand Down
6 changes: 3 additions & 3 deletions app/src/pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export default class MyDocument extends Document {
<meta charSet="utf-8" />
<meta
name="description"
content="A professional package that comes with plenty of UI components, forms, tables, charts, dashboards, pages and svg icons. Each one is fully customizable, responsive and easy to use."
content="Website of OpenML, an open science plaform for machine learning supporting machine readable datasets, automated experimentation, clean and open APIs, and a treasure trove of experimental results."
/>
<meta
name="keywords"
content="mira,mui,material app,react,material,kit,dashboard,application,admin,template"
content="OpenML, machine learning, open science, datasets, experiments, results, open source, open data"
/>
<meta name="author" content="Bootlab" />
<meta name="author" content="Joaquin Vanschoren" />

<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap"
Expand Down
17 changes: 14 additions & 3 deletions app/src/pages/d/searchConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ const searchConfig = {
alwaysSearchOnInitialLoad: true,
searchQuery: {
search_fields: {
name: {
weight: 3,
},
description: {},
},
result_fields: {
Expand Down Expand Up @@ -73,6 +70,20 @@ const searchConfig = {
field: { name: { raw: {} } },
},
},
autocompleteQuery: {
results: {
resultsPerPage: 5,
result_fields: {
// specify the fields you want from the index to display the results
name: { snippet: { size: 100, fallback: true } },
url: { raw: {} },
},
search_fields: {
// specify the fields you want to search on
name: {},
},
},
},
//This doesn't work yet.
//initialState: { searchTerm: "", sort: { field: "date" } },
};
Expand Down
4 changes: 2 additions & 2 deletions app/src/services/SearchAPIConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SearchAPIConnector {
queryConfig,
}),
};
console.log("onSearch", this.indexName, request);
console.log(request.body);
const response = await fetch("/api/search", request);
return response.json();
}
Expand All @@ -42,7 +42,7 @@ class SearchAPIConnector {
}),
};
console.log(request.body);
const response = await fetch("api/autocomplete", request);
const response = await fetch("/api/autocomplete", request);
return response.json();
}
}
Expand Down

0 comments on commit 08899eb

Please sign in to comment.