How to change preloaded results?

How can I change preloaded results - those who show up without me even typing in a search query?

Hi there,

Seems you are using a specific integration. Which one are you using?

Best,

As I mentioned in the tags: Instantsearch (1.2 I think), writing the code in JavaScript, frontend only.

You can change the default query by changing the searchFunction, you can find an exemple here: https://community.algolia.com/instantsearch.js/v1/documentation/#hide-results-on-init

hmm looks like I integrated it at the wrong location?
Doesn’t work…

<script src="https://cdn.jsdelivr.net/instantsearch.js/1/instantsearch.min.js"></script>
<script> const search = instantsearch({
                    appId: 'IONWXXXXXX',
                       apiKey: '39e1b17cb2d0406xxxxxxxxxxxxx',
                    indexName: 'InLearnity',
                    urlSync: true
                });
                
                search.addWidget(
                instantsearch.widgets.searchBox({
                    container: '#search-input'
                    })
                );
                search.addWidget(
                instantsearch.widgets.infiniteHits({
                    container: '#hits',
                    hitsPerPage: 8,
                    templates: {
                    	empty: 'No results',
                    	item: document.getElementById('hit-template').innerHTML
                    },
                    cssClasses: {
                    	showmore: 'ShowMoreButton'},
               			escapeHits: true,
                })
                );
                search.addWidget(
  							instantsearch.widgets.stats({
    								container: '#stats-container',
                    body: ['query']
  									})
								);
                var search = instantsearch({
  [...],
  searchFunction: function(helper) {
    var searchResults = $('.search-results');
    if (helper.state.query === '') {
      searchResults.hide();
      return;
    }
    helper.search();
    searchResults.show();
  }
}
                
                search.start();
                
                </script>

You have to adapt the code a bit to make it work.
The code you copied is not valid javascript, so it can not work like that.

The part searchFunction should be in the declaration of instantsearch at the top of your script.
It should be in the same declaration of const search = instantsearch({

Doesn’t work… guess I integrated the script wrong?

<script src="https://cdn.jsdelivr.net/instantsearch.js/1/instantsearch.min.js"></script>
<script> const search = instantsearch({
                    appId: 'IONWXXXXXX',
                       apiKey: '39e1b17cb2d0406xxxxxxxxxxxxx',
                    indexName: 'InLearnity',
                    urlSync: true
                }
                searchFunction: function(helper) {
                var searchResults = $('.search-results');
                if (helper.state.query === '') {
                searchResults.hide();
                return;
                }
                helper.search();
                searchResults.show();
            });
                
                search.addWidget(
                instantsearch.widgets.searchBox({
                    container: '#search-input'
                    })
                );
                search.addWidget(
                instantsearch.widgets.infiniteHits({
                    container: '#hits',
                    hitsPerPage: 8,
                    templates: {
                    	empty: 'No results',
                    	item: document.getElementById('hit-template').innerHTML
                    },
                    cssClasses: {
                    	showmore: 'ShowMoreButton'},
               			escapeHits: true,
                })
                );
                search.addWidget(
  							instantsearch.widgets.stats({
    								container: '#stats-container',
                    body: ['query']
  									})
								);
                
                search.start();
                
                </script>