23 using System.Collections.Generic;
27 namespace Lucene.Net.Index.Memory
29 public partial class MemoryIndex
31 private sealed
partial class MemoryIndexReader
35 private readonly MemoryIndex _index;
36 private readonly MemoryIndexReader _reader;
38 private int cursor = 0;
39 private ArrayIntList current;
42 public MemoryTermPositions(MemoryIndex index, MemoryIndexReader reader)
48 public void Seek(
Term term)
52 if (DEBUG) System.Diagnostics.Debug.WriteLine(
".seek: " + term);
60 Info info = _reader.GetInfo(term.Field);
61 current = info == null ? null : info.GetPositions(term.Text);
62 hasNext = (current != null);
69 if (DEBUG) System.Diagnostics.Debug.WriteLine(
".seekEnum");
77 if (DEBUG) System.Diagnostics.Debug.WriteLine(
".doc");
86 int freq = current != null ? _index.NumPositions(current) : (term == null ? 1 : 0);
87 if (DEBUG) System.Diagnostics.Debug.WriteLine(
".freq: " + freq);
94 if (DEBUG) System.Diagnostics.Debug.WriteLine(
".next: " + current +
", oldHasNext=" + hasNext);
100 public int Read(
int[] docs,
int[] freqs)
102 if (DEBUG) System.Diagnostics.Debug.WriteLine(
".read: " + docs.Length);
103 if (!hasNext)
return 0;
110 public bool SkipTo(
int target)
112 if (DEBUG) System.Diagnostics.Debug.WriteLine(
".skipTo: " + target);
118 if (DEBUG) System.Diagnostics.Debug.WriteLine(
".close");
121 public void Dispose()
123 if (DEBUG) System.Diagnostics.Debug.WriteLine(
".close");
126 public int NextPosition()
128 int pos = current.Get(cursor);
129 cursor += _index.stride;
130 if (DEBUG) System.Diagnostics.Debug.WriteLine(
".nextPosition: " + pos);
134 public int PayloadLength
136 get {
throw new NotSupportedException(); }
139 public byte[] GetPayload(byte[] data,
int offset)
141 throw new NotSupportedException();
144 public bool IsPayloadAvailable
146 get {
return false; }