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.
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
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)"?
is working on a reply...