Skip to content

Terms not working as expected #843

Closed
@nascosto

Description

@nascosto

I didn't have this problem with pre-1.0.0. I'm attempting to use 1.0.1 right now

I'm having a problem with Terms. It only seems to work for strings. In my case, longs and enums are leaving the filter empty. Also, before I could pass in null to Terms and it would handle it correctly. I can no longer do that. It throws a System.AggregateException in mscorlib.

var query = Query<MyType>.Filtered(filtered => filtered
    .Filter(f =>
        f.Terms(t => t.longValue, new long[] { 1, 2, 3 }) // Produces empty filter
    )
    .Query(q => q.MatchAll())
);
var query = Query<MyType>.Filtered(filtered => filtered
    .Filter(f =>
        f.Terms(t => t.stringValue, new string[] { "test1", "test2", "test3" }) // Working
    )
    .Query(q => q.MatchAll())
);
var query = Query<MyType>.Filtered(filtered => filtered
    .Filter(f =>
        f.Terms(t => t.longValue, new long[] { 1, 2, 3}) && // Produces filter with just the string term filter
        f.Terms(t => t.stringValue, new string[] { "test1", "test2", "test3" }) 
    )
    .Query(q => q.MatchAll())
);
var query = Query<MyType>.Filtered(filtered => filtered
    .Filter(f =>
        f.Terms(t => t.stringValue, (string[]) null) // Boom - Exception thrown
    )
    .Query(q => q.MatchAll())
);

Am I doing something wrong or is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions