19 using System.Collections.Generic;
20 using Lucene.Net.Support;
22 namespace Lucene.Net.Index
35 private SortedSet<TermVectorEntry> currentSet;
36 private IDictionary<string, TermVectorEntry> termToTVE =
new HashMap<string, TermVectorEntry>();
37 private bool storeOffsets;
38 private bool storePositions;
40 public const System.String ALL =
"_ALL_";
46 : this(false, false, comparator)
52 : base(ignoringPositions, ignoringOffsets)
54 currentSet =
new SortedSet<TermVectorEntry>(comparator);
67 public override void Map(System.String term,
int frequency,
TermVectorOffsetInfo[] offsets,
int[] positions)
72 entry =
new TermVectorEntry(ALL, term, frequency, storeOffsets ==
true?offsets:null, storePositions ==
true?positions:null);
73 termToTVE[term] = entry;
74 currentSet.Add(entry);
83 if (existingOffsets != null && offsets != null && offsets.Length > 0)
87 Array.Copy(existingOffsets, 0, newOffsets, 0, existingOffsets.Length);
88 Array.Copy(offsets, 0, newOffsets, existingOffsets.Length, offsets.Length);
89 entry.SetOffsets(newOffsets);
91 else if (existingOffsets == null && offsets != null && offsets.Length > 0)
93 entry.SetOffsets(offsets);
100 if (existingPositions != null && positions != null && positions.Length > 0)
102 int[] newPositions =
new int[existingPositions.Length + positions.Length];
103 Array.Copy(existingPositions, 0, newPositions, 0, existingPositions.Length);
104 Array.Copy(positions, 0, newPositions, existingPositions.Length, positions.Length);
105 entry.SetPositions(newPositions);
107 else if (existingPositions == null && positions != null && positions.Length > 0)
109 entry.SetPositions(positions);
115 public override void SetExpectations(System.String field,
int numTerms,
bool storeOffsets,
bool storePositions)
118 this.storeOffsets = storeOffsets;
119 this.storePositions = storePositions;
128 public virtual SortedSet<TermVectorEntry> TermVectorEntrySet
130 get {
return currentSet; }