public void Should_search_by_partial_match()
        {
            var result = SearchSession
                         .CreateFullTextQuery <Country>("Name:Sw*")
                         .List <Country>();

            Assert.AreEqual(2, result.Count);
        }
Ejemplo n.º 2
0
        public void Should_find_match_for_string_without_spaces()
        {
            var result = SearchSession
                         .CreateFullTextQuery <Customer>("Phone:022457*")
                         .List <Customer>();

            CollectionAssert.IsNotEmpty(result);
        }
        public void Should_search_mapped_property_by_whole_word()
        {
            var result = SearchSession
                         .CreateFullTextQuery <Country>("Name:Switzerland")
                         .List <Country>();

            Assert.AreEqual(1, result.Count);
        }
        public void Should_parse_using_lucene_query()
        {
            var parser = new MultiFieldQueryParser(Version.LUCENE_29, new[] { "Name" }, new StandardAnalyzer(Version.LUCENE_29));
            var query  = parser.Parse("Switzerland");
            var q      = SearchSession.CreateFullTextQuery(query, typeof(Country))
                         .List <Country>();

            Assert.AreEqual(1, q.Count);
        }
Ejemplo n.º 5
0
        public void Should_be_able_to_get_results_from_whole_hierarchy_by_querying_with_abstarct_base_class()
        {
            var parser = new QueryParser(Version.LUCENE_29, "Name", new StandardAnalyzer(Version.LUCENE_29));
            var query  = parser.Parse("doc*");
            var result = SearchSession
                         .CreateFullTextQuery(query, typeof(Document))
                         .List <Document>();

            Assert.AreEqual(2, result.Count);
        }
Ejemplo n.º 6
0
        public void Should_get_results_by_querying_a_collection_in_base_class()
        {
            var parser = new QueryParser(Version.LUCENE_29, "References.Description", new StandardAnalyzer(Version.LUCENE_29));
            var query  = parser.Parse("red");
            var result = SearchSession
                         .CreateFullTextQuery(query, typeof(OrderDocument), typeof(InvoiceDocument))
                         .List <Document>();

            Assert.AreEqual(1, result.Count);
        }
Ejemplo n.º 7
0
        public void Should_be_able_to_get_results_from_by_querying_by_inheritors()
        {
            var parser = new QueryParser(Version.LUCENE_29, "Name", new StandardAnalyzer(Version.LUCENE_29));
            var query  = parser.Parse("doc*");
            var result = SearchSession
                         .CreateFullTextQuery(query, typeof(OrderDocument), typeof(InvoiceDocument))
                         .List <Document>();

            Assert.AreEqual(2, result.Count);
        }