TLDR Shabber wanted to hide default results in typesenseInstantsearchAdapter. Jason provided a solution, and after a brief misunderstanding, Shabber found it helpful.
Here’s how to do this:
this dint work const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({ server: { apiKey: 'api key ', nodes: [ { host: '203.129.219.14', port: '8108', protocol: 'http', }, ], }, additionalSearchParameters: { queryBy: 'full_name,city_name', }, }); const searchClient = typesenseInstantsearchAdapter.searchClient; const search = instantsearch({ searchClient, indexName: 'AdditionalContacts', }); search.addWidgets([ instantsearch.widgets.searchBox({ container: '#searchbox38', placeholder: 'Search', }), instantsearch.widgets.configure({ hitsPerPage: 10, }), instantsearch.widgets.hits({ container: '#hits38', templates: { item(item) { hcoIconAppend = ''; if(item['customer_type']){ hcoIconAppend = '<span class="orgIcon ui-corner-all ui-nodisc-icon ui-alt-icon ui-btn-icon-left ui-btn-inline ui-icon-organization" style="background-color: #F6F6F6 !important;"></span>'; } return ` <li style="font-size:small" onclick="suggestionSelected(this,true);" id="${item._highlightResult.id.value}" kol="${item._highlightResult.kol_id.value}"> <p style="display: contents;"><span class="profileName">${item._highlightResult.full_name.value}</span> (MDM ID: ${item._highlightResult.master_customer_id.value})</p>`+hcoIconAppend+` <p class="detailedInfo" style="display: table-cell;">${item.city_name}, ${item.state_name}, ${item.postal_code}, ${item.country_name}</p> <span class="state hideContent">${item.state_name}</span> <span class="city hideContent">${item.city_name}</span> <p class="doNotCallInfo hideContent"></p> <p class="customerType hideContent">${item.customer_type}</p> </li> `; }, }, }), ]); search.start();
this is my code ,
where am i going wrong to hide results by default ?
I don’t see the snippet mentioned in this comment in your code:
Got It Thank You
Shabber
Mon, 17 Apr 2023 09:32:13 UTCi am using typesenseInstantsearchAdapter, by default on page load , it shows results how to hide on load results and show only when something is searched in textbox