You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by pa...@apache.org on 2026/10/14 18:19:20 UTC
(lucenenet) branch master updated: Enable markdownlint rule MD031 blanks around fences (#1482)
This is an automated email from the ASF dual-hosted git repository.
paulirwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
The following commit(s) were added to refs/heads/master by this push:
new 1ac934560 Enable markdownlint rule MD031 blanks around fences (#1482)
1ac934560 is described below
commit 1ac9345603a1914fbae2858461bb151e86abbd40
Author: John Bampton <jb...@users.noreply.github.com>
AuthorDate: Thu Oct 15 04:19:14 2026 +1000
Enable markdownlint rule MD031 blanks around fences (#1482)
---
.github/linters/.markdown-lint.yml | 3 --
src/Lucene.Net/migration-guide.md | 36 ++++++++++++++++++++++
websites/site/contributing/documentation.md | 1 +
.../site/release-notes/version-4.8.0-beta00013.md | 2 ++
.../site/release-notes/version-4.8.0-beta00014.md | 2 ++
5 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml
index 72298d570..b9e7da5f3 100644
--- a/.github/linters/.markdown-lint.yml
+++ b/.github/linters/.markdown-lint.yml
@@ -69,9 +69,6 @@ MD029: false
# MD030/list-marker-space Spaces after list markers
MD030: false
-# MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines
-MD031: false
-
# MD032/blanks-around-lists Lists should be surrounded by blank lines
MD032: false
diff --git a/src/Lucene.Net/migration-guide.md b/src/Lucene.Net/migration-guide.md
index 4bfc8aaa4..2ca9fefd5 100644
--- a/src/Lucene.Net/migration-guide.md
+++ b/src/Lucene.Net/migration-guide.md
@@ -68,6 +68,7 @@ enumeration APIs. Here are the major changes:
* Fields are separately enumerated (`Fields.GetEnumerator()`) from the terms
within each field (`TermEnum`). So instead of this:
+
```cs
TermEnum termsEnum = ...;
while (termsEnum.Next())
@@ -76,7 +77,9 @@ enumeration APIs. Here are the major changes:
Console.WriteLine("field=" + t.Field + "; text=" + t.Text);
}
```
+
Do this:
+
```cs
foreach (string field in fields)
{
@@ -91,6 +94,7 @@ enumeration APIs. Here are the major changes:
```
* `TermDocs` is renamed to `DocsEnum`. Instead of this:
+
```cs
while (td.Next())
{
@@ -98,7 +102,9 @@ enumeration APIs. Here are the major changes:
...
}
```
+
do this:
+
```cs
int doc;
while ((doc = td.Next()) != DocsEnum.NO_MORE_DOCS)
@@ -106,7 +112,9 @@ enumeration APIs. Here are the major changes:
...
}
```
+
Instead of this:
+
```cs
if (td.SkipTo(target))
{
@@ -114,7 +122,9 @@ enumeration APIs. Here are the major changes:
...
}
```
+
do this:
+
```cs
if ((doc = td.Advance(target)) != DocsEnum.NO_MORE_DOCS)
{
@@ -135,6 +145,7 @@ enumeration APIs. Here are the major changes:
docs/positions enum from that `TermsEnum`.
* `TermsEnum`'s seek method returns more information. So instead of this:
+
```cs
Term t;
TermEnum termEnum = reader.Terms(t);
@@ -143,7 +154,9 @@ enumeration APIs. Here are the major changes:
...
}
```
+
do this:
+
```cs
TermsEnum termsEnum = ...;
BytesRef text;
@@ -152,6 +165,7 @@ enumeration APIs. Here are the major changes:
...
}
```
+
`SeekStatus` also contains `END` (enumerator is done) and `NOT_FOUND` (term was not found but enumerator is now positioned to the next term).
* `TermsEnum` has an `Ord` property, returning the long numeric
@@ -163,6 +177,7 @@ enumeration APIs. Here are the major changes:
* How you obtain the enums has changed. The primary entry point is
the `Fields` class. If you know your reader is a single segment
reader, do this:
+
```cs
Fields fields = reader.Fields();
if (fields != null)
@@ -170,7 +185,9 @@ enumeration APIs. Here are the major changes:
...
}
```
+
If the reader might be multi-segment, you must do this:
+
```cs
Fields fields = MultiFields.GetFields(reader);
if (fields != null)
@@ -178,10 +195,12 @@ enumeration APIs. Here are the major changes:
...
}
```
+
The fields may be `null` (eg if the reader has no fields).<br/>
Note that the `MultiFields` approach entails a performance hit on `MultiReaders`, as it must merge terms/docs/positions on the fly. It's generally better to instead get the sequential readers (use `Lucene.Net.Util.ReaderUtil`) and then step through those readers yourself, if you can (this is how Lucene drives searches).<br/>
If you pass a `SegmentReader` to `MultiFields.GetFields()` it will simply return `reader.GetFields()`, so there is no performance hit in that case.<br/>
Once you have a non-null `Fields` you can do this:
+
```cs
Terms terms = fields.GetTerms("field");
if (terms != null)
@@ -189,32 +208,41 @@ enumeration APIs. Here are the major changes:
...
}
```
+
The terms may be `null` (eg if the field does not exist).<br/>
Once you have a non-null terms you can get an enum like this:
+
```cs
TermsEnum termsEnum = terms.GetIterator();
```
+
The returned `TermsEnum` will not be `null`.<br/>
You can then .Next() through the TermsEnum, or Seek. If you want a `DocsEnum`, do this:
+
```cs
IBits liveDocs = reader.GetLiveDocs();
DocsEnum docsEnum = null;
docsEnum = termsEnum.Docs(liveDocs, docsEnum, needsFreqs);
```
+
You can pass in a prior `DocsEnum` and it will be reused if possible.<br/>
Likewise for `DocsAndPositionsEnum`.<br/>
`IndexReader` has several sugar methods (which just go through the above steps, under the hood). Instead of:
+
```cs
Term t;
TermDocs termDocs = reader.TermDocs;
termDocs.Seek(t);
```
+
do this:
+
```cs
Term t;
DocsEnum docsEnum = reader.GetTermDocsEnum(t);
```
+
Likewise for `DocsAndPositionsEnum`.
## [LUCENE-2380](https://issues.apache.org/jira/browse/LUCENE-2380): FieldCache.GetStrings/Index --> FieldCache.GetDocTerms/Index
@@ -229,12 +257,15 @@ enumeration APIs. Here are the major changes:
to fill (which must not be `null`), and it fills it in with the
reference to the bytes for that term.<br/>
If you had code like this before:
+
```cs
string[] values = FieldCache.DEFAULT.GetStrings(reader, field);
...
string aValue = values[docID];
```
+
you can do this instead:
+
```cs
BinaryDocValues values = FieldCache.DEFAULT.GetTerms(reader, field);
...
@@ -242,6 +273,7 @@ enumeration APIs. Here are the major changes:
values.Get(docID, term);
string aValue = term.Utf8ToString();
```
+
Note however that it can be costly to convert to `String`, so it's better to work directly with the `BytesRef`.
* Similarly, in `FieldCache`, GetStringIndex (returning a `StringIndex`
@@ -253,13 +285,16 @@ enumeration APIs. Here are the major changes:
order, and the sugar method `Get(int docID, BytesRef result)`
which internally calls `GetOrd` and then `LookupOrd`.<br/>
If you had code like this before:
+
```cs
StringIndex idx = FieldCache.DEFAULT.GetStringIndex(reader, field);
...
int ord = idx.order[docID];
String aValue = idx.lookup[ord];
```
+
you can do this instead:
+
```cs
DocTermsIndex idx = FieldCache.DEFAULT.GetTermsIndex(reader, field);
...
@@ -268,6 +303,7 @@ enumeration APIs. Here are the major changes:
idx.LookupOrd(ord, term);
string aValue = term.Utf8ToString();
```
+
Note however that it can be costly to convert to `String`, so it's better to work directly with the `BytesRef`.<br/>
`DocTermsIndex` also has a `GetTermsEnum()` method, which returns an iterator (`TermsEnum`) over the term values in the index (ie, iterates ord = 0..NumOrd-1).
diff --git a/websites/site/contributing/documentation.md b/websites/site/contributing/documentation.md
index 9af7d607a..397734b49 100644
--- a/websites/site/contributing/documentation.md
+++ b/websites/site/contributing/documentation.md
@@ -213,6 +213,7 @@ dotnet tool install javadoc2markdown --add-source https://pkgs.dev.azure.com/luc
```
Then run the command:
+
```console
javadoc2markdown <LUCENE DIRECTORY> <LUCENENET DIRECTORY>
```
diff --git a/websites/site/release-notes/version-4.8.0-beta00013.md b/websites/site/release-notes/version-4.8.0-beta00013.md
index d50e7fd64..e3910165f 100644
--- a/websites/site/release-notes/version-4.8.0-beta00013.md
+++ b/websites/site/release-notes/version-4.8.0-beta00013.md
@@ -35,6 +35,7 @@ InvocationCount=1 IterationCount=15 LaunchCount=2
UnrollFactor=1 WarmupCount=10
```
+
| Method | Job | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|----------- |---------------- |---------:|---------:|---------:|-----------:|----------:|----------:|----------:|
| IndexFiles | 4.8.0-beta00005 | 628.1 ms | 8.41 ms | 12.05 ms | 43000.0000 | 8000.0000 | 7000.0000 | 220.82 MB |
@@ -72,6 +73,7 @@ Intel Core i7-8850H CPU 2.60GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical
IterationCount=15 LaunchCount=2 WarmupCount=10
```
+
| Method | Job | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|------------ |---------------- |---------:|--------:|---------:|-----------:|----------:|------:|----------:|
| SearchFiles | 4.8.0-beta00005 | 274.8 ms | 7.01 ms | 10.28 ms | 18000.0000 | 1000.0000 | - | 82.12 MB |
diff --git a/websites/site/release-notes/version-4.8.0-beta00014.md b/websites/site/release-notes/version-4.8.0-beta00014.md
index 4510951bc..c10224145 100644
--- a/websites/site/release-notes/version-4.8.0-beta00014.md
+++ b/websites/site/release-notes/version-4.8.0-beta00014.md
@@ -63,6 +63,7 @@ InvocationCount=1 IterationCount=15 LaunchCount=2
UnrollFactor=1 WarmupCount=10
```
+
| Method | Job | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|----------- |---------------- |---------:|----------:|----------:|-----------:|----------:|----------:|----------:|
| IndexFiles | 4.8.0-beta00005 | 905.6 ms | 131.82 ms | 197.30 ms | 43000.0000 | 8000.0000 | 7000.0000 | 220.99 MB |
@@ -103,6 +104,7 @@ Intel Core i7-8850H CPU 2.60GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical
IterationCount=15 LaunchCount=2 WarmupCount=10
```
+
| Method | Job | Mean | Error | StdDev | Median | Gen 0 | Gen 1 | Gen 2 | Allocated |
|------------ |---------------- |---------:|----------:|----------:|---------:|-----------:|----------:|------:|----------:|
| SearchFiles | 4.8.0-beta00005 | 421.1 ms | 111.47 ms | 163.38 ms | 326.3 ms | 18000.0000 | 1000.0000 | - | 82.11 MB |