コード例 #1
0
        public void Export_ReturnsValidJson()
        {
            var query = new DisjunctionQuery(
                new TermQuery("hotel").Field("type")
            );

            var result = query.Export().ToString(Formatting.None);

            var expected = JsonConvert.SerializeObject(new
            {
                query = new
                {
                    boost = 0.0,
                    min = 1,
                    disjuncts = new[]
                    {
                        new
                        {
                            query = new
                            {
                                term = "hotel",
                                boost = 0.0,
                                field = "type",
                                prefix_length = 0,
                                fuzziness = 0
                            }
                        }
                    }
                }
            }, Formatting.None);

            Assert.AreEqual(expected, result);
        }
コード例 #2
0
        public void Export_ReturnsValidJson()
        {
            var query = new DisjunctionQuery(
                new TermQuery("hotel").Field("type")
                );

            var result = query.Export().ToString(Formatting.None);

            var expected = JsonConvert.SerializeObject(new
            {
                query = new
                {
                    boost     = 0.0,
                    min       = 1,
                    disjuncts = new[]
                    {
                        new
                        {
                            query = new
                            {
                                term          = "hotel",
                                boost         = 0.0,
                                field         = "type",
                                prefix_length = 0,
                                fuzziness     = 0
                            }
                        }
                    }
                }
            }, Formatting.None);

            Assert.AreEqual(expected, result);
        }
コード例 #3
0
        public void Export_ReturnsValidJson()
        {
            var query = new DisjunctionQuery(
                new TermQuery("hotel").Field("type")
                );

            var result = query.Export().ToString(Formatting.None);

            var expected = JsonConvert.SerializeObject(new
            {
                min       = 1,
                disjuncts = new[]
                {
                    new
                    {
                        term  = "hotel",
                        field = "type"
                    }
                }
            }, Formatting.None);

            Assert.Equal(expected, result);
        }