Question

I have a KeywordQuery that I need to filter so the current date is between the Start Date and End Date.

Today >= "Start Date" && Today < "End Date"
Was it helpful?

Solution

I think there are four issues with what you are trying:

  1. Your managed property names cannot have spaces in them, i.e. presuming start date and end date are your list columns, you need to find the names of managed properties associated with them.

    So your query might become like this:

    Today >= "StartDate" && Today < "EndDate"
    
  2. You will need the order reversed for properties and the values you are comparing with.

    StartDate <= Today && EndDate > Today
    
  3. Then you need to remove the white spaces between operators and keyword, and operators and values.

    StartDate<=Today && EndDate>Today
    
  4. And then, you need to switch your && operator for AND.

    StartDate<=Today AND EndDate>Today        
    

References:

Manage search schema

KQL

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top