public void SerializeWithStartUnbound() { var q = new SolrFacetIntervalQuery("state"); q.Sets.Add(new FacetIntervalSet(null, new FacetIntervalSetValue("pa", true))); var r = Serialize(q); Assert.Contains(KV.Create("facet.interval", "state"), r); Assert.Contains(KV.Create("f.state.facet.interval.set", "[*,pa]"), r); }
public void SerializeWithStringSpecialCharacters() { var q = new SolrFacetIntervalQuery("state"); q.Sets.Add(new FacetIntervalSet(new FacetIntervalSetValue("a,z", true), new FacetIntervalSetValue("p[]a", true))); var r = Serialize(q); Assert.Contains(KV.Create("facet.interval", "state"), r); Assert.Contains(KV.Create("f.state.facet.interval.set", @"[a\,z,p\[\]a]"), r); }
public void SerializeWithEndUnbound() { var q = new SolrFacetIntervalQuery("state"); q.Sets.Add(new FacetIntervalSet(new FacetIntervalSetValue("az", true), null)); var r = Serialize(q); Assert.Contains(KV.Create("facet.interval", "state"), r); Assert.Contains(KV.Create("f.state.facet.interval.set", "[az,*]"), r); }
public void SerializeWithIntOneItem() { var q = new SolrFacetIntervalQuery("version"); q.Sets.Add(new FacetIntervalSet(new FacetIntervalSetValue(1, true), new FacetIntervalSetValue(5, true))); var r = Serialize(q); Assert.Contains(KV.Create("facet.interval", "version"), r); Assert.Contains(KV.Create("f.version.facet.interval.set", "[1,5]"), r); }
public void SerializeWithStringOneItem() { var q = new SolrFacetIntervalQuery("state"); q.Sets.Add(new FacetIntervalSet(new FacetIntervalSetValue("az", true), new FacetIntervalSetValue("pa", true))); var r = Serialize(q); Assert.Contains(KV.Create("facet.interval", "state"), r); Assert.Contains(KV.Create("f.state.facet.interval.set", "[az,pa]"), r); }
public void SerializeWithDateOneItem() { var q = new SolrFacetIntervalQuery("timestamp"); q.Sets.Add(new FacetIntervalSet(new FacetIntervalSetValue(new DateTime(2009, 1, 1, 0, 0, 0, DateTimeKind.Utc), true), new FacetIntervalSetValue(new DateTime(2010, 1, 1, 0, 0, 0, DateTimeKind.Utc), true))); var r = Serialize(q); Assert.Contains(KV.Create("facet.interval", "timestamp"), r); Assert.Contains(KV.Create("f.timestamp.facet.interval.set", "[2009-01-01T00:00:00Z,2010-01-01T00:00:00Z]"), r); }
public void SerializeWithExclusive() { var q = new SolrFacetIntervalQuery("state"); q.Sets.Add(new FacetIntervalSet(new FacetIntervalSetValue("az", false), new FacetIntervalSetValue("pa", false))); var r = Serialize(q); Assert.Contains(KV.Create("facet.interval", "state"), r); Assert.Contains(KV.Create("f.state.facet.interval.set", "(az,pa)"), r); }
public void SerializeWithLocalParams() { var q = new SolrFacetIntervalQuery("state"); var lp = new LocalParams(); lp.Add("key", "arizonatopen"); q.Sets.Add(new FacetIntervalSet(new FacetIntervalSetValue("az", false), new FacetIntervalSetValue("pa", false), lp)); var r = Serialize(q); Assert.Contains(KV.Create("facet.interval", "state"), r); Assert.Contains(KV.Create("f.state.facet.interval.set", "{!key=arizonatopen}(az,pa)"), r); }
public void IgnoresLocalParams() { var q = new SolrFacetIntervalQuery(new LocalParams { { "ex", "cat" } } +"state"); q.Sets.Add(new FacetIntervalSet(null, null)); var r = Serialize(q); Assert.Contains(KV.Create("facet.interval", "{!ex=cat}state"), r); Assert.Contains(KV.Create("f.state.facet.interval.set", "[*,*]"), r); }
public void SerializeWithStringMultipleItem() { var q = new SolrFacetIntervalQuery("letters"); q.Sets.Add(new FacetIntervalSet(null, new FacetIntervalSetValue("d", true), "a")); q.Sets.Add(new FacetIntervalSet(new FacetIntervalSetValue("e", true), new FacetIntervalSetValue("g", true))); q.Sets.Add(new FacetIntervalSet(new FacetIntervalSetValue("k", true), null)); var r = Serialize(q); Assert.Contains(KV.Create("facet.interval", "letters"), r); Assert.Contains(KV.Create("f.letters.facet.interval.set", "{!key=a}[*,d]"), r); Assert.Contains(KV.Create("f.letters.facet.interval.set", "[e,g]"), r); Assert.Contains(KV.Create("f.letters.facet.interval.set", "[k,*]"), r); }