[
https://issues.apache.org/jira/browse/LUCENE-6427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14499509#comment-14499509
]
Luc Vanlerberghe edited comment on LUCENE-6427 at 4/17/15 9:08 AM:
-------------------------------------------------------------------
I updated my pull request:
* Deleted obsolete doc comments on @Override methods
* TestFixedBitSet: Made an accidentally public method private again
* org.apache.solr.search.TestFiltering: Corrected possible generation of
'ghost' bits for FixedBitSet
About scanIsEmpty():
bq. But it doesn't bring anything either since this method is not used anywhere
for now?
I did find a case where it would be useful: In oals.SloppyPhraseScorer there's
this code:
{code}
// collisions resolved, now re-queue
// empty (partially) the queue until seeing all pps advanced for resolving
collisions
int n = 0;
// TODO would be good if we can avoid calling cardinality() in each
iteration!
int numBits = bits.length(); // larges bit we set
while (bits.cardinality() > 0) {
PhrasePositions pp2 = pq.pop();
rptStack[n++] = pp2;
if (pp2.rptGroup >= 0
&& pp2.rptInd < numBits // this bit may not have been set
&& bits.get(pp2.rptInd)) {
bits.clear(pp2.rptInd);
}
}
{code}
and some places that assert that .cardinality() == 0.
was (Author: lvl):
I updated my pull request:
* Deleted obsolete doc comments on @Override methods
* TestFixedBitSet: Made an accidentally public method private again
* org.apache.solr.search.TestFiltering: Corrected possible generation of
'ghost' bits for FixedBitSet
bq. But it doesn't bring anything either since this method is not used anywhere
for now?
I did find a case where it would be useful: In oals.SloppyPhraseScorer there's
this code:
{code}
// collisions resolved, now re-queue
// empty (partially) the queue until seeing all pps advanced for resolving
collisions
int n = 0;
// TODO would be good if we can avoid calling cardinality() in each
iteration!
int numBits = bits.length(); // larges bit we set
while (bits.cardinality() > 0) {
PhrasePositions pp2 = pq.pop();
rptStack[n++] = pp2;
if (pp2.rptGroup >= 0
&& pp2.rptInd < numBits // this bit may not have been set
&& bits.get(pp2.rptInd)) {
bits.clear(pp2.rptInd);
}
}
{code}
and some places that assert that .cardinality() == 0.
> BitSet fixes - assert on presence of 'ghost bits' and others
> ------------------------------------------------------------
>
> Key: LUCENE-6427
> URL: https://issues.apache.org/jira/browse/LUCENE-6427
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/other
> Reporter: Luc Vanlerberghe
>
> Fixes after reviewing org.apache.lucene.util.FixedBitSet, LongBitSet and
> corresponding tests:
> * Some methods rely on the fact that no bits are set after numBits (what I
> call 'ghost' bits here).
> ** cardinality, nextSetBit, intersects and others may yield wrong results
> ** If ghost bits are present, they may become visible after ensureCapacity is
> called.
> ** The tests deliberately create bitsets with ghost bits, but then do not
> detect these failures
> * FixedBitSet.cardinality scans the complete backing array, even if only
> numWords are in use
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]