Copied to clipboard

Flag this post as spam?

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


  • Eran Meir 401 posts 543 karma points
    Feb 04, 2011 @ 12:53
    Eran Meir
    0

    Examine Range

    hey, i'm trying to search for documents that has date value.
    my problem is that i'm trying to search for all the documents that "happen" this month but it return me nothing.

    var eventCriteria = ExamineManager.Instance.SearchProviderCollection["MySearcher"].CreateSearchCriteria(UmbracoExamine.IndexTypes.Content);
                DateTime firstDayOfTheMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
                DateTime lastDayOfTheMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1);
                var eventFilter = eventCriteria.Range("eventDate", firstDayOfTheMonth, lastDayOfTheMonth).Compile();
    EventSearchResults = ExamineManager.Instance.SearchProviderCollection["MySearcher"].Search(eventFilter);
    
    anyone got an idea?

     

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Feb 04, 2011 @ 15:49
    Ismail Mayat
    0

    Eran,

    Looks like you have similar  issue http://our.umbraco.org/forum/using/ui-questions/16888-Examine-Search-Range-Values also see http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Range Searches it may be you just need to get the dates formatted correctly as string eg

    20020101

  • Eran Meir 401 posts 543 karma points
    Feb 04, 2011 @ 17:07
    Eran Meir
    0

    thank you, i will try it.

  • Eran Meir 401 posts 543 karma points
    Feb 05, 2011 @ 12:01
    Eran Meir
    0

    this format didn't do the trick, but formating the string as yyyy-MM-dd did the trick and it's working

Please Sign in or register to post replies

Write your reply to:

Draft