Copied to clipboard

Flag this post as spam?

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


  • Mikael Mørup 297 posts 326 karma points
    Feb 27, 2012 @ 13:45
    Mikael Mørup
    0

    Examine search problem

    I have implemented a custom Examine search in my Umbraco 4.7.0 site

    When i do this:


    Dim Searcher = ExamineManager.Instance.SearchProviderCollection("WebsiteSearcher")
    Dim searchCriteria = Searcher.CreateSearchCriteria(BooleanOperation.Or)
    Dim query = searchCriteria.RawQuery(q)
    Dim sRes = Searcher.Search(query)

    everything works fine


    But if i try to sort by updatedate like this:


    Dim Searcher = ExamineManager.Instance.SearchProviderCollection("WebsiteSearcher")
    Dim searchCriteria = Searcher.CreateSearchCriteria(BooleanOperation.Or)
    Dim query = searchCriteria.RawQuery(q).OrderByDescending("updateDate")
    Dim sRes = Searcher.Search(query)

    I get this exception:

    Unable to cast object of type 'Examine.LuceneEngine.SearchCriteria.LuceneBooleanOperation' to type 'Examine.SearchCriteria.ISearchCriteria'.


    Can anyone explain what i'm doing wrong, and how to do the sort in the correct way.

    Thanks

    Mikael

  • Dirk 13 posts 33 karma points
    Feb 27, 2012 @ 17:16
    Dirk
    0

    Just a guess, but have you tried changing this:

    .CreateSearchCriteria(BooleanOperation.Or)

    into this?

    .CreateSearchCriteria(UmbracoExamine.IndexTypes.Content);

    Also, what 's the definition of  "RawQuery(q)"?  

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies