Copied to clipboard

Flag this post as spam?

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


  • Colin Anderson 16 posts 107 karma points
    May 11, 2018 @ 10:23
    Colin Anderson
    0

    Sorting Examine results

    When Examine returns the results, the default is to sort them by the score.

    This is fine, but when multiple documents have the same score they are then sorted by the Document Id. This looks like it is an Examine ID.

    The result is documents sorted in a way that doesn't make sense to the end user.

    Is there a way to get Examine/Lucene to sort by score and by nodeName or any other field?

  • Mike Chambers 636 posts 1253 karma points c-trib
    May 21, 2018 @ 11:14
    Mike Chambers
    100

    Depending on how are you retrieving you examine results.

    you could order the returned results?

     foreach (var result in results.OrderByDescending( x => x.Score ).ThenByDescending( x => x.[anotherProperty] ) ){ ... }
    

    Or you can also do optimised in the lucene query (better for paging too)

    https://github.com/Shazwazza/Examine/wiki/Sorting-results

Please Sign in or register to post replies

Write your reply to:

Draft