Constructs a filter for docs matching any of the terms added to this class. Unlike a RangeFilter this can be used for filtering on multiple terms that are not necessarily in a sequence. An example might be a collection of primary keys from a database query result or perhaps a choice of "category" labels picked by the end user. As a filter, this is much faster than the equivalent query (a BooleanQuery with many "should" TermQueries)
Inheritance: Lucene.Net.Search.Filter
Esempio n. 1
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if ((obj == null) || (obj.GetType() != this.GetType()))
            {
                return(false);
            }

            TermsFilter test = (TermsFilter)obj;

            // first check the fields before even comparing the bytes
            if (test.hashCode_Renamed == hashCode_Renamed && Arrays.Equals(termsAndFields, test.termsAndFields))
            {
                int lastOffset = termsAndFields[termsAndFields.Length - 1].end;
                // compare offsets since we sort they must be identical
                if (ArrayUtil.Equals(offsets, 0, test.offsets, 0, lastOffset + 1))
                {
                    // straight byte comparison since we sort they must be identical
                    return(ArrayUtil.Equals(termsBytes, 0, test.termsBytes, 0, offsets[lastOffset]));
                }
            }
            return(false);
        }
Esempio n. 2
0
 public FieldAndTermEnumAnonymousInnerClassHelper(TermsFilter outerInstance, IList <Term> terms)
 {
     this.outerInstance = outerInstance;
     this.terms         = terms;
     iter = Sort(terms).GetEnumerator();
 }
Esempio n. 3
0
 public FieldAndTermEnumAnonymousInnerClassHelper2(TermsFilter outerInstance, string field, IList <BytesRef> terms) : base(field)
 {
     this.outerInstance = outerInstance;
     this.terms         = terms;
     iter = Sort(terms).GetEnumerator();
 }