Timeline for Sitecore SXA Item Query and sort capability
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 20, 2017 at 18:17 | comment | added | Alan Płócieniak |
Yes. While you specify sort field there is a query in the background which returns all fields, not only those which exist in your template (used for previous filter criteria). Technically you can require sorting by a field which is not present in some of the search results. Open chrome dev tools and type space then remove text completely. Look for a request like that http://site/sitecore/shell/Applications/Buckets/ItemBucket.asmx/GetFields . My response contains more than 1000 fields.
|
|
Dec 20, 2017 at 15:12 | comment | added | David Hake | Yeah, I meant a custom field in a template I've created. If I define a template in my query I am searching for, should the sort make all the fields available in that template for me to sort against? | |
Dec 19, 2017 at 22:47 | comment | added | Alan Płócieniak |
I am not sure what do you mean. Custom fields from template or custom field types? If the first, then the answer is yes. I used Published field which comes from my custom template and it is not a default Sitecore field, I've created templates from the scratch. Default types like date, integer have proper comparer already, I've never created a comparer for custom field types and I don't know for now how to do it. Btw. do you really need that?
|
|
Dec 19, 2017 at 22:39 | comment | added | David Hake | Thank you! One last question, are you aware of being able to sort on any custom fields, or is it limited to fields on a standard Sitecore item? | |
Dec 19, 2017 at 21:58 | comment | added | Alan Płócieniak | @DavidHake answer updated with raw values of my crafted queries. Yes, I presented two cases on the gif (descending/ascending) | |
Dec 19, 2017 at 21:57 | history | edited | Alan Płócieniak | CC BY-SA 3.0 |
added 187 characters in body
|
Dec 19, 2017 at 21:54 | comment | added | David Hake | This is great detail. I think part of my confusion is that my Sitecore site is actually not giving me predictive options based on what I am typing. I'd be curious to see what the sort portion of the query you put together looks like. I assume it's +template:{guid};+sort{?} Also, are you aware of being able to define if it will sort ascending or descending based on the field you enter? | |
Dec 19, 2017 at 21:38 | history | edited | Alan Płócieniak | CC BY-SA 3.0 |
added 240 characters in body
|
Dec 19, 2017 at 21:31 | history | answered | Alan Płócieniak | CC BY-SA 3.0 |