Query speed on Android phone ... how to reduce delay and LOAD MORE with wixData query?

I am happy with what wix has done for us. To the point I have a database of 160 elements now … it is slowing down the query load. When I do wixdata query for a search word, it takes a long time to load, especially on my Android phones.
I have two questions:

  1. How do I break up a query into multiple page parts? I thought the repeater or content manager limit was going to do the trick but it does not seem to limit.

  2. I found some blogs saying that “breaking into pages” is not possible. I tried limit() but I don’t know how to query the next 16-30.

I think I know how to do repeater and load more without the query code. How do I do the load more trip WITH QUERY CODE?

function indexer (search) {
wixData.query( “QuestionMailbox” )
.contains( “answerKeyword1” , search)
.find()
.then(results => {
$w( ‘#repeater1’ ).data = results.items
});
}

I tried to add
limit(15) to before find()
But how to keep going to install the next batch?

Thank you!

See the following functions in WixDataQueryResult :

  • hasNext( ) Indicates if the query has more results.

  • hasPrev( ) Indicates the query has previous results.

  • next( ) Retrieves the next page of query results.

  • prev( ) Retrieves the previous page of query results.

You will need to provide the proper logic to handle the paging.

Another option would be to use a Dataset which can handle much of this logic for you.

Yisrael, Thanks.
What is the simplest way to explain DataQuery and Dataset commands? after all, when I do a dataQuery I am querying a “dataset”.
I will have to figure it out. But I would appreciate some straightforward answer about their differences.
It looks like dataset is what I need to use … It provides more control knobs.
Chang

A Dataset is a connector between the page components and the database collection. It’s a convenient way to interface with the database, and it does a lot of the work for you and often times you won’t need code. I recommend reading Connecting Data which does a much better job explaining the topic than I could.

Yisrael,
Great. I am aware of both (1) Dataset As Page Element (mostly repeater) and (2) Data Query. Mostly I query database and >>send the information to an onboard repeater. I am not up to the point of “writing repeaters for myself” yet. But I like Wix has done and hope you guys never change.

Let’s say my repeater has a design element size of 3 and my attached dateset has a limit of 12, but let’s say if the search result would yield a result of 15. I found that “data query” would just spill out 12 of them (if I go “NextPage” it would give me 3 results and continue the rest 9 unsorted), and Dataset.byFilter would give me 15 all at once. Anyways, it is time consuming to figure out the exact behavior, but I am aware of what you are pointing to.
I am still learning the behavior of repeater size/data result size/NextPage etc.