Exemplo n.º 1
0
        public void Search_ForMustang_ReturnsCarMustang()
        {
            List <dynamic> result = index.Searcher.Search("Mustang").Select(hit => hit.Json).ToList();

            Assert.That(result,
                        Has.Count.EqualTo(1) &
                        Has.Exactly(1).That(JsonHas.Properties("{ Id: '00000000-0000-0000-0000-000000000004', Type: 'Car', Brand: 'Ford', Model: 'Mustang' }")));
        }
Exemplo n.º 2
0
        public void Search_ForMustang3_ReturnsCarMustang()
        {
            BooleanQuery query = new BooleanQuery();

            query.Add(new WildcardQuery(new Term("Model", "Mustang*")), Occur.SHOULD);
            query.Add(new FuzzyQuery(new Term("Model", "Mustang")), Occur.SHOULD);

            List <dynamic> result = index.Searcher.Search(query).Select(hit => hit.Json).ToList();

            Assert.That(result,
                        Has.Count.EqualTo(1) &
                        Has.Exactly(1).That(JsonHas.Properties("{ Id: '00000000-0000-0000-0000-000000000004', Type: 'Car', Brand: 'Ford', Model: 'Mustang' }")));
        }