Pagination on search results page

Hi guys,

I’m looking to add a pagination feature to my search results page and although I have managed to do this, I don’t appear to have done so successfully!

My search results are being shown in a repeater connected to my dataset with the dataset set to display 24 items. This all works fine without the pagination but when I add the pagination and connect to the dataset, the search still shows the results it should on the opening page but the pagination shows pages covering all data in the dataset instead of just the data relevant to the search.

Basically, as a simple example, if I have a dataset displaying 12 items and I conduct a search with 24 results I would want the Pagination to show 2 pages available but that isn’t happening right now so I am wondering if I need to work with a bit of code to get the Pagination to work as I require?

For reference (not sure if relevant to this query), my search code is detailed below:

import { local } from 'wix-storage';

import wixData from 'wix-data';

$w.onReady(function () {

var sameWord = local.getItem("searchWord");

$w("#searchBar").value = sameWord;

$w("#searchBar").placeholder = sameWord;

$w('#Shunters').onReady(function ()  {

    search(); 
 
});

if ($w('#searchBar').value!==undefined) {search();}
 else {console.error("No search-term entered!")} 
    });

export function searchButton_click_1() {

    search();

    }

function search() {
 

    wixData.query('Shunters')
 
    .contains('number', $w('#searchBar').value)
    .or(wixData.query('Shunters').contains('previousNumber',$w('#searchBar').value))
    .or(wixData.query('Shunters').contains('operator',$w('#searchBar').value))
    .or(wixData.query('Shunters').contains('livery',$w('#searchBar').value))
    .or(wixData.query('Shunters').contains('name',$w('#searchBar').value))
    .or(wixData.query('Shunters').contains('depot',$w('#searchBar').value))
    .or(wixData.query('Shunters').contains('status',$w('#searchBar').value))
    .or(wixData.query('Shunters').contains('class1',$w('#searchBar').value))

 
        .find()

        .then(res => {

        $w('#repeater1').data = res.items;
 

 
 

 
        });
 
}

I have read up on the help and support available relating to Pagination but it doesn’t seem to link to this query I have so any help would be appreciated as always.

Edit: I have attempted to use a ‘Show More’ button instead of Pagination but I am getting the same sort of thing. I conduct a search and the results show (albeit, ignoring the limit of 12 items and showing all results) but the ‘Show More’ button is then available and when clicked starts to take me through all data in the dataset whether it relates to the search I have conducted or not!

Thanks