Exemplo n.º 1
0
            public override SeekStatus SeekCeil(BytesRef text)
            {
                //System.out.println("te.seek text=" + field.name + ":" + text.utf8ToString() + " this=" + this);
                current = fstEnum.SeekCeil(text);
                if (current == null)
                {
                    return(SeekStatus.END);
                }
                else
                {
                    // System.out.println("  got term=" + current.input.utf8ToString());
                    // for(int i=0;i<current.output.length;i++) {
                    //   System.out.println("    " + Integer.toHexString(current.output.bytes[i]&0xFF));
                    // }

                    didDecode = false;

                    if (text.Equals(current.Input))
                    {
                        //System.out.println("  found!");
                        return(SeekStatus.FOUND);
                    }
                    else
                    {
                        //System.out.println("  not found: " + current.input.utf8ToString());
                        return(SeekStatus.NOT_FOUND);
                    }
                }
            }
Exemplo n.º 2
0
        public override SortedDocValues GetSorted(FieldInfo field)
        {
            FSTEntry   entry = Fsts[field.Number];
            FST <long> instance;

            lock (this)
            {
                instance = FstInstances[field.Number];
                if (instance == null)
                {
                    Data.Seek(entry.Offset);
                    instance = new FST <long>(Data, PositiveIntOutputs.Singleton);
                    RamBytesUsed_Renamed.AddAndGet(instance.SizeInBytes());
                    FstInstances[field.Number] = instance;
                }
            }
            NumericDocValues docToOrd = GetNumeric(field);
            FST <long>       fst      = instance;

            // per-thread resources
            FST <long> .BytesReader @in      = fst.BytesReader;
            FST <long> .Arc <long>  firstArc = new FST <long> .Arc <long>();

            FST <long> .Arc <long> scratchArc = new FST <long> .Arc <long>();

            IntsRef scratchInts            = new IntsRef();
            BytesRefFSTEnum <long> fstEnum = new BytesRefFSTEnum <long>(fst);

            return(new SortedDocValuesAnonymousInnerClassHelper(this, entry, docToOrd, fst, @in, firstArc, scratchArc, scratchInts, fstEnum));
        }
Exemplo n.º 3
0
 public SimpleTextTermsEnum(SimpleTextFieldsReader outerInstance,
                            FST <PairOutputs <long?, PairOutputs <long?, long?> .Pair> .Pair> fst, IndexOptions indexOptions)
 {
     _outerInstance = outerInstance;
     _indexOptions  = indexOptions;
     _fstEnum       = new BytesRefFSTEnum <PairOutputs <long?, PairOutputs <long?, long?> .Pair> .Pair>(fst);
 }
Exemplo n.º 4
0
 internal SegmentTermsEnum(FSTOrdTermsReader.TermsReader outerInstance) : base(outerInstance)
 {
     this.outerInstance = outerInstance;
     this.fstEnum       = new BytesRefFSTEnum <long>(outerInstance.index);
     this.decoded       = false;
     this.seekPending   = false;
 }
Exemplo n.º 5
0
 public SimpleTextTermsEnum(SimpleTextFieldsReader outerInstance,
                            FST <PairOutputs.Pair <long?, PairOutputs.Pair <long?, long?> > > fst, FieldInfo.IndexOptions indexOptions)
 {
     this.outerInstance = outerInstance;
     this.indexOptions  = indexOptions;
     fstEnum            = new BytesRefFSTEnum <>(fst);
 }
        public override SortedDocValues GetSorted(FieldInfo field)
        {
            FSTEntry    entry = fsts[field.Number];
            FST <long?> instance;

            lock (this)
            {
                if (!fstInstances.TryGetValue(field.Number, out instance) || instance == null)
                {
                    data.Seek(entry.Offset);
                    instance = new FST <long?>(data, PositiveInt32Outputs.Singleton);
                    ramBytesUsed.AddAndGet(instance.GetSizeInBytes());
                    fstInstances[field.Number] = instance;
                }
            }
            var docToOrd = GetNumeric(field);
            var fst      = instance;

            // per-thread resources
            var @in         = fst.GetBytesReader();
            var firstArc    = new FST.Arc <long?>();
            var scratchArc  = new FST.Arc <long?>();
            var scratchInts = new Int32sRef();
            var fstEnum     = new BytesRefFSTEnum <long?>(fst);

            return(new SortedDocValuesAnonymousInnerClassHelper(entry, docToOrd, fst, @in, firstArc, scratchArc, scratchInts, fstEnum));
        }
        public override SortedSetDocValues GetSortedSet(FieldInfo field)
        {
            FSTEntry entry = fsts[field.Number];

            if (entry.NumOrds == 0)
            {
                return(DocValues.EMPTY_SORTED_SET); // empty FST!
            }
            FST <long?> instance;

            lock (this)
            {
                if (!fstInstances.TryGetValue(field.Number, out instance) || instance == null)
                {
                    data.Seek(entry.Offset);
                    instance = new FST <long?>(data, PositiveInt32Outputs.Singleton);
                    ramBytesUsed.AddAndGet(instance.GetSizeInBytes());
                    fstInstances[field.Number] = instance;
                }
            }
            BinaryDocValues docToOrds = GetBinary(field);
            FST <long?>     fst       = instance;

            // per-thread resources
            var @in         = fst.GetBytesReader();
            var firstArc    = new FST.Arc <long?>();
            var scratchArc  = new FST.Arc <long?>();
            var scratchInts = new Int32sRef();
            var fstEnum     = new BytesRefFSTEnum <long?>(fst);
            var @ref        = new BytesRef();
            var input       = new ByteArrayDataInput();

            return(new SortedSetDocValuesAnonymousInnerClassHelper(entry, docToOrds, fst, @in, firstArc, scratchArc, scratchInts, fstEnum, @ref, input));
        }
Exemplo n.º 8
0
 public override bool SeekExact(BytesRef text)
 {
     //System.out.println("te.seekExact text=" + field.name + ":" + text.utf8ToString() + " this=" + this);
     current   = fstEnum.SeekExact(text);
     didDecode = false;
     return(current != null);
 }
Exemplo n.º 9
0
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: SegmentTermsEnum() throws java.io.IOException
 internal SegmentTermsEnum(FSTTermsReader.TermsReader outerInstance) : base(outerInstance)
 {
     this.outerInstance = outerInstance;
     this.fstEnum       = new BytesRefFSTEnum <FSTTermOutputs.TermData>(outerInstance.dict);
     this.decoded       = false;
     this.seekPending   = false;
     this.meta          = null;
 }
 public SortedDocValuesAnonymousInnerClassHelper(FSTEntry entry, NumericDocValues docToOrd, FST <long?> fst, FST.BytesReader @in, FST.Arc <long?> firstArc, FST.Arc <long?> scratchArc, Int32sRef scratchInts, BytesRefFSTEnum <long?> fstEnum)
 {
     this.entry       = entry;
     this.docToOrd    = docToOrd;
     this.fst         = fst;
     this.@in         = @in;
     this.firstArc    = firstArc;
     this.scratchArc  = scratchArc;
     this.scratchInts = scratchInts;
     this.fstEnum     = fstEnum;
 }
Exemplo n.º 11
0
 public SortedDocValuesAnonymousInnerClassHelper(Lucene42DocValuesProducer outerInstance, FSTEntry entry, NumericDocValues docToOrd, FST <long> fst, FST <long> .BytesReader @in, FST <long> .Arc <long> firstArc, FST <long> .Arc <long> scratchArc, IntsRef scratchInts, BytesRefFSTEnum <long> fstEnum)
 {
     this.OuterInstance = outerInstance;
     this.Entry         = entry;
     this.DocToOrd      = docToOrd;
     this.Fst           = fst;
     this.@in           = @in;
     this.FirstArc      = firstArc;
     this.ScratchArc    = scratchArc;
     this.ScratchInts   = scratchInts;
     this.FstEnum       = fstEnum;
 }
Exemplo n.º 12
0
 public override BytesRef Next()
 {
     //System.out.println("te.next");
     current = fstEnum.Next();
     if (current == null)
     {
         //System.out.println("  END");
         return(null);
     }
     didDecode = false;
     //System.out.println("  term=" + field.name + ":" + current.input.utf8ToString());
     return(current.Input);
 }
Exemplo n.º 13
0
 public SortedDocValuesAnonymousInnerClassHelper(FSTEntry fstEntry,
                                                 NumericDocValues numericDocValues, FST <long?> fst1, FST.BytesReader @in, FST.Arc <long?> arc, FST.Arc <long?> scratchArc1,
                                                 Int32sRef intsRef, BytesRefFSTEnum <long?> bytesRefFstEnum)
 {
     entry       = fstEntry;
     docToOrd    = numericDocValues;
     fst         = fst1;
     this.@in    = @in;
     firstArc    = arc;
     scratchArc  = scratchArc1;
     scratchInts = intsRef;
     fstEnum     = bytesRefFstEnum;
 }
 public SortedSetDocValuesAnonymousInnerClassHelper(FSTEntry entry, BinaryDocValues docToOrds, FST <long?> fst, FST.BytesReader @in, FST.Arc <long?> firstArc, FST.Arc <long?> scratchArc, Int32sRef scratchInts, BytesRefFSTEnum <long?> fstEnum, BytesRef @ref, ByteArrayDataInput input)
 {
     this.entry       = entry;
     this.docToOrds   = docToOrds;
     this.fst         = fst;
     this.@in         = @in;
     this.firstArc    = firstArc;
     this.scratchArc  = scratchArc;
     this.scratchInts = scratchInts;
     this.fstEnum     = fstEnum;
     this.@ref        = @ref;
     this.input       = input;
 }
Exemplo n.º 15
0
 public SortedSetDocValuesAnonymousInnerClassHelper(Lucene42DocValuesProducer outerInstance, FSTEntry entry, BinaryDocValues docToOrds, FST <long> fst, FST <long> .BytesReader @in, FST <long> .Arc <long> firstArc, FST <long> .Arc <long> scratchArc, IntsRef scratchInts, BytesRefFSTEnum <long> fstEnum, BytesRef @ref, ByteArrayDataInput input)
 {
     this.OuterInstance = outerInstance;
     this.Entry         = entry;
     this.DocToOrds     = docToOrds;
     this.Fst           = fst;
     this.@in           = @in;
     this.FirstArc      = firstArc;
     this.ScratchArc    = scratchArc;
     this.ScratchInts   = scratchInts;
     this.FstEnum       = fstEnum;
     this.@ref          = @ref;
     this.Input         = input;
 }
Exemplo n.º 16
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public index.SortedDocValues getSorted(index.FieldInfo field) throws java.io.IOException
        public override SortedDocValues getSorted(FieldInfo field)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final FSTEntry entry = fsts.get(field.number);
            FSTEntry entry = fsts[field.number];

            if (entry.numOrds == 0)
            {
                return(DocValues.EMPTY_SORTED);
            }
            FST <long?> instance;

            lock (this)
            {
                instance = fstInstances[field.number];
                if (instance == null)
                {
                    data.seek(entry.offset);
                    instance = new FST <>(data, PositiveIntOutputs.Singleton);
                    ramBytesUsed_Renamed.addAndGet(instance.sizeInBytes());
                    fstInstances[field.number] = instance;
                }
            }
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final index.NumericDocValues docToOrd = getNumeric(field);
            NumericDocValues docToOrd = getNumeric(field);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final util.fst.FST<Long> fst = instance;
            FST <long?> fst = instance;

            // per-thread resources
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final util.fst.FST.BytesReader in = fst.getBytesReader();
            FST.BytesReader @in = fst.BytesReader;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final util.fst.FST.Arc<Long> firstArc = new util.fst.FST.Arc<>();
            FST.Arc <long?> firstArc = new FST.Arc <long?>();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final util.fst.FST.Arc<Long> scratchArc = new util.fst.FST.Arc<>();
            FST.Arc <long?> scratchArc = new FST.Arc <long?>();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final util.IntsRef scratchInts = new util.IntsRef();
            IntsRef scratchInts = new IntsRef();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final util.fst.BytesRefFSTEnum<Long> fstEnum = new util.fst.BytesRefFSTEnum<>(fst);
            BytesRefFSTEnum <long?> fstEnum = new BytesRefFSTEnum <long?>(fst);

            return(new SortedDocValuesAnonymousInnerClassHelper(this, entry, docToOrd, fst, @in, firstArc, scratchArc,
                                                                scratchInts, fstEnum));
        }
Exemplo n.º 17
0
 // Update current enum according to FSTEnum
 private void UpdateEnum(BytesRefFSTEnum<long?>.InputOutput<long?> pair)
 {
     if (pair == null)
     {
         term = null;
     }
     else
     {
         term = pair.Input;
         ord = pair.Output.Value;
         DecodeStats();
     }
     decoded = false;
     seekPending = false;
 }
Exemplo n.º 18
0
 public SortedSetDocValuesAnonymousInnerClassHelper(FSTEntry fstEntry, BinaryDocValues binaryDocValues, FST <long?> fst1,
                                                    FST.BytesReader @in, FST.Arc <long?> arc, FST.Arc <long?> scratchArc1, Int32sRef intsRef, BytesRefFSTEnum <long?> bytesRefFstEnum,
                                                    BytesRef @ref, ByteArrayDataInput byteArrayDataInput)
 {
     entry       = fstEntry;
     docToOrds   = binaryDocValues;
     fst         = fst1;
     this.@in    = @in;
     firstArc    = arc;
     scratchArc  = scratchArc1;
     scratchInts = intsRef;
     fstEnum     = bytesRefFstEnum;
     this.@ref   = @ref;
     input       = byteArrayDataInput;
 }
Exemplo n.º 19
0
 // Update current enum according to FSTEnum
 internal void UpdateEnum(BytesRefFSTEnum <FSTTermOutputs.TermData> .InputOutput <FSTTermOutputs.TermData> pair)
 {
     if (pair == null)
     {
         term_Renamed = null;
     }
     else
     {
         term_Renamed        = pair.Input;
         meta                = pair.Output;
         state.DocFreq       = meta.DOC_FREQ;
         state.TotalTermFreq = meta.TOTAL_TERM_FREQ;
     }
     decoded     = false;
     seekPending = false;
 }
Exemplo n.º 20
0
            private void LoadTermsIndex()
            {
                if (Fst != null)
                {
                    return;
                }

                var clone = (IndexInput)_vgtir._input.Clone();

                clone.Seek(_indexStart);
                Fst = new FST <long?>(clone, _vgtir._fstOutputs);
                clone.Dispose();

                /*
                 * final String dotFileName = segment + "_" + fieldInfo.name + ".dot";
                 * Writer w = new OutputStreamWriter(new FileOutputStream(dotFileName));
                 * Util.toDot(fst, w, false, false);
                 * System.out.println("FST INDEX: SAVED to " + dotFileName);
                 * w.close();
                 */

                if (_vgtir._indexDivisor > 1)
                {
                    // subsample
                    var scratchIntsRef = new IntsRef();
                    var outputs        = PositiveIntOutputs.Singleton;
                    var builder        = new Builder <long?>(FST.INPUT_TYPE.BYTE1, outputs);
                    var fstEnum        = new BytesRefFSTEnum <long?>(Fst);
                    var count          = _vgtir._indexDivisor;

                    BytesRefFSTEnum.InputOutput <long?> result;
                    while ((result = fstEnum.Next()) != null)
                    {
                        if (count == _vgtir._indexDivisor)
                        {
                            builder.Add(Util.ToIntsRef(result.Input, scratchIntsRef), result.Output);
                            count = 0;
                        }
                        count++;
                    }
                    Fst = builder.Finish();
                }
            }
Exemplo n.º 21
0
            private void LoadTermsIndex()
            {
                if (fst == null)
                {
                    using (IndexInput clone = (IndexInput)outerInstance.input.Clone())
                    {
                        clone.Seek(indexStart);
                        fst = new FST <long?>(clone, outerInstance.fstOutputs);
                    } // clone.Dispose();

                    /*
                     * final String dotFileName = segment + "_" + fieldInfo.name + ".dot";
                     * Writer w = new OutputStreamWriter(new FileOutputStream(dotFileName));
                     * Util.toDot(fst, w, false, false);
                     * System.out.println("FST INDEX: SAVED to " + dotFileName);
                     * w.close();
                     */

                    if (outerInstance.indexDivisor > 1)
                    {
                        // subsample
                        Int32sRef                           scratchIntsRef = new Int32sRef();
                        PositiveInt32Outputs                outputs        = PositiveInt32Outputs.Singleton;
                        Builder <long?>                     builder        = new Builder <long?>(FST.INPUT_TYPE.BYTE1, outputs);
                        BytesRefFSTEnum <long?>             fstEnum        = new BytesRefFSTEnum <long?>(fst);
                        BytesRefFSTEnum.InputOutput <long?> result;
                        int count = outerInstance.indexDivisor;
                        while (fstEnum.MoveNext())
                        {
                            result = fstEnum.Current;
                            if (count == outerInstance.indexDivisor)
                            {
                                builder.Add(Util.Fst.Util.ToInt32sRef(result.Input, scratchIntsRef), result.Output);
                                count = 0;
                            }
                            count++;
                        }
                        fst = builder.Finish();
                    }
                }
            }
Exemplo n.º 22
0
        public override SortedSetDocValues GetSortedSet(FieldInfo field)
        {
            var entry = fsts[field.Number];

            if (entry.numOrds == 0)
            {
                return(DocValues.EMPTY_SORTED_SET); // empty FST!
            }
            FST <Int64> instance;

            UninterruptableMonitor.Enter(this);
            try
            {
                if (!fstInstances.TryGetValue(field.Number, out instance))
                {
                    data.Seek(entry.offset);
                    instance = new FST <Int64>(data, PositiveInt32Outputs.Singleton);
                    ramBytesUsed.AddAndGet(instance.GetSizeInBytes());
                    fstInstances[field.Number] = instance;
                }
            }
            finally
            {
                UninterruptableMonitor.Exit(this);
            }
            var docToOrds = GetBinary(field);
            var fst       = instance;

            // per-thread resources
            var @in         = fst.GetBytesReader();
            var firstArc    = new FST.Arc <Int64>();
            var scratchArc  = new FST.Arc <Int64>();
            var scratchInts = new Int32sRef();
            var fstEnum     = new BytesRefFSTEnum <Int64>(fst);
            var @ref        = new BytesRef();
            var input       = new ByteArrayDataInput();

            return(new SortedSetDocValuesAnonymousClass(entry, docToOrds, fst, @in, firstArc,
                                                        scratchArc, scratchInts, fstEnum, @ref, input));
        }
Exemplo n.º 23
0
        public override SortedDocValues GetSorted(FieldInfo field)
        {
            FSTEntry entry = fsts[field.Number];

            if (entry.numOrds == 0)
            {
                return(DocValues.EMPTY_SORTED);
            }
            FST <long?> instance;

            UninterruptableMonitor.Enter(this);
            try
            {
                if (!fstInstances.TryGetValue(field.Number, out instance))
                {
                    data.Seek(entry.offset);
                    instance = new FST <long?>(data, PositiveInt32Outputs.Singleton);
                    ramBytesUsed.AddAndGet(instance.GetSizeInBytes());
                    fstInstances[field.Number] = instance;
                }
            }
            finally
            {
                UninterruptableMonitor.Exit(this);
            }
            var docToOrd = GetNumeric(field);
            var fst      = instance;

            // per-thread resources
            var @in         = fst.GetBytesReader();
            var firstArc    = new FST.Arc <long?>();
            var scratchArc  = new FST.Arc <long?>();
            var scratchInts = new Int32sRef();
            var fstEnum     = new BytesRefFSTEnum <long?>(fst);

            return(new SortedDocValuesAnonymousClass(entry, docToOrd, fst, @in, firstArc, scratchArc,
                                                     scratchInts, fstEnum));
        }
Exemplo n.º 24
0
 public override int LookupTerm(BytesRef key)
 {
     try
     {
         BytesRefFSTEnum <long?> .InputOutput <long?> o = FstEnum.SeekCeil(key);
         if (o == null)
         {
             return(-ValueCount - 1);
         }
         else if (o.Input.Equals(key))
         {
             return((int)o.Output);
         }
         else
         {
             return((int)-o.Output - 1);
         }
     }
     catch (System.IO.IOException bogus)
     {
         throw bogus;
     }
 }
Exemplo n.º 25
0
        public override SortedSetDocValues GetSortedSet(FieldInfo field)
        {
            FSTEntry entry = Fsts[field.Number];

            if (entry.NumOrds == 0)
            {
                return(DocValues.EMPTY_SORTED_SET); // empty FST!
            }
            FST <long> instance;

            lock (this)
            {
                instance = FstInstances[field.Number];
                if (instance == null)
                {
                    Data.Seek(entry.Offset);
                    instance = new FST <long>((DataInput)Data, Lucene.Net.Util.Fst.PositiveIntOutputs.Singleton);
                    RamBytesUsed_Renamed.AddAndGet(instance.SizeInBytes());
                    FstInstances[field.Number] = instance;
                }
            }
            BinaryDocValues docToOrds = GetBinary(field);
            FST <long>      fst       = instance;

            // per-thread resources
            FST <long> .BytesReader @in      = fst.BytesReader;
            FST <long> .Arc <long>  firstArc = new FST <long> .Arc <long>();

            FST <long> .Arc <long> scratchArc = new FST <long> .Arc <long>();

            IntsRef scratchInts            = new IntsRef();
            BytesRefFSTEnum <long> fstEnum = new BytesRefFSTEnum <long>(fst);
            BytesRef           @ref        = new BytesRef();
            ByteArrayDataInput input       = new ByteArrayDataInput();

            return(new SortedSetDocValuesAnonymousInnerClassHelper(this, entry, docToOrds, fst, @in, firstArc, scratchArc, scratchInts, fstEnum, @ref, input));
        }
 public IndexEnum(FST<long?> fst)
 {
     _fstEnum = new BytesRefFSTEnum<long?>(fst);
 }
            private void LoadTermsIndex()
            {
                if (Fst != null) return;

                var clone = (IndexInput) _vgtir._input.Clone();
                clone.Seek(_indexStart);
                Fst = new FST<long?>(clone, _vgtir._fstOutputs);
                clone.Dispose();

                /*
                final String dotFileName = segment + "_" + fieldInfo.name + ".dot";
                Writer w = new OutputStreamWriter(new FileOutputStream(dotFileName));
                Util.toDot(fst, w, false, false);
                System.out.println("FST INDEX: SAVED to " + dotFileName);
                w.close();
                */

                if (_vgtir._indexDivisor > 1)
                {
                    // subsample
                    var scratchIntsRef = new IntsRef();
                    var outputs = PositiveIntOutputs.Singleton;
                    var builder = new Builder<long?>(FST.INPUT_TYPE.BYTE1, outputs);
                    var fstEnum = new BytesRefFSTEnum<long?>(Fst);
                    var count = _vgtir._indexDivisor;
                        
                    BytesRefFSTEnum<long?>.InputOutput<long?> result;
                    while ((result = fstEnum.Next()) != null)
                    {
                        if (count == _vgtir._indexDivisor)
                        {
                            builder.Add(Util.ToIntsRef(result.Input, scratchIntsRef), result.Output);
                            count = 0;
                        }
                        count++;
                    }
                    Fst = builder.Finish();
                }
            }
        public override SortedDocValues GetSorted(FieldInfo field)
        {
            FSTEntry entry = Fsts[field.Number];
            FST<long> instance;
            lock (this)
            {
                if (!FstInstances.TryGetValue(field.Number, out instance))
                {
                    Data.Seek(entry.Offset);
                    instance = new FST<long>(Data, PositiveIntOutputs.Singleton);
                    RamBytesUsed_Renamed.AddAndGet(instance.SizeInBytes());
                    FstInstances[field.Number] = instance;
                }
            }
            NumericDocValues docToOrd = GetNumeric(field);
            FST<long> fst = instance;

            // per-thread resources
            FST<long>.BytesReader @in = fst.BytesReader;
            FST<long>.Arc<long> firstArc = new FST<long>.Arc<long>();
            FST<long>.Arc<long> scratchArc = new FST<long>.Arc<long>();
            IntsRef scratchInts = new IntsRef();
            BytesRefFSTEnum<long> fstEnum = new BytesRefFSTEnum<long>(fst);

            return new SortedDocValuesAnonymousInnerClassHelper(this, entry, docToOrd, fst, @in, firstArc, scratchArc, scratchInts, fstEnum);
        }
Exemplo n.º 29
0
 public override bool SeekExact(BytesRef text)
 {
     //System.out.println("te.seekExact text=" + field.name + ":" + text.utf8ToString() + " this=" + this);
     current = fstEnum.SeekExact(text);
     didDecode = false;
     return current != null;
 }
 public SortedDocValuesAnonymousInnerClassHelper(Lucene42DocValuesProducer outerInstance, FSTEntry entry, NumericDocValues docToOrd, FST<long> fst, FST<long>.BytesReader @in, FST<long>.Arc<long> firstArc, FST<long>.Arc<long> scratchArc, IntsRef scratchInts, BytesRefFSTEnum<long> fstEnum)
 {
     this.OuterInstance = outerInstance;
     this.Entry = entry;
     this.DocToOrd = docToOrd;
     this.Fst = fst;
     this.@in = @in;
     this.FirstArc = firstArc;
     this.ScratchArc = scratchArc;
     this.ScratchInts = scratchInts;
     this.FstEnum = fstEnum;
 }
Exemplo n.º 31
0
 public SortedDocValuesAnonymousInnerClassHelper(FSTEntry fstEntry,
     NumericDocValues numericDocValues, FST<long?> fst1, FST.BytesReader @in, FST.Arc<long?> arc, FST.Arc<long?> scratchArc1,
     IntsRef intsRef, BytesRefFSTEnum<long?> bytesRefFstEnum)
 {
     entry = fstEntry;
     docToOrd = numericDocValues;
     fst = fst1;
     this.@in = @in;
     firstArc = arc;
     scratchArc = scratchArc1;
     scratchInts = intsRef;
     fstEnum = bytesRefFstEnum;
 }
Exemplo n.º 32
0
 public SimpleTextTermsEnum(SimpleTextFieldsReader outerInstance,
     FST<PairOutputs<long?, PairOutputs<long?,long?>.Pair>.Pair> fst, IndexOptions indexOptions)
 {
     _outerInstance = outerInstance;
     _indexOptions = indexOptions;
     _fstEnum = new BytesRefFSTEnum<PairOutputs<long?, PairOutputs<long?,long?>.Pair>.Pair>(fst);
 }
 public SortedSetDocValuesAnonymousInnerClassHelper(Lucene42DocValuesProducer outerInstance, FSTEntry entry, BinaryDocValues docToOrds, FST<long> fst, FST<long>.BytesReader @in, FST<long>.Arc<long> firstArc, FST<long>.Arc<long> scratchArc, IntsRef scratchInts, BytesRefFSTEnum<long> fstEnum, BytesRef @ref, ByteArrayDataInput input)
 {
     this.OuterInstance = outerInstance;
     this.Entry = entry;
     this.DocToOrds = docToOrds;
     this.Fst = fst;
     this.@in = @in;
     this.FirstArc = firstArc;
     this.ScratchArc = scratchArc;
     this.ScratchInts = scratchInts;
     this.FstEnum = fstEnum;
     this.@ref = @ref;
     this.Input = input;
 }
        public override SortedSetDocValues GetSortedSet(FieldInfo field)
        {
            FSTEntry entry = Fsts[field.Number];
            if (entry.NumOrds == 0)
            {
                return DocValues.EMPTY_SORTED_SET; // empty FST!
            }
            FST<long> instance;
            lock (this)
            {
                if (!FstInstances.TryGetValue(field.Number, out instance))
                {
                    Data.Seek(entry.Offset);
                    instance = new FST<long>((DataInput)Data, Lucene.Net.Util.Fst.PositiveIntOutputs.Singleton);
                    RamBytesUsed_Renamed.AddAndGet(instance.SizeInBytes());
                    FstInstances[field.Number] = instance;
                }
            }
            BinaryDocValues docToOrds = GetBinary(field);
            FST<long> fst = instance;

            // per-thread resources
            FST<long>.BytesReader @in = fst.BytesReader;
            FST<long>.Arc<long> firstArc = new FST<long>.Arc<long>();
            FST<long>.Arc<long> scratchArc = new FST<long>.Arc<long>();
            IntsRef scratchInts = new IntsRef();
            BytesRefFSTEnum<long> fstEnum = new BytesRefFSTEnum<long>(fst);
            BytesRef @ref = new BytesRef();
            ByteArrayDataInput input = new ByteArrayDataInput();
            return new SortedSetDocValuesAnonymousInnerClassHelper(this, entry, docToOrds, fst, @in, firstArc, scratchArc, scratchInts, fstEnum, @ref, input);
        }
 internal FSTTermsEnum(FST<long> fst)
 {
     this.Fst = fst;
     @in = new BytesRefFSTEnum<long>(fst);
     BytesReader = fst.BytesReader;
 }
 public override long Next()
 {
     //System.out.println("VGR: next field=" + fieldInfo.name);
     current = fstEnum.Next();
     if (current == null)
     {
         //System.out.println("  eof");
         return -1;
     }
     else
     {
         return current.Output;
     }
 }
 public override long Seek(BytesRef target)
 {
     //System.out.println("VGR: seek field=" + fieldInfo.name + " target=" + target);
     current = fstEnum.SeekFloor(target);
     //System.out.println("  got input=" + current.input + " output=" + current.output);
     return current.Output;
 }
 public override long? Seek(BytesRef target)
 {
     _current = _fstEnum.SeekFloor(target);
     return _current.Output;
 }
Exemplo n.º 39
0
            public override SeekStatus SeekCeil(BytesRef text)
            {
                //System.out.println("te.seek text=" + field.name + ":" + text.utf8ToString() + " this=" + this);
                current = fstEnum.SeekCeil(text);
                if (current == null)
                {
                    return SeekStatus.END;
                }
                else
                {

                    // System.out.println("  got term=" + current.input.utf8ToString());
                    // for(int i=0;i<current.output.length;i++) {
                    //   System.out.println("    " + Integer.toHexString(current.output.bytes[i]&0xFF));
                    // }

                    didDecode = false;

                    if (text.Equals(current.Input))
                    {
                        //System.out.println("  found!");
                        return SeekStatus.FOUND;
                    }
                    else
                    {
                        //System.out.println("  not found: " + current.input.utf8ToString());
                        return SeekStatus.NOT_FOUND;
                    }
                }
            }
Exemplo n.º 40
0
 internal FSTTermsEnum(FST<long?> fst)
 {
     this.fst = fst;
     input = new BytesRefFSTEnum<long?>(fst);
     bytesReader = fst.BytesReader;
 }
Exemplo n.º 41
0
 internal FSTTermsEnum(FST <Int64> fst)
 {
     this.fst    = fst;
     input       = new BytesRefFSTEnum <Int64>(fst);
     bytesReader = fst.GetBytesReader();
 }
Exemplo n.º 42
0
 public SortedSetDocValuesAnonymousInnerClassHelper(FSTEntry fstEntry, BinaryDocValues binaryDocValues, FST<long?> fst1,
     FST.BytesReader @in, FST.Arc<long?> arc, FST.Arc<long?> scratchArc1, IntsRef intsRef, BytesRefFSTEnum<long?> bytesRefFstEnum,
     BytesRef @ref, ByteArrayDataInput byteArrayDataInput)
 {
     entry = fstEntry;
     docToOrds = binaryDocValues;
     fst = fst1;
     this.@in = @in;
     firstArc = arc;
     scratchArc = scratchArc1;
     scratchInts = intsRef;
     fstEnum = bytesRefFstEnum;
     this.@ref = @ref;
     input = byteArrayDataInput;
 }
 public IndexEnum(FST <long?> fst)
 {
     fstEnum = new BytesRefFSTEnum <long?>(fst);
 }
Exemplo n.º 44
0
        public override SortedSetDocValues GetSortedSet(FieldInfo field)
        {
            var entry = fsts[field.Number];
            if (entry.numOrds == 0)
            {
                return DocValues.EMPTY_SORTED_SET; // empty FST!
            }
            FST<long?> instance;
            lock (this)
            {
                instance = fstInstances[field.Number];
                if (instance == null)
                {
                    data.Seek(entry.offset);
                    instance = new FST<long?>(data, PositiveIntOutputs.Singleton);
                    ramBytesUsed.AddAndGet(instance.SizeInBytes());
                    fstInstances[field.Number] = instance;
                }
            }
            var docToOrds = GetBinary(field);
            var fst = instance;

            // per-thread resources
            var @in = fst.BytesReader;
            var firstArc = new FST.Arc<long?>();
            var scratchArc = new FST.Arc<long?>();
            var scratchInts = new IntsRef();
            var fstEnum = new BytesRefFSTEnum<long?>(fst);
            var @ref = new BytesRef();
            var input = new ByteArrayDataInput();
            return new SortedSetDocValuesAnonymousInnerClassHelper(entry, docToOrds, fst, @in, firstArc,
                scratchArc, scratchInts, fstEnum, @ref, input);
        }
Exemplo n.º 45
0
		public FSTTermsEnum(FieldInfo field, FST<BytesRef> fst)
		{
		  this.field = field;
		  fstEnum = new BytesRefFSTEnum<>(fst);
		}
Exemplo n.º 46
0
 public override BytesRef Next()
 {
     //System.out.println("te.next");
     current = fstEnum.Next();
     if (current == null)
     {
         //System.out.println("  END");
         return null;
     }
     didDecode = false;
     //System.out.println("  term=" + field.name + ":" + current.input.utf8ToString());
     return current.Input;
 }
Exemplo n.º 47
0
 internal FSTTermsEnum(FST <long?> fst)
 {
     this.Fst    = fst;
     @in         = new BytesRefFSTEnum <long?>(fst);
     BytesReader = fst.BytesReader;
 }
 internal FSTTermsEnum(FST <long?> fst)
 {
     this.fst    = fst;
     @in         = new BytesRefFSTEnum <long?>(fst);
     bytesReader = fst.GetBytesReader();
 }
 public SortedDocValuesAnonymousInnerClassHelper(FSTEntry entry, NumericDocValues docToOrd, FST<long?> fst, FST<long?>.BytesReader @in, FST<long?>.Arc<long?> firstArc, FST<long?>.Arc<long?> scratchArc, IntsRef scratchInts, BytesRefFSTEnum<long?> fstEnum)
 {
     this.Entry = entry;
     this.DocToOrd = docToOrd;
     this.Fst = fst;
     this.@in = @in;
     this.FirstArc = firstArc;
     this.ScratchArc = scratchArc;
     this.ScratchInts = scratchInts;
     this.FstEnum = fstEnum;
 }
Exemplo n.º 50
0
 public FSTTermsEnum(FieldInfo field, FST <BytesRef> fst)
 {
     this.field = field;
     fstEnum    = new BytesRefFSTEnum <BytesRef>(fst);
 }
            private void loadTermsIndex()
            {
                if (Fst == null)
                {
                    IndexInput clone = input.Clone();
                    clone.Seek(indexStart);
                    Fst = new FST<>(clone, fstOutputs);
                    clone.Close();

                    /*
        final String dotFileName = segment + "_" + fieldInfo.name + ".dot";
        Writer w = new OutputStreamWriter(new FileOutputStream(dotFileName));
        Util.toDot(fst, w, false, false);
        System.out.println("FST INDEX: SAVED to " + dotFileName);
        w.close();
        */

                    if (indexDivisor > 1)
                    {
                        // subsample
                        IntsRef scratchIntsRef = new IntsRef();
                        PositiveIntOutputs outputs = PositiveIntOutputs.GetSingleton();
                        Builder<long> builder = new Builder<long>(FST.INPUT_TYPE.BYTE1, outputs);
                        BytesRefFSTEnum<long> fstEnum = new BytesRefFSTEnum<long>(fst);
                        BytesRefFSTEnum.InputOutput<long> result;
                        int count = indexDivisor;
                        while ((result = fstEnum.Next()) != null)
                        {
                            if (count == indexDivisor)
                            {
                                builder.Add(Util.ToIntsRef(result.Input, scratchIntsRef), result.Output);
                                count = 0;
                            }
                            count++;
                        }
                        Fst = builder.Finish();
                    }
                }
            }