Beispiel #1
0
 public AllScorer(Similarity similarity, IndexReader reader, FunctionWeight w)
     : base(similarity)
 {
     this.weight       = w;
     this.qWeight      = w.GetValue();
     this.reader       = reader;
     this.maxDoc       = reader.MaxDoc();
     this.hasDeletions = reader.HasDeletions();
     vals = ((FunctionQuery)w.GetQuery()).func.GetValues(reader);
 }
Beispiel #2
0
 public AllScorer(Similarity similarity, IndexReader reader, FunctionWeight w, IState state)
     : base(similarity)
 {
     this.weight       = w;
     this.qWeight      = w.Value;
     this.reader       = reader;
     this.maxDoc       = reader.MaxDoc;
     this.hasDeletions = reader.HasDeletions;
     vals = ((FunctionQuery)w.Query).func.GetValues(reader, state);
 }
 public override IBits GetDocsWithField(FieldInfo field)
 {
     if (field.DocValuesType == DocValuesType.SORTED_SET)
     {
         return(DocValues.DocsWithValue(GetSortedSet(field), maxDoc));
     }
     else
     {
         return(new Lucene.Net.Util.Bits.MatchAllBits(maxDoc));
     }
 }
            protected override SortedDocValues GetSortedDocValues(AtomicReaderContext context, string field)
            {
                SortedSetDocValues sortedSet = FieldCache.DEFAULT.GetDocTermOrds(context.AtomicReader, field);

                if (sortedSet.ValueCount >= int.MaxValue)
                {
                    throw new NotSupportedException("fields containing more than " + (int.MaxValue - 1) + " unique terms are unsupported");
                }

                SortedDocValues singleton = DocValues.UnwrapSingleton(sortedSet);

                if (singleton != null)
                {
                    // it's actually single-valued in practice, but indexed as multi-valued,
                    // so just sort on the underlying single-valued dv directly.
                    // regardless of selector type, this optimization is safe!
                    return(singleton);
                }
                else if (outerInstance.selector == Selector.MIN)
                {
                    return(new MinValue(sortedSet));
                }
                else
                {
                    if (sortedSet is RandomAccessOrds == false)
                    {
                        throw new NotSupportedException("codec does not support random access ordinals, cannot use selector: " + outerInstance.selector);
                    }
                    RandomAccessOrds randomOrds = (RandomAccessOrds)sortedSet;
                    switch (outerInstance.selector)
                    {
                    case Selector.MAX: return(new MaxValue(randomOrds));

                    case Selector.MIDDLE_MIN: return(new MiddleMinValue(randomOrds));

                    case Selector.MIDDLE_MAX: return(new MiddleMaxValue(randomOrds));

                    case Selector.MIN:
                    default:
                        if (Debugging.AssertsEnabled)
                        {
                            Debugging.Assert(false);
                        }
                        return(null);
                    }
                }
            }
        public override IBits GetDocsWithField(FieldInfo field)
        {
            switch (field.DocValuesType)
            {
            case DocValuesType.SORTED_SET:
                return(DocValues.DocsWithValue(GetSortedSet(field), maxDoc));

            case DocValuesType.SORTED:
                return(DocValues.DocsWithValue(GetSorted(field), maxDoc));

            case DocValuesType.BINARY:
                return(GetBinaryDocsWithField(field));

            case DocValuesType.NUMERIC:
                return(GetNumericDocsWithField(field));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public override IBits GetDocsWithField(FieldInfo field)
        {
            switch (field.DocValuesType)
            {
            case DocValuesType.SORTED_SET:
                return(DocValues.DocsWithValue(GetSortedSet(field), maxDoc));

            case DocValuesType.SORTED:
                return(DocValues.DocsWithValue(GetSorted(field), maxDoc));

            case DocValuesType.BINARY:
                return(GetBinaryDocsWithField(field));

            case DocValuesType.NUMERIC:
                return(GetNumericDocsWithField(field));

            default:
                throw AssertionError.Create();
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public util.Bits getDocsWithField(index.FieldInfo field) throws java.io.IOException
        public override Bits getDocsWithField(FieldInfo field)
        {
            switch (field.DocValuesType)
            {
            case SORTED_SET:
                return(DocValues.docsWithValue(getSortedSet(field), maxDoc));

            case SORTED:
                return(DocValues.docsWithValue(getSorted(field), maxDoc));

            case BINARY:
                return(getBinaryDocsWithField(field));

            case NUMERIC:
                return(getNumericDocsWithField(field));

            default:
                throw new AssertionError();
            }
        }
        public override IBits GetDocsWithField(FieldInfo field)
        {
            switch (field.DocValuesType)
            {
            case DocValuesType.SORTED_SET:
                return(DocValues.DocsWithValue(GetSortedSet(field), maxDoc));

            case DocValuesType.SORTED:
                return(DocValues.DocsWithValue(GetSorted(field), maxDoc));

            case DocValuesType.BINARY:
                BinaryEntry be = binaries[field.Number];
                return(GetMissingBits(field.Number, be.missingOffset, be.missingBytes));

            case DocValuesType.NUMERIC:
                NumericEntry ne = numerics[field.Number];
                return(GetMissingBits(field.Number, ne.missingOffset, ne.missingBytes));

            default:
                throw AssertionError.Create();
            }
        }
        public override Bits GetDocsWithField(FieldInfo field)
        {
            switch (field.DocValuesType)
            {
            case FieldInfo.DocValuesType_e.SORTED_SET:
                return(DocValues.DocsWithValue(GetSortedSet(field), maxDoc));

            case FieldInfo.DocValuesType_e.SORTED:
                return(DocValues.DocsWithValue(GetSorted(field), maxDoc));

            case FieldInfo.DocValuesType_e.BINARY:
                BinaryEntry be = binaries[field.Number];
                return(GetMissingBits(field.Number, be.missingOffset, be.missingBytes));

            case FieldInfo.DocValuesType_e.NUMERIC:
                NumericEntry ne = numerics[field.Number];
                return(GetMissingBits(field.Number, ne.missingOffset, ne.missingBytes));

            default:
                throw new System.ArgumentOutOfRangeException();
            }
        }
Beispiel #10
0
        public override Bits GetDocsWithField(FieldInfo field)
        {
            switch (field.DocValuesType)
            {
            case FieldInfo.DocValuesType_e.SORTED_SET:
                return(DocValues.DocsWithValue(GetSortedSet(field), maxDoc));

            case FieldInfo.DocValuesType_e.SORTED:
                return(DocValues.DocsWithValue(GetSorted(field), maxDoc));

            case FieldInfo.DocValuesType_e.BINARY:
                var be = binaries[field.Number];
                return(GetMissingBits(field.Number, be.missingOffset, be.missingBytes));

            case FieldInfo.DocValuesType_e.NUMERIC:
                var ne = numerics[field.Number];
                return(GetMissingBits(field.Number, ne.missingOffset, ne.missingBytes));

            default:
                throw new InvalidOperationException();
            }
        }
Beispiel #11
0
        public override IBits GetDocsWithField(FieldInfo field)
        {
            switch (field.DocValuesType)
            {
            case DocValuesType.SORTED_SET:
                return(DocValues.DocsWithValue(GetSortedSet(field), maxDoc));

            case DocValuesType.SORTED:
                return(DocValues.DocsWithValue(GetSorted(field), maxDoc));

            case DocValuesType.BINARY:
                BinaryEntry be = binaries[field.Number];
                return(GetMissingBits(be.missingOffset));

            case DocValuesType.NUMERIC:
                NumericEntry ne = numerics[field.Number];
                return(GetMissingBits(ne.missingOffset));

            default:
                throw new InvalidOperationException();
            }
        }
Beispiel #12
0
        public override SortedSetDocValues GetSortedSet(FieldInfo field)
        {
            SortedSetEntry ss = sortedSets[field.Number];

            if (ss.Format == Lucene45DocValuesConsumer.SORTED_SET_SINGLE_VALUED_SORTED)
            {
                SortedDocValues values = GetSorted(field);
                return(DocValues.Singleton(values));
            }
            else if (ss.Format != Lucene45DocValuesConsumer.SORTED_SET_WITH_ADDRESSES)
            {
                throw new Exception();
            }

            IndexInput data       = (IndexInput)this.data.Clone();
            long       valueCount = binaries[field.Number].Count;
            // we keep the byte[]s and list of ords on disk, these could be large
            Int64BinaryDocValues binary   = (Int64BinaryDocValues)GetBinary(field);
            Int64Values          ordinals = GetNumeric(ords[field.Number]);
            // but the addresses to the ord stream are in RAM
            MonotonicBlockPackedReader ordIndex = GetOrdIndexInstance(data, field, ordIndexes[field.Number]);

            return(new RandomAccessOrdsAnonymousInnerClassHelper(valueCount, binary, ordinals, ordIndex));
        }
Beispiel #13
0
 public ValueSourceFilteredDocIdSet(DocIdSet innerSet, DocValues values, ValueSourceFilter caller)
     : base(innerSet)
 {
     this.enclosingFilter = caller;
     this.values          = values;
 }
Beispiel #14
0
			public AllScorer(Similarity similarity, IndexReader reader, FunctionWeight w)
				: base(similarity)
			{
				this.weight = w;
				this.qWeight = w.Value;
				this.reader = reader;
				this.maxDoc = reader.MaxDoc;
				this.hasDeletions = reader.HasDeletions;
				vals = ((FunctionQuery)w.Query).func.GetValues(reader);
			}
 public CachingDoubleDocValue(int docBase, DocValues vals, Dictionary<int, double> cache)
 {
     this.docBase = docBase;
     this.values = vals;
     this.cache = cache;
 }
 public FloatDocValues(ReciprocalFloatFunction enclosingInstance, DocValues vals)
 {
     _enclosingInstance = enclosingInstance;
     this.vals          = vals;
 }
Beispiel #17
0
 public CachingDoubleDocValue(int docBase, DocValues vals, Dictionary <int, double> cache)
 {
     this.docBase = docBase;
     this.values  = vals;
     this.cache   = cache;
 }
 public FloatDocValues(ReciprocalFloatFunction enclosingInstance, DocValues vals)
 {
     _enclosingInstance = enclosingInstance;
     this.vals = vals;
 }
Beispiel #19
0
 public override SortedSetDocValues GetSortedSetDocValues(string field)
 {
     return(DocValues.emptySortedSet());
 }
Beispiel #20
0
 public override BinaryDocValues GetBinaryDocValues(string field)
 {
     return(DocValues.emptyBinary());
 }
Beispiel #21
0
 public override SortedNumericDocValues GetSortedNumericDocValues(string field)
 {
     return(DocValues.emptySortedNumeric(_elements.Length));
 }
 // constructor
 internal ValueSourceScorer(ValueSourceQuery enclosingInstance, Similarity similarity, IndexReader reader, ValueSourceWeight w)
     : base(similarity)
 {
     InitBlock(enclosingInstance);
     this.weight = w;
     this.qWeight = w.Value;
     // this is when/where the values are first created.
     vals = Enclosing_Instance.valSrc.GetValues(reader);
     termDocs = reader.TermDocs(null);
 }
Beispiel #23
0
 public override NumericDocValues GetNormValues(string field)
 {
     return(DocValues.emptyNumeric());
 }