public void test_exact_search_query_works_with_sorting()
        {
            using (var db = GetDbForSortTests())
            {
                var helper = new RecordQueryer(db);

                var input = new RecordQueryInputModel
                {
                    Q = @"""birds""",
                    F = null,
                    P = 0,
                    N = 25,
                    O = SortOptions.TitleAZ
                };

                var results = helper.Search(input).Results;
                results.Count.Should().Be(2);
                results.ToList()[0].Title.Should().Be("<b>birds</b>");
                results.ToList()[1].Title.Should().Be("coastal <b>birds</b>");
            }
        }
        public void test_results_sorted_by_dataset_reference_date_asc()
        {
            var helper = new RecordQueryer(Db);

            var input = new RecordQueryInputModel
            {
                Q = "",
                F = null,
                P = 0,
                N = 25,
                O = SortOptions.OldestToNewest
            };

            var results = helper.Search(input).Results;

            results.Count.Should().Be(4);
            results.ToList()[0].Title.Should().Be("sea");
            results.ToList()[1].Title.Should().Be("birds");
            results.ToList()[2].Title.Should().Be("coastal birds");
            results.ToList()[3].Title.Should().Be("seabirds");
        }
Exemple #3
0
        public void test_results_sorted_by_relevance()
        {
            var db = GetDbForSortTests();

            using (db)
            {
                var helper = new RecordQueryer(db);

                var input = new RecordQueryInputModel
                {
                    Q = "birds",
                    F = null,
                    P = 0,
                    N = 25,
                    O = SortOptions.MostRelevant
                };

                var results = helper.Search(input).Results;
                results.Count.Should().Be(3);
                results.ToList()[0].Title.Should().Be("<b>birds</b>");
                results.ToList()[1].Title.Should().Be("coastal <b>birds</b>");
                results.ToList()[2].Title.Should().Be("sea<b>birds</b>");
            }
        }