public void AdvancedQuery_ReturnsOnlyMatchingRecordsWhenFilterSpecified_Equal() { var c = TestUtil.Client; const string valToMatch = "Eddie"; var filter = new DefaultFilterField(DefaultComparator.Equal, valToMatch, "customer_first_name"); var conn = new DefaultConnection(c); var criteria = new AdvancedQueryCriteria <SampleResult>( TestUtil.SampleIndices, null, null, new[] { filter }); var query = new AdvancedQuery <SampleResult>( criteria, conn); var results = query.Execute(); var all = results.Documents.All(x => x.CustomerFirstName == valToMatch); Assert.NotEmpty(results.Documents); Assert.True(all); }
public void AdvancedQuery_ReturnsOnlyMatchingRecordsWhenFilterSpecified_AnyWord() { var c = TestUtil.Client; const string valToMatch = "Basic"; var filter = new DefaultFilterField(DefaultComparator.AnyWord, valToMatch, "products.product_name"); var conn = new DefaultConnection(c); var criteria = new AdvancedQueryCriteria <SampleResult>( TestUtil.SampleIndices, null, null, new[] { filter }); var query = new AdvancedQuery <SampleResult>( criteria, conn); var results = query.Execute(); var all = results.Documents.All( x => x.Products.Any( z => z.ProductName.Contains(valToMatch, StringComparison.OrdinalIgnoreCase))); Assert.NotEmpty(results.Documents); Assert.True(all); }