I'd advise against using LINQ to objects for sorting, you're loosing a huge amount in performance as all results have to be loaded from Lucene (which is costly).
Awesome that works a treat. Just for my own understanding I notice that when you add the attribute EnableSorting="true" on a field it creates an extra field in the index and i guess you use that field namely _Sort_nodeName this is Indexed,Stored as opposed to nodeName which is additional Tokenised and term vector. I take it if field is stored as tokenised and or term vector you cant sort on it hence duplicate field created?
Correct, you can't sort on a tokenized field (well you can if there is only a single token ;)). Lucene has no idea which term in the field should be used for the sorting.
Simplest way to get around this is to have an untokenized version of the field which you use for sorting (or so the initial research has shown us).
Examine sort of results
Hello,
I have the following query
However the results still seem to be sorting by date added my results look like name then score i would expect an eco product to be the first one
Regards
Ismail
Sorry if this is a dumb question but I haven't used Examine yet, but what is Query (IEnumerable, List<T>) or something different?
Lee,
Get stuck when trying with linq
its not complete basically the nodeName is a field in fields which is of type IDictionary<string,string> i got stuck any linq masters out there?
regards
Ismail
Ahhh ok that might explain why it wasn't finding nodeName if its in IDictionary<>?
Maybe something like (r=>r.Fields["nodeName"]) or (r=>r.Fields[0]) .. In fact I'm going to fire up VS and have a go because I'm probably way off! lol
Is it one or the other
Lee,
Ok got this sorted pardon the pun ;-}
Put you down as solution as you give me the hint. Its a work around as i am sorting using lucene but its not behaving!!!
Regards
Ismail
I'd advise against using LINQ to objects for sorting, you're loosing a huge amount in performance as all results have to be loaded from Lucene (which is costly).
With your OrderBy statement in Examine you need to have enabled sorting on the field, see: http://examine.codeplex.com/wikipage?title=UmbracoExamine under IndexAttributeFields
Slace,
Awesome that works a treat. Just for my own understanding I notice that when you add the attribute EnableSorting="true" on a field it creates an extra field in the index and i guess you use that field namely _Sort_nodeName this is Indexed,Stored as opposed to nodeName which is additional Tokenised and term vector. I take it if field is stored as tokenised and or term vector you cant sort on it hence duplicate field created?
Regards
Ismail
Correct, you can't sort on a tokenized field (well you can if there is only a single token ;)). Lucene has no idea which term in the field should be used for the sorting.
Simplest way to get around this is to have an untokenized version of the field which you use for sorting (or so the initial research has shown us).
is working on a reply...