How to set pagination for return list using asp.net or json ?
If I have 100 matched records then I have to show only 10 records on first page.
If I set limit to 10 then I will get 10 records
But for get next 10 records, what I have to do ? (For 11 to 20, 21 to 30 and upto 91 to 100)
I means which properties is used for page index ? in search request
var searchRequest = new SearchRequest(index: "your_index", query: "your_query", sort: new List<Object>() { new { id = "asc"}, new { Name = "asc"}, new { Price = "desc"} });
You can add as much fields to the sort list as you need.
Sort with string not supported by Manticore ?
I checked sort with Id (int) ascending/descending, price (float/decimal) ascending/descending working fine, while sort with name (string/text) not working and it sort by relevance.
Is it possible to search with string ?
Can I set one field for sort and search both ?
I mean I have one field “name”, so can I make it searchable and sortable at same Index ?
Hi @Kamlesh ,
Yes, if your field has the string type, you can search and sort by it. E.g.:
var searchRequest = new SearchRequest(index: "your_index", query: new { equals = { Name = "build" } }, sort: new List<Object>() { new { Name = "asc"} });
SELECT *, IF(name.en IS NULL OR name.en = '', 1, 0) AS cond FROM myproducts WHERE REGEX(name.en, 'Apple') OR (cond=1 AND REGEX(name.standard, 'Apple') ) ORDER BY cond ASC, name.en ASC, name.standard ASC
Can you please suggest how to use this as a JSON ?
Can anyone please help me it to convert into JSON.
here is my table CREATE TABLE myproducts(name json)