Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • blackhawk 313 posts 1364 karma points
    Jul 02, 2017 @ 02:12

    examine custom sort results based on integer

    I would like to accomplish the following and simply would like to know if it's possible through Umbraco 7.

    (1) Attach a custom property editor to each content node that holds a custom integer ranging from 1 to 100.

    (2) Through examine search results, sort results in ascending order based on that integer value.

    is this possible?

  • marc goodson 587 posts 3606 karma points MVP 3x c-trib
    Jul 02, 2017 @ 09:49
    marc goodson

    Hi blackhawk

    Yes, have a look at the examine documentation for sorting here:

    Essentially examine will sort by string by default, eg return "10" before "2" for a numerical field, but if you tell it via the examine configuration that the index item is of type INT, and enablesorting on it, (same for datetime too) then you should be able to achieve the result you are after.

    <IndexSet SetName="documentationIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/documentation/">
          <add Name="doc"/>
          <add Name="likes" Type="INT" EnableSorting="true"/>

    and query

    var sc = ExamineManager.Instance.CreateSearchCriteria();
    var query = sc.Field("doc", "hats")



  • blackhawk 313 posts 1364 karma points
    Oct 11, 2017 @ 17:29

    Thank you! This works for me.

Please Sign in or register to post replies

Write your reply to: