[bugfix] combine all search terms to a single indexed field
This commit is contained in:
@@ -4,6 +4,9 @@ import RarityIcon from '../../components/RarityIcon.astro';
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import * as util from 'util';
|
||||
|
||||
|
||||
// all the facet fields we want to use for filtering
|
||||
const facetFields:any = {
|
||||
"productLineName": "Product Line",
|
||||
@@ -77,13 +80,18 @@ if (start === 0) {
|
||||
const searchRequests = { searches: searchArray };
|
||||
const commonSearchParams = {
|
||||
q: query,
|
||||
query_by: 'productLineName,productName,setName,number,rarityName,Artist',
|
||||
// query_by: 'productLineName,productName,setName,number,rarityName,Artist',
|
||||
query_by: 'content'
|
||||
};
|
||||
|
||||
// use typesense to search for cards matching the query and return the productIds of the results
|
||||
const searchResults = await client.multiSearch.perform(searchRequests, commonSearchParams);
|
||||
const cardResults = searchResults.results[0] as any;
|
||||
|
||||
//console.log(util.inspect(cardResults.hits.map((c:any) => { return { productLineName:c.document.productLineName, productName:c.document.productName, setName:c.document.setName, number:c.document.number, rarityName:c.document.rarityName, Artist:c.document.Artist, text_match:c.text_match, text_match_info:c.text_match_info }; }), { showHidden: true, depth: null }));
|
||||
//console.log(cardResults);
|
||||
|
||||
|
||||
const pokemon = cardResults.hits?.map((hit: any) => hit.document) ?? [];
|
||||
const totalHits = cardResults?.found;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user