hidingmyname opened a new issue, #16920:
URL: https://github.com/apache/lucene/issues/16920
### Summary
The javadoc on the `SetKeywordMarkerFilter` constructor begins "Create a new
KeywordSetMarkerFilter". No such class exists. The first two words of the
class name are swapped.
### Where
`lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/SetKeywordMarkerFilter.java:34-44`:
```java
/**
* Create a new KeywordSetMarkerFilter, that marks the current token as a
keyword if the tokens
* term buffer is contained in the given set via the {@link
KeywordAttribute}.
*
* @param in TokenStream to filter
* @param keywordSet the keywords set to lookup the current termbuffer
*/
public SetKeywordMarkerFilter(final TokenStream in, final CharArraySet
keywordSet) {
super(in);
this.keywordSet = Objects.requireNonNull(keywordSet, "keywordSet");
}
```
Its sibling filter has the same sentence with the right name and a link,
`PatternKeywordMarkerFilter.java:35`:
```java
* Create a new {@link PatternKeywordMarkerFilter}, that marks the current
token as a keyword if
```
A search of `main` for `KeywordSetMarkerFilter` finds only this one line.
### Why it matters
It's a small typo, but it's in public API javadoc for a filter people
use a lot, with `KeywordMarkerFilter` as its abstract parent. Because the
keyword-marker family has several similar names (`KeywordMarkerFilter`,
`SetKeywordMarkerFilter`, `PatternKeywordMarkerFilter`,
`KeywordMarkerFilterFactory`), a swapped name here reads like a fourth class.
Using `{@link}` like the sibling does would also stop this kind of mistake
from coming back.
### Suggested fix
```diff
/**
- * Create a new KeywordSetMarkerFilter, that marks the current token as a
keyword if the tokens
- * term buffer is contained in the given set via the {@link
KeywordAttribute}.
+ * Create a new {@link SetKeywordMarkerFilter}, that marks the current
token as a keyword if the
+ * tokens term buffer is contained in the given set via the {@link
KeywordAttribute}.
```
(Re-wrapped for the formatter. A plain `SetKeywordMarkerFilter` without the
link would also work.)
### Upstream reference
Lucene.NET fixed the same line in its port in
apache/lucenenet@`46b02fbc1` ("Lucene.Net.Analysis.Miscellaneous refactor:
member accessibility and documentation comments"):
```diff
---
a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/SetKeywordMarkerFilter.cs
+++
b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/SetKeywordMarkerFilter.cs
@@ -31,12 +31,12 @@ public sealed class SetKeywordMarkerFilter :
KeywordMarkerFilter
private readonly CharArraySet keywordSet;
/// <summary>
- /// Create a new KeywordSetMarkerFilter, that marks the current
token as a
+ /// Create a new <see cref="SetKeywordMarkerFilter"/>, that marks
the current token as a
/// keyword if the tokens term buffer is contained in the given set
via the
/// <see cref="KeywordAttribute"/>.
/// </summary>
```
Current Lucene.NET:
```csharp
/// <summary>
/// Create a new <see cref="SetKeywordMarkerFilter"/>, that marks
the current token as a
/// keyword if the tokens term buffer is contained in the given set
via the
/// <see cref="IKeywordAttribute"/>.
/// </summary>
```
I can submit a PR for this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]