Try our conversational search powered by Generative AI!

Create Lucene Query to search for properties of a page type

Vote:
 

Hello,

I've recently started working with EPiServer and have started to use EPiServer.Search.

I have certain properties that i assign to my pages such as Date of Birth for the contributors pages.

Is it possible to use a custom query to find for instance the Date of Birth through EPiServerSearch?

public class DateRangeQuery : IQueryExpression
    {
        public DateRangeQuery(string property, DateTime startDate, DateTime endDate)
        {
            Field = property;
            start = startDate;
            end = endDate;
        }

        public string GetQueryExpression()
        {
            return string.Format("{0}:[{1} TO {2}]",
                Field,
                start.ToString(),
                end.ToString());
        }

        public string Field { get; set; }
        public DateTime start { get; set; }
        public DateTime end { get; set; }
    }

My sincerest gratitude in advance.

#187392
Jan 22, 2018 14:04
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.