[
https://issues.apache.org/jira/browse/LUCENE-5272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13793654#comment-13793654
]
Paul Elschot commented on LUCENE-5272:
--------------------------------------
I'm adding a method to OpenBitSetIterator to support advanceToJustBefore for a
new DocBlockIterator, see LUCENE-5092.
Basically this does an advance followed by a prevSetBit, and when the advance
is getting too far out, it is important to know precisely where the end of the
bit set is.
Also I found that in order to be able to use prevSetBit from OBS I had to add
this static method there:
{code}
public static int prevSetBitStatic(int index, long[] bits, int wlen) {
}
{code}
which is ugly. It would be better to have the OBS as an attribute in the
OBSIterator so the existing prevSetBit method can be called directly.
So I am in favour of an overhaul, remove (deprecate?) everything that is not
currently used, and make OBS an attribute in OBSIterator instead of the long[]
and its length.
For the end of the bit set, bits.length seems to be the simplest thing that
could possibly work, so it is worth at try.
For the 'int' and 'long' variants, maybe we can do without the 'int' variants
now that 64 bit processors have become common.
Another candidate for a minor clean up is EliasFanoEncoder.numLongsForBits
which is a long implementation of OBS.bits2words.
> OpenBitSet.ensureCapacity does not modify numBits
> -------------------------------------------------
>
> Key: LUCENE-5272
> URL: https://issues.apache.org/jira/browse/LUCENE-5272
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/index
> Reporter: Shai Erera
> Attachments: LUCENE-5272.patch
>
>
> It's a simple bug, reproduced by this simple test:
> {code}
> public void testEnsureCapacity() {
> OpenBitSet bits = new OpenBitSet(1);
> bits.fastSet(0);
> bits.ensureCapacity(5); // make room for more bits
> bits.fastSet(2);
> }
> {code}
> The problem is that {{numBits}} which is used only for assrets isn't modified
> by ensureCapacity and so the next fastSet trips the assert. I guess we should
> also fix ensureCapacityWords and test it too.
> I may not be able to fix this until Sunday though, so if anyone wants to fix
> it before (maybe it can make it into 4.5.1), feel free.
--
This message was sent by Atlassian JIRA
(v6.1#6144)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]