Copied to clipboard

Flag this post as spam?

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


  • Jeremy 3 posts 73 karma points
    Mar 22, 2018 @ 10:39
    Jeremy
    0

    Examine index issue where ScoreDocs fields are null

    I'm having an issue with my Examine Index when sorting results where some of the ScoreDocs fields are returning as null. The 2 in question here are 'Zeus' and 'Poseidon'. Republishing these nodes puts them into the correct order but if I then Rebuild the index the issue reoccurs.

    Any help appreciated!

    screenshot from Visual Studio - Examine Index ScoreDocs fields null

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Mar 22, 2018 @ 16:48
    Ismail Mayat
    0

    Jeremy,

    By default examine well to be more specific lucene orders by score. If you order by any other field then the will be set to NaN as you can see in your screen shot. I am not sure why it does whether its lucene that does it but my guess is because you are setting the sort it ignores it.

    Regards

    Ismail

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Mar 22, 2018 @ 16:52
  • Jeremy 3 posts 73 karma points
    Mar 30, 2018 @ 15:27
    Jeremy
    0

    I ended up sorting using LINQ:

    List<int> nodeIds = results.ScoreDocs
        .Select(x => int.Parse(searcher.Doc(x.doc).Get("__NodeId"))
        )
        .ToList();
    
    output.Results = nodeIds.Select(x => x).OrderBy(x => GetNodeName(x)).ToList();
    
Please Sign in or register to post replies

Write your reply to:

Draft