# Search Result Request
# Description
A search result request is very similar to an aspect request but instead of returning a guided navigation option list, it instead produces all the items that are inside the dataset that match the request terms inputted
# Benefits of Search Result Request
A search result request is the main part of displaying the correct data to your website, without the search result request, you wouldn't have any items to display to the user. Because a search result request returns the items themselves, you could use this data to create the UI for your website that contains this data. Because of the way the search result request is set up, you could also use it to create pagination within your website using the skip section of the syntax, for example, one page skips zero values and takes 15, whereas the next one skips 15 values and takes 15, essentially creating pages that each contains 15 items.
# Syntax
sr = ids|sortBy|skip|take
# Attributes
Note: all attributes marked with * are required.
- ids
- Having this inside the request will only show the ids of the items that get returned
- sortBy
- The SortIndex item to sort by, these are configured within the index config.
- skip (default 0)
- The number of items in the list you wish to skip over and not show. Defaults to zero
- take (default 15)
- The number of items to show, defaults to 15 with a max of 60
# Example One
# Code
?sr=|Price|10|3
The following is the result produced by the above code.
{
"SearchResults":[
{
"Id":"1234422",
"UniqueId":22,
"Category":"Fiction Books",
"LastModified":"2020-05-01T06:27:04Z",
"CreatedDate":"2016-05-12T06:08:57Z",
"ListingType":"New",
"SaleStatus":"In Stock",
"Description":"Description of book",
"Media":{...}(2 hidden elements),
"GeoLocation":{
"Latitude":-37.66307,
"Longitude":145.25468,
},
"Prices":[...](1 hidden elements),
"Ranking":221,
"Specification":{...}(14 hidden elements),
"Tags":[...](0 hidden elements),
"PriceList":[...](1 hidden elements),
},
{...}(15 hidden elements),
{...}(15 hidden elements)
]
}
This request used Price as its sorting index, so all items are sorted by their price from lowest to highest, adding a ~ in front of price would reverse this order. 10 items are also skipped initially so the list starts from item 11 and only 3 items are shown. The output of the items depends on the client's configuration of the item elements.
# Example Two
# Code
?sr=ids|Price||5
The following is the result produced by the above code.
{
"SearchResults":[
"1232227",
"7890789",
"5787878",
"3822865",
"01293481"
]
}
This request is now showing only the ids of the produced items due to the ids keyword at the beginning, it is still sorting by price ascending but this time is not skipping any items and is only showing 5 of them.
