Hiding Default Results in TypesenseInstantsearchAdapter

TLDR Shabber wanted to hide default results in typesenseInstantsearchAdapter. Jason provided a solution, and after a brief misunderstanding, Shabber found it helpful.

Photo of Shabber
Shabber
Mon, 17 Apr 2023 09:32:13 UTC

i 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

Photo of Jason
Jason
Mon, 17 Apr 2023 12:44:14 UTC

Here’s how to do this:

Photo of Shabber
Shabber
Wed, 19 Apr 2023 06:35:10 UTC

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();

Photo of Shabber
Shabber
Wed, 19 Apr 2023 06:35:23 UTC

this is my code ,

Photo of Shabber
Shabber
Wed, 19 Apr 2023 06:35:37 UTC

where am i going wrong to hide results by default ?

Photo of Jason
Jason
Wed, 19 Apr 2023 10:50:46 UTC

I don’t see the snippet mentioned in this comment in your code:

Photo of Shabber
Shabber
Thu, 20 Apr 2023 04:52:45 UTC

Got It Thank You