Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions app/components/Search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,12 @@ const Search = (props) => {

const handleAutocompleteChange = (event, newValue) => {
setSearchTerm(newValue || '');
};

if (newValue && newValue.trim() && suggestions.includes(newValue)) {
performSearch(newValue);
const handleOptionSelect = (event, selectedValue) => {
if (selectedValue && selectedValue.trim()) {
setSearchTerm(selectedValue);
performSearch(selectedValue);
setShowSuggestions(false);
}
};
Expand Down Expand Up @@ -559,12 +562,10 @@ const Search = (props) => {
<Autocomplete
freeSolo
disabled={isInitializing}
// TODO - search history is disabled (along with suggestions) because it isn't working properly.
// if you select something from the search history, it shows 0 results even if the search actually
// did have results. Need to investigate this.
options={showSuggestions ? suggestions : []} //searchHistory}
options={[...new Set([...searchHistory, ...(showSuggestions ? suggestions : [])])]}
value={searchTerm}
onInputChange={handleAutocompleteChange}
onChange={handleOptionSelect}
onClose={() => setShowSuggestions(false)}
renderInput={(params) => (
<TextField
Expand Down
2 changes: 1 addition & 1 deletion app/constants/search-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ module.exports = {
// UI and display settings
ui: {
searchHistorySize: 15,
enableSuggestions: false, // TODO - DISABLED FOR NOW. Need to correct and then re-enable.
enableSuggestions: true,
maxSuggestions: 8,
showRelevanceScores: process.env.NODE_ENV === 'development',
enableKeyboardShortcuts: true,
Expand Down