Ejemplo n.º 1
0
        public virtual void  TestRewrite0()
        {
            SpanQuery q = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "sally")), "first");

            q.SetBoost(8.7654321f);
            SpanQuery qr = (SpanQuery)searcher.Rewrite(q);

            QueryUtils.CheckEqual(q, qr);

            Assert.AreEqual(1, qr.GetTerms().Count);
        }
Ejemplo n.º 2
0
        public virtual void  TestEquality1()
        {
            SpanQuery q1 = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "sally")), "first");
            SpanQuery q2 = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "sally")), "first");
            SpanQuery q3 = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "sally")), "XXXXX");
            SpanQuery q4 = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "XXXXX")), "first");
            SpanQuery q5 = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("xXXX", "sally")), "first");

            QueryUtils.CheckEqual(q1, q2);
            QueryUtils.CheckUnequal(q1, q3);
            QueryUtils.CheckUnequal(q1, q4);
            QueryUtils.CheckUnequal(q1, q5);

            SpanQuery qA = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "sally")), "first");

            qA.SetBoost(9f);
            SpanQuery qB = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "sally")), "first");

            QueryUtils.CheckUnequal(qA, qB);
            qB.SetBoost(9f);
            QueryUtils.CheckEqual(qA, qB);
        }
Ejemplo n.º 3
0
		public virtual void  TestEquality1()
		{
			SpanQuery q1 = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "sally")), "first");
			SpanQuery q2 = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "sally")), "first");
			SpanQuery q3 = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "sally")), "XXXXX");
			SpanQuery q4 = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "XXXXX")), "first");
			SpanQuery q5 = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("xXXX", "sally")), "first");
			QueryUtils.CheckEqual(q1, q2);
			QueryUtils.CheckUnequal(q1, q3);
			QueryUtils.CheckUnequal(q1, q4);
			QueryUtils.CheckUnequal(q1, q5);
			
			SpanQuery qA = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "sally")), "first");
			qA.SetBoost(9f);
			SpanQuery qB = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "sally")), "first");
			QueryUtils.CheckUnequal(qA, qB);
			qB.SetBoost(9f);
			QueryUtils.CheckEqual(qA, qB);
		}
Ejemplo n.º 4
0
		public virtual void  TestRewrite0()
		{
			SpanQuery q = new FieldMaskingSpanQuery(new SpanTermQuery(new Term("last", "sally")), "first");
			q.SetBoost(8.7654321f);
			SpanQuery qr = (SpanQuery) searcher.Rewrite(q);
			
			QueryUtils.CheckEqual(q, qr);
			
			Assert.AreEqual(1, qr.GetTerms().Count);
		}