I want to fetch people with similar interests based on common taxonomy tags.

I am following the Sitecore documentation section "Add a query item that uses a token" mentioned here:


I have written a query and am getting the expected result but I don't find any way to get the sorted result.

enter image description here

e.g. I want to fetch people result order by updated date. I have tried the sort option using sort:<field-name> | value but did not help.

Request your support to achieve the sorted result.

Thanks, Hari

2 Answers 2


Use order by clause in your query:

query:$home//*[contains(@@templateid,'{templateid}') and (contains(@@taxonomyfield,'{taxonomytag}'))] order by @@updated desc

  • Hi Biswajit, Thanks for your inputs. I just tried putting your suggested query like custom:query|$home//*[contains(@@templateid,'{342696b0-2b67-406f-8e49-c7acc7894741}')] order by @@__updated desc in the Sitecore but did not get any result. I want to use sxa:TaggedWithAtLeastOneTagFromCurrentPage|SxaTags in the query and get the result with sorting order. Mar 26, 2023 at 7:47

To Sort the results by updated date, you will need to use sort:__updated in the query builder dialog box. Your query should look like below: Make sure you have Sitecore_sxa_master_index rebuilt successfully.


enter image description here

  • Hi Raman, Thanks for your inputs. I have tried your suggestions but am getting error as _Object reference not set to an instance of object at @Html.RenderingVariants().RenderVariant(variantField, Model.Item, Model.RenderingWebEditingParams, Model) in file ~\Views\Variants\Page Content.cshtml _ I think in normal case as you suggested sorting works but if I am using sxa:TaggedWithAtLeastOneTagFromCurrentPage|SxaTags along with sort in build query then it does not bring any result . What could I try pls? Mar 26, 2023 at 7:33
  • I am able to get the sorted result with usage of solr index field __smallupdateddate_tdt then the Query looks like +template:{342696b0-2b67-406f-8e49-c7acc7894741};+sxa:TaggedWithAtLeastOneTagFromCurrentPage|SxaTags;sort:__smallupdateddate_tdt[desc] Sitecore __updated field is stored in the solr index as __smallupdateddate_tdt field Mar 27, 2023 at 7:13
  • thanks @HariWaghamare. I just checked i was getting results with sxa:TaggedWithAtLeastOneTagFromCurrentPage|SxaTags as well. Glad that you are able to resolve with __smallupdateddate_tdt Mar 27, 2023 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.