Slackbot
07/12/2023, 6:18 AMKishore Nallan
07/12/2023, 6:19 AMJameshwart Lopez
07/12/2023, 6:21 AMJameshwart Lopez
07/12/2023, 6:23 AMKishore Nallan
07/12/2023, 6:24 AMKishore Nallan
07/12/2023, 6:24 AMJameshwart Lopez
07/12/2023, 6:24 AMJameshwart Lopez
07/12/2023, 6:25 AMKishore Nallan
07/12/2023, 6:26 AMJameshwart Lopez
07/12/2023, 6:26 AMJameshwart Lopez
07/12/2023, 6:32 AMKishore Nallan
07/12/2023, 6:32 AMJameshwart Lopez
07/12/2023, 6:33 AMJameshwart Lopez
07/12/2023, 6:36 AMKishore Nallan
07/12/2023, 6:36 AMJameshwart Lopez
07/12/2023, 6:36 AMJameshwart Lopez
07/12/2023, 6:36 AMKishore Nallan
07/12/2023, 6:36 AMJameshwart Lopez
07/12/2023, 6:38 AMJameshwart Lopez
07/12/2023, 6:40 AMKishore Nallan
07/12/2023, 6:40 AMJameshwart Lopez
07/12/2023, 6:42 AMKishore Nallan
07/12/2023, 6:42 AMJameshwart Lopez
07/12/2023, 6:43 AMKishore Nallan
07/12/2023, 6:45 AMJameshwart Lopez
07/12/2023, 6:47 AMKishore Nallan
07/12/2023, 6:48 AMJameshwart Lopez
07/12/2023, 6:48 AMKishore Nallan
07/12/2023, 6:48 AMJameshwart Lopez
07/12/2023, 6:51 AMKishore Nallan
07/12/2023, 6:51 AMJameshwart Lopez
07/12/2023, 6:51 AMKishore Nallan
07/12/2023, 6:52 AMJameshwart Lopez
07/12/2023, 6:52 AMKishore Nallan
07/12/2023, 6:52 AMJameshwart Lopez
07/12/2023, 6:53 AMKishore Nallan
07/12/2023, 6:55 AMJameshwart Lopez
07/12/2023, 6:56 AMKishore Nallan
07/12/2023, 6:56 AMKishore Nallan
07/12/2023, 6:57 AMJameshwart Lopez
07/12/2023, 6:57 AMKishore Nallan
07/12/2023, 6:57 AMJameshwart Lopez
07/12/2023, 6:58 AMconst getProductBySlug = async (sku: string): Promise<ITSProduct | null> => {
let searchParameters = {
q: '*',
query_by: 'slug',
filter_by: `slug:=[${sku}]`,
sort_by: '_text_match:desc',
facet_by: 'slug',
};
const results = await client
.collections(TS_CONFIG.collectionNames.product)
.documents()
.search(searchParameters);
let found = null;
if (typeof results.hits !== 'undefined' && results.hits[0]) {
const tsProductData: ITSProduct = JSON.parse(
JSON.stringify(results.hits[0].document)
);
return tsProductData;
}
return found;
};Jameshwart Lopez
07/12/2023, 6:59 AMJameshwart Lopez
07/12/2023, 6:59 AMKishore Nallan
07/12/2023, 7:00 AMclient is initialized?Jameshwart Lopez
07/12/2023, 7:01 AMimport { Client } from 'typesense';
import TS_CONFIG from './config';
const c = new Client(TS_CONFIG.server);
export default c;
give me a sec i'll get you the ts_configJameshwart Lopez
07/12/2023, 7:01 AMconst TS_CONFIG = {
server: {
apiKey: process.env.NEXT_PUBLIC_TS_APIKEY as string, // Be sure to use an API key that only allows search operations
nodes: [
{
host: process.env.NEXT_PUBLIC_TS_HOST as string,
path: '', // Optional. Example: If you have your typesense mounted in localhost:8108/typesense, path should be equal to '/typesense'
port: 443,
protocol: 'https',
},
],
},
collectionNames: {
product: `product-${process.env.NEXT_PUBLIC_TS_STORE_ID}`,
taxonomy: `taxonomy-${process.env.NEXT_PUBLIC_TS_STORE_ID}`,
page: `page-${process.env.NEXT_PUBLIC_TS_STORE_ID}`,
},
};
export default TS_CONFIG;
this is the TS_CONFIGKishore Nallan
07/12/2023, 7:02 AMcacheSearchResultsForSeconds: 0 after apiKeyJameshwart Lopez
07/12/2023, 7:03 AMJameshwart Lopez
07/12/2023, 7:04 AMKishore Nallan
07/12/2023, 7:05 AMKishore Nallan
07/12/2023, 7:05 AMJameshwart Lopez
07/12/2023, 7:06 AMKishore Nallan
07/12/2023, 7:06 AMJameshwart Lopez
07/12/2023, 7:09 AMLaura Gocase
07/13/2023, 12:20 PMLaura Gocase
07/13/2023, 12:21 PMJameshwart Lopez
07/13/2023, 12:22 PMKishore Nallan
07/13/2023, 12:23 PMKishore Nallan
07/13/2023, 12:24 PMLaura Gocase
07/13/2023, 12:30 PMKishore Nallan
07/13/2023, 12:32 PMLaura Gocase
07/13/2023, 12:33 PM