diff --git a/src/Lucene.Net/Index/AbstractAllTermDocs.cs b/src/Lucene.Net/Index/AbstractAllTermDocs.cs index e108917728..ef242c21db 100644 --- a/src/Lucene.Net/Index/AbstractAllTermDocs.cs +++ b/src/Lucene.Net/Index/AbstractAllTermDocs.cs @@ -71,7 +71,7 @@ public bool Next(IState state) return SkipTo(internalDoc + 1, state); } - public int Read(int[] docs, int[] freqs, IState state) + public int Read(Span docs, Span freqs, IState state) { int length = docs.Length; int i = 0; diff --git a/src/Lucene.Net/Index/DirectoryReader.cs b/src/Lucene.Net/Index/DirectoryReader.cs index 2d75594f61..93a8c04bac 100644 --- a/src/Lucene.Net/Index/DirectoryReader.cs +++ b/src/Lucene.Net/Index/DirectoryReader.cs @@ -1394,7 +1394,7 @@ public virtual bool Next(IState state) } /// Optimized implementation. - public virtual int Read(int[] docs, int[] freqs, IState state) + public virtual int Read(Span docs, Span freqs, IState state) { while (true) { diff --git a/src/Lucene.Net/Index/FilterIndexReader.cs b/src/Lucene.Net/Index/FilterIndexReader.cs index 429e65bf4d..b92d02f067 100644 --- a/src/Lucene.Net/Index/FilterIndexReader.cs +++ b/src/Lucene.Net/Index/FilterIndexReader.cs @@ -69,7 +69,7 @@ public virtual bool Next(IState state) { return in_Renamed.Next(state); } - public virtual int Read(int[] docs, int[] freqs, IState state) + public virtual int Read(Span docs, Span freqs, IState state) { return in_Renamed.Read(docs, freqs, state); } diff --git a/src/Lucene.Net/Index/MultipleTermPositions.cs b/src/Lucene.Net/Index/MultipleTermPositions.cs index 5aa50ae0f2..4d6ebd9b27 100644 --- a/src/Lucene.Net/Index/MultipleTermPositions.cs +++ b/src/Lucene.Net/Index/MultipleTermPositions.cs @@ -226,7 +226,7 @@ public virtual void Seek(TermEnum termEnum, IState state) /// Not implemented. /// UnsupportedOperationException - public virtual int Read(int[] arg0, int[] arg1, IState state) + public virtual int Read(Span arg0, Span arg1, IState state) { throw new System.NotSupportedException(); } diff --git a/src/Lucene.Net/Index/ParallelReader.cs b/src/Lucene.Net/Index/ParallelReader.cs index 3704d6bdc6..b3eff2cee6 100644 --- a/src/Lucene.Net/Index/ParallelReader.cs +++ b/src/Lucene.Net/Index/ParallelReader.cs @@ -723,7 +723,7 @@ public virtual bool Next(IState state) return termDocs.Next(state); } - public virtual int Read(int[] docs, int[] freqs, IState state) + public virtual int Read(Span docs, Span freqs, IState state) { if (termDocs == null) return 0; diff --git a/src/Lucene.Net/Index/SegmentTermDocs.cs b/src/Lucene.Net/Index/SegmentTermDocs.cs index 105ce33262..e2ff7ca9dd 100644 --- a/src/Lucene.Net/Index/SegmentTermDocs.cs +++ b/src/Lucene.Net/Index/SegmentTermDocs.cs @@ -182,7 +182,7 @@ public virtual bool Next(IState state) } /// Optimized implementation. - public virtual int Read(int[] docs, int[] freqs, IState state) + public virtual int Read(Span docs, Span freqs, IState state) { int length = docs.Length; if (currentFieldOmitTermFreqAndPositions) @@ -216,7 +216,7 @@ public virtual int Read(int[] docs, int[] freqs, IState state) } } - private int ReadNoTf(int[] docs, int[] freqs, int length, IState state) + private int ReadNoTf(Span docs, Span freqs, int length, IState state) { int i = 0; while (i < length && count < df) diff --git a/src/Lucene.Net/Index/SegmentTermPositions.cs b/src/Lucene.Net/Index/SegmentTermPositions.cs index f1714bdf51..7e9cdc43b2 100644 --- a/src/Lucene.Net/Index/SegmentTermPositions.cs +++ b/src/Lucene.Net/Index/SegmentTermPositions.cs @@ -115,7 +115,7 @@ public override bool Next(IState state) return false; } - public override int Read(int[] docs, int[] freqs, IState state) + public override int Read(Span docs, Span freqs, IState state) { throw new System.NotSupportedException("TermPositions does not support processing multiple documents in one call. Use TermDocs instead."); } diff --git a/src/Lucene.Net/Index/TermDocs.cs b/src/Lucene.Net/Index/TermDocs.cs index bd88e19f1f..01bf01d7ae 100644 --- a/src/Lucene.Net/Index/TermDocs.cs +++ b/src/Lucene.Net/Index/TermDocs.cs @@ -62,7 +62,7 @@ public interface TermDocs : IDisposable ///

Returns the number of entries read. Zero is only returned when the /// stream has been exhausted. /// - int Read(int[] docs, int[] freqs, IState state); + int Read(Span docs, Span freqs, IState state); ///

Skips entries to the first beyond the current whose document number is /// greater than or equal to target.

Returns true iff there is such diff --git a/src/Lucene.Net/Search/MultiTermQueryWrapperFilter.cs b/src/Lucene.Net/Search/MultiTermQueryWrapperFilter.cs index d1587627a6..b56781097d 100644 --- a/src/Lucene.Net/Search/MultiTermQueryWrapperFilter.cs +++ b/src/Lucene.Net/Search/MultiTermQueryWrapperFilter.cs @@ -114,8 +114,9 @@ public override DocIdSet GetDocIdSet(IndexReader reader, IState state) return DocIdSet.EMPTY_DOCIDSET; // else fill into an OpenBitSet OpenBitSet bitSet = new OpenBitSet(reader.MaxDoc); - int[] docs = new int[32]; - int[] freqs = new int[32]; + Span docs = stackalloc int[32]; + Span freqs = stackalloc int[32]; + TermDocs termDocs = reader.TermDocs(state); try {