Skip to content

Commit

Permalink
Merge pull request #2680 from Hyperkid123/improved-suggester
Browse files Browse the repository at this point in the history
Use improved search suggester.
  • Loading branch information
Hyperkid123 authored Nov 6, 2023
2 parents 92e3d7c + 84c22e5 commit 69e0e3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Search/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const SUGGEST_SEARCH = new URLSearchParams();
SUGGEST_SEARCH.append('redhat_client', 'console'); // required client id
SUGGEST_SEARCH.append('q', REPLACE_TAG); // add query replacement tag and enable fuzzy search with ~ and wildcards
SUGGEST_SEARCH.append('suggest.count', '10'); // request 10 results
SUGGEST_SEARCH.append('suggest.dictionary', 'improvedInfixSuggester'); // console new suggest dictionary
SUGGEST_SEARCH.append('suggest.dictionary', 'default');

const SUGGEST_URL = new URL(`https://access.${IS_PROD ? '' : 'stage.'}redhat.com/hydra/proxy/gss-diag/rs/search/autosuggest`);
// search API stopped receiving encoded search string
Expand Down Expand Up @@ -195,9 +197,7 @@ const SearchInput = ({ onStateChange }: SearchInputListener) => {
});
const suggests = uniq(items.map(({ allTitle }) => allTitle.replace(/(<b>|<\/b>)/gm, '').trim()));
let searchItems = items.map(({ item }) => item);
console.log(suggests);
if (items.length < 10) {
console.log({ value });
const altTitleResults = (await fetch(
BASE_URL.toString()
.replaceAll(REPLACE_TAG, `(${suggests.join(' OR ')} OR ${value})`)
Expand Down

0 comments on commit 69e0e3c

Please sign in to comment.