You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by la...@apache.org on 2023/04/08 03:46:03 UTC
[lucenenet] branch master updated: BREAKING: create private method for calling from construtor (#805)
This is an automated email from the ASF dual-hosted git repository.
laimis 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 532f7383e BREAKING: create private method for calling from construtor (#805)
532f7383e is described below
commit 532f7383ec2144d216f821f24792e8e02f39d541
Author: Laimonas Simutis <la...@gmail.com>
AuthorDate: Fri Apr 7 20:45:57 2023 -0700
BREAKING: create private method for calling from construtor (#805)
---
src/Lucene.Net.Queries/Function/ValueSourceScorer.cs | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/Lucene.Net.Queries/Function/ValueSourceScorer.cs b/src/Lucene.Net.Queries/Function/ValueSourceScorer.cs
index 9bf3e99c7..4f49afd9a 100644
--- a/src/Lucene.Net.Queries/Function/ValueSourceScorer.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSourceScorer.cs
@@ -26,6 +26,11 @@ namespace Lucene.Net.Queries.Function
/// <summary>
/// <see cref="Scorer"/> which returns the result of <see cref="FunctionValues.SingleVal(int)"/> as
/// the score for a document.
+ ///
+ /// When overriding this class, be aware that ValueSourceScorer constructor is calling
+ /// its private SetCheckDeletesInternal method as opposed to virtual SetCheckDeletes method.
+ /// This is done to avoid virtual call in constructor. You can call your own private
+ /// method for CheckDeletes initialization in your constructor if you need to.
/// </summary>
public class ValueSourceScorer : Scorer
{
@@ -42,13 +47,17 @@ namespace Lucene.Net.Queries.Function
this.m_reader = reader;
this.m_maxDoc = reader.MaxDoc;
this.m_values = values;
- SetCheckDeletes(true);
+ SetCheckDeletesInternal(true); // LUCENENET specific - calling internal method instead of virtual
this.liveDocs = MultiFields.GetLiveDocs(reader);
}
public virtual IndexReader Reader => m_reader;
- public virtual void SetCheckDeletes(bool checkDeletes)
+ public virtual void SetCheckDeletes(bool checkDeletes) =>
+ SetCheckDeletesInternal(checkDeletes);
+
+ // LUCENENET specific - S1699 - introduced private method to avoid virtual call in constructor
+ private void SetCheckDeletesInternal(bool checkDeletes)
{
this.m_checkDeletes = checkDeletes && m_reader.HasDeletions;
}