public override object Clone() { SpanPayloadCheckQuery result = new SpanPayloadCheckQuery((SpanQuery)m_match.Clone(), m_payloadToMatch); result.Boost = Boost; return(result); }
public virtual void TestSpanPayloadCheck() { SpanTermQuery term1 = new SpanTermQuery(new Term("field", "five")); #pragma warning disable 612, 618 BytesRef pay = new BytesRef(("pos: " + 5).GetBytes(IOUtils.CHARSET_UTF_8)); #pragma warning restore 612, 618 SpanQuery query = new SpanPayloadCheckQuery(term1, new List <byte[]>() { pay.Bytes }); CheckHits(query, new int[] { 1125, 1135, 1145, 1155, 1165, 1175, 1185, 1195, 1225, 1235, 1245, 1255, 1265, 1275, 1285, 1295, 1325, 1335, 1345, 1355, 1365, 1375, 1385, 1395, 1425, 1435, 1445, 1455, 1465, 1475, 1485, 1495, 1525, 1535, 1545, 1555, 1565, 1575, 1585, 1595, 1625, 1635, 1645, 1655, 1665, 1675, 1685, 1695, 1725, 1735, 1745, 1755, 1765, 1775, 1785, 1795, 1825, 1835, 1845, 1855, 1865, 1875, 1885, 1895, 1925, 1935, 1945, 1955, 1965, 1975, 1985, 1995 }); Assert.IsTrue(Searcher.Explain(query, 1125).Value > 0.0f); SpanTermQuery term2 = new SpanTermQuery(new Term("field", "hundred")); SpanNearQuery snq; SpanQuery[] clauses; IList <byte[]> list; BytesRef pay2; clauses = new SpanQuery[2]; clauses[0] = term1; clauses[1] = term2; snq = new SpanNearQuery(clauses, 0, true); #pragma warning disable 612, 618 pay = new BytesRef(("pos: " + 0).GetBytes(IOUtils.CHARSET_UTF_8)); pay2 = new BytesRef(("pos: " + 1).GetBytes(IOUtils.CHARSET_UTF_8)); #pragma warning restore 612, 618 list = new List <byte[]>(); list.Add(pay.Bytes); list.Add(pay2.Bytes); query = new SpanNearPayloadCheckQuery(snq, list); CheckHits(query, new int[] { 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599 }); clauses = new SpanQuery[3]; clauses[0] = term1; clauses[1] = term2; clauses[2] = new SpanTermQuery(new Term("field", "five")); snq = new SpanNearQuery(clauses, 0, true); #pragma warning disable 612, 618 pay = new BytesRef(("pos: " + 0).GetBytes(IOUtils.CHARSET_UTF_8)); pay2 = new BytesRef(("pos: " + 1).GetBytes(IOUtils.CHARSET_UTF_8)); BytesRef pay3 = new BytesRef(("pos: " + 2).GetBytes(IOUtils.CHARSET_UTF_8)); #pragma warning restore 612, 618 list = new List <byte[]>(); list.Add(pay.Bytes); list.Add(pay2.Bytes); list.Add(pay3.Bytes); query = new SpanNearPayloadCheckQuery(snq, list); CheckHits(query, new int[] { 505 }); }
public override bool Equals(object o) { if (this == o) { return(true); } if (!(o is SpanPayloadCheckQuery)) { return(false); } SpanPayloadCheckQuery other = (SpanPayloadCheckQuery)o; return(this.PayloadToMatch.Equals(other.PayloadToMatch) && this.match.Equals(other.match) && this.Boost == other.Boost); }
public override bool Equals(object o) { if (this == o) { return(true); } if (!(o is SpanPayloadCheckQuery)) { return(false); } SpanPayloadCheckQuery other = (SpanPayloadCheckQuery)o; // LUCENENET NOTE: Need to use the structural equality comparer to compare equality of all contained values return(payloadEqualityComparer.Equals(this.m_payloadToMatch, other.m_payloadToMatch) && this.m_match.Equals(other.m_match) && this.Boost == other.Boost); }
public override bool Equals(object o) { if (this == o) { return(true); } if (!(o is SpanPayloadCheckQuery)) { return(false); } SpanPayloadCheckQuery other = (SpanPayloadCheckQuery)o; // LUCENENET NOTE: Need to use the structural equality comparer to compare equality of all contained values return(payloadEqualityComparer.Equals(this.m_payloadToMatch, other.m_payloadToMatch) && this.m_match.Equals(other.m_match) // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled && NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost)); }
public virtual void TestSpanPayloadCheck() { SpanTermQuery term1 = new SpanTermQuery(new Term("field", "five")); BytesRef pay = new BytesRef(("pos: " + 5).GetBytes(IOUtils.CHARSET_UTF_8)); SpanQuery query = new SpanPayloadCheckQuery(term1, new List<byte[]>() { pay.Bytes }); CheckHits(query, new int[] { 1125, 1135, 1145, 1155, 1165, 1175, 1185, 1195, 1225, 1235, 1245, 1255, 1265, 1275, 1285, 1295, 1325, 1335, 1345, 1355, 1365, 1375, 1385, 1395, 1425, 1435, 1445, 1455, 1465, 1475, 1485, 1495, 1525, 1535, 1545, 1555, 1565, 1575, 1585, 1595, 1625, 1635, 1645, 1655, 1665, 1675, 1685, 1695, 1725, 1735, 1745, 1755, 1765, 1775, 1785, 1795, 1825, 1835, 1845, 1855, 1865, 1875, 1885, 1895, 1925, 1935, 1945, 1955, 1965, 1975, 1985, 1995 }); Assert.IsTrue(Searcher.Explain(query, 1125).Value > 0.0f); SpanTermQuery term2 = new SpanTermQuery(new Term("field", "hundred")); SpanNearQuery snq; SpanQuery[] clauses; IList<byte[]> list; BytesRef pay2; clauses = new SpanQuery[2]; clauses[0] = term1; clauses[1] = term2; snq = new SpanNearQuery(clauses, 0, true); pay = new BytesRef(("pos: " + 0).GetBytes(IOUtils.CHARSET_UTF_8)); pay2 = new BytesRef(("pos: " + 1).GetBytes(IOUtils.CHARSET_UTF_8)); list = new List<byte[]>(); list.Add(pay.Bytes); list.Add(pay2.Bytes); query = new SpanNearPayloadCheckQuery(snq, list); CheckHits(query, new int[] { 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599 }); clauses = new SpanQuery[3]; clauses[0] = term1; clauses[1] = term2; clauses[2] = new SpanTermQuery(new Term("field", "five")); snq = new SpanNearQuery(clauses, 0, true); pay = new BytesRef(("pos: " + 0).GetBytes(IOUtils.CHARSET_UTF_8)); pay2 = new BytesRef(("pos: " + 1).GetBytes(IOUtils.CHARSET_UTF_8)); BytesRef pay3 = new BytesRef(("pos: " + 2).GetBytes(IOUtils.CHARSET_UTF_8)); list = new List<byte[]>(); list.Add(pay.Bytes); list.Add(pay2.Bytes); list.Add(pay3.Bytes); query = new SpanNearPayloadCheckQuery(snq, list); CheckHits(query, new int[] { 505 }); }
public override object Clone() { SpanPayloadCheckQuery result = new SpanPayloadCheckQuery((SpanQuery)match.Clone(), PayloadToMatch); result.Boost = Boost; return result; }