Exemplo n.º 1
0
            public FieldsReader(PerFieldDocValuesFormat outerInstance, SegmentReadState readState)
            {
                this.OuterInstance = outerInstance;

                // Read _X.per and init each format:
                bool success = false;

                try
                {
                    // Read field name -> format name
                    foreach (FieldInfo fi in readState.FieldInfos)
                    {
                        if (fi.HasDocValues())
                        {
                            string fieldName  = fi.Name;
                            string formatName = fi.GetAttribute(PER_FIELD_FORMAT_KEY);
                            if (formatName != null)
                            {
                                // null formatName means the field is in fieldInfos, but has no docvalues!
                                string suffix = fi.GetAttribute(PER_FIELD_SUFFIX_KEY);
                                Debug.Assert(suffix != null);
                                DocValuesFormat format        = DocValuesFormat.ForName(formatName);
                                string          segmentSuffix = GetFullSegmentSuffix(readState.SegmentSuffix, GetSuffix(formatName, suffix));
                                if (!Formats.ContainsKey(segmentSuffix))
                                {
                                    Formats[segmentSuffix] = format.FieldsProducer(new SegmentReadState(readState, segmentSuffix));
                                }
                                Fields[fieldName] = Formats[segmentSuffix];
                            }
                        }
                    }
                    success = true;
                }
                finally
                {
                    if (!success)
                    {
                        IOUtils.CloseWhileHandlingException(Formats.Values);
                    }
                }
            }
Exemplo n.º 2
0
            internal FieldsReader(PerFieldDocValuesFormat outerInstance, FieldsReader other)
            {
                this.OuterInstance = outerInstance;

                IDictionary <DocValuesProducer, DocValuesProducer> oldToNew = new HashMap <DocValuesProducer, DocValuesProducer>();

                // First clone all formats
                foreach (KeyValuePair <string, DocValuesProducer> ent in other.Formats)
                {
                    DocValuesProducer values = ent.Value;
                    Formats[ent.Key]    = values;
                    oldToNew[ent.Value] = values;
                }

                // Then rebuild fields:
                foreach (KeyValuePair <string, DocValuesProducer> ent in other.Fields)
                {
                    DocValuesProducer producer = oldToNew[ent.Value];
                    Debug.Assert(producer != null);
                    Fields[ent.Key] = producer;
                }
            }
Exemplo n.º 3
0
            internal FieldsReader(PerFieldDocValuesFormat outerInstance, FieldsReader other)
            {
                this.OuterInstance = outerInstance;

                IDictionary<DocValuesProducer, DocValuesProducer> oldToNew = new HashMap<DocValuesProducer, DocValuesProducer>();
                // First clone all formats
                foreach (KeyValuePair<string, DocValuesProducer> ent in other.Formats)
                {
                    DocValuesProducer values = ent.Value;
                    Formats[ent.Key] = values;
                    oldToNew[ent.Value] = values;
                }

                // Then rebuild fields:
                foreach (KeyValuePair<string, DocValuesProducer> ent in other.Fields)
                {
                    DocValuesProducer producer = oldToNew[ent.Value];
                    Debug.Assert(producer != null);
                    Fields[ent.Key] = producer;
                }
            }
Exemplo n.º 4
0
            public FieldsReader(PerFieldDocValuesFormat outerInstance, SegmentReadState readState)
            {
                this.OuterInstance = outerInstance;

                // Read _X.per and init each format:
                bool success = false;
                try
                {
                    // Read field name -> format name
                    foreach (FieldInfo fi in readState.FieldInfos)
                    {
                        if (fi.HasDocValues())
                        {
                            string fieldName = fi.Name;
                            string formatName = fi.GetAttribute(PER_FIELD_FORMAT_KEY);
                            if (formatName != null)
                            {
                                // null formatName means the field is in fieldInfos, but has no docvalues!
                                string suffix = fi.GetAttribute(PER_FIELD_SUFFIX_KEY);
                                Debug.Assert(suffix != null);
                                DocValuesFormat format = DocValuesFormat.ForName(formatName);
                                string segmentSuffix = GetFullSegmentSuffix(readState.SegmentSuffix, GetSuffix(formatName, suffix));
                                if (!Formats.ContainsKey(segmentSuffix))
                                {
                                    Formats[segmentSuffix] = format.FieldsProducer(new SegmentReadState(readState, segmentSuffix));
                                }
                                Fields[fieldName] = Formats[segmentSuffix];
                            }
                        }
                    }
                    success = true;
                }
                finally
                {
                    if (!success)
                    {
                        IOUtils.CloseWhileHandlingException(Formats.Values);
                    }
                }
            }
Exemplo n.º 5
0
 public FieldsWriter(PerFieldDocValuesFormat outerInstance, SegmentWriteState state)
 {
     this.OuterInstance = outerInstance;
     SegmentWriteState = state;
 }
Exemplo n.º 6
0
 public FieldsWriter(PerFieldDocValuesFormat outerInstance, SegmentWriteState state)
 {
     this.OuterInstance = outerInstance;
     SegmentWriteState  = state;
 }