Copied to clipboard

Flag this post as spam?

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


  • Gary 80 posts 377 karma points
    Jan 29, 2020 @ 10:26
    Gary
    0

    Examine Search Criteria - Less than / Greater than

    Hi,

    I am currently developing a search for a list of campaigns on a website i am working on. I have managed to build the search so far using the default examine external index but i have come across an issue.

    var searchQuery = searchCriteria
                .GroupedOr(new[] { "nodeName", "pageDescription", "pageKeywords", "campaignTags" }.ToList(), new[] { searchQ, searchPartner })
                .And()
                .ParentId(1164);
    

    This works fine with the GroupedOr up to this point. However, i have a "date of event" field on the search / filter. Each campaign has a start and end date but how can i add in to my query to check to see if the "Date of Event" the user selects, checks is in between the campaign properties (start date & end date).

    I have tried the .Range(date, lowerValue, HighValue) but it doesn't seem to pick up the custom umbraco properties.

    Any help would be appreciated.

    Kind Regards,

    GH

  • Dee 118 posts 338 karma points
    Aug 29, 2020 @ 17:42
    Dee
    0

    Hi Gary,

    were you able to come up with a solution? I am facing the same requirement.

    Would appreciate it, if you share your solution here.

    Dee

  • Yakov Lebski 590 posts 2344 karma points
    Aug 30, 2020 @ 03:28
    Yakov Lebski
    2

    You can use Range Query

    .RangeQuery<DateTime>(new string[] { "search_event_date" }, fromDate, toDate)
    
  • Dee 118 posts 338 karma points
    Aug 30, 2020 @ 07:24
    Dee
    0

    Thanks mate, I had to define the field definition type as integer additionally

Please Sign in or register to post replies

Write your reply to:

Draft