Skip to content

Nested query doesn't return results #330

@bjarnef

Description

@bjarnef

We have a query builder constructing a nested query, so value of registration deadline or end date need to be between DateTime.Now and DateTime.MaxValue.

if (_hasEnded.HasValue && _hasEnded.Value == false)
{
    query.And().Group(x =>
    {
        return x.RangeQuery<DateTime>(new[]
        {
            Constants.Examine.CourseInstance.FieldNames.RegistrationDeadline
        }, DateTime.Now, DateTime.MaxValue)
        .Or()
        .RangeQuery<DateTime>(new[]
        {
            Constants.Examine.CourseInstance.FieldNames.EndDate
        }, DateTime.Now, DateTime.MaxValue);
    });
}

this has been simplified a bit.

which generates a Lucene query like:

+__IndexType:courseinstance +hideFromSearch:0 +(categoryID:42291) +isCancelled:0 +((registrationDeadline:[638128410874010000 TO 3155378975999990000]) (endDate:[638128410874010000 TO 3155378975999990000])) +(categoryID:42291) +isCancelled:0 +((registrationDeadline:[638128411018970000 TO 3155378975999990000]) (endDate:[638128411018970000 TO 3155378975999990000]))

The raw query executed in Examine dashboard shows results:

image

but not mapped to ISearchResults:

image

when I comment this part I get results:

image

Umbraco v10.4.0
Examine v3.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions