|
Created an attachment (id=13879)
intIterator.java (From update of attachment 13878)
public SortedVIntList(BitSet bits) loops indefinitely. A "+1" is needed on the paramater to the last "nextSetBit" call. Mark Harwood Mark,
Thanks. I did not test BitSet constructor. Paul Elschot Created an attachment (id=13901)
JUnit test case for SortedVIntList The only change needed to SortedVIntList to pass the tests public SortedVIntList(BitSet bits) { int lastInt = 0; resizeBytes(lastBytePos); so I'm not attaching the corrected version. The test code suppresses the test BitSet test for I'll try and not post untested code again Regards, and thanks again Mark, Created an attachment (id=14020)
DocNrSkipper.java to replace intIterator.java Implementors of this interface can be used for SkipFilter Created an attachment (id=14021)
SortedVIntList.java providing a DocNrSkipper instead of an intIterator Basic data structure of differences stored as VInts unchanged. Created an attachment (id=14022)
TestSortedVIntList.java, adapted for DocNrSkipper Created an attachment (id=14210)
Assigned copyright to ASF Created an attachment (id=14211)
Assigned copyright to ASF Created an attachment (id=14213)
TestSortedVIntList.java, assigned copyright to ASF Paul,
What was the status with this code - its been a while since you posted it. I've got some extensions which could be added here:
(In reply to comment #12)
> Paul, > What was the status with this code - its been a while since you posted it. It's working nicely for me. > I've got some extensions which could be added here: These would be useful because they have different tradeoffs in memory use > * OrDocNoSkipper and AndDocNoSkipper wrapper implementations which both take In case you prefer DocNoSkipper or something else I don't mind. The OrDocNoSkipper and AndDocNoSkipper would be good to implement I'm interested in extending QueryParser to use these To easily implement boolean operations with a constant scoring term, class TermConstantScorer ? It might also be good to put all new things related Regards, Created an attachment (id=15483)
IntArraySortedIntList Created an attachment (id=15484)
BitSetSortedIntList Created an attachment (id=15485)
OrDocNrSkipper Created an attachment (id=15486)
AndDocNrSkipper Created an attachment (id=15487)
TestDocNrSkippers >>Did you also consider more than two arguments to these AND and OR
iterators? The ability to nest one OrDocNrSkipper in another is effectively a way of I'm using these classes for things other than query scoring at the moment so I Created an attachment (id=15488)
AndDocNrSkipper with support for iterating multiple DocNrSkippers Created an attachment (id=15489)
OrDocNrSkipper with support for iterating multiple DocNrSkippers Created an attachment (id=15490)
TestDocNrSkippers How about adding a next() or nextDocNr() to DocNrSkipper that doesn't take the current id as a parameter? It would allow more efficient implementations of DocNrSkipper when you want to simply iterate over all the docs.
It would also make some code using it a little cleaner. About adding a nextDocNr() without current doc argument to DocNrSkipper:
I considered that but left it out initially for code simplicity in DocNrSkipper implementations. It's much the same as with Scorer.next() and Scorer.skipTo(docNr), so it would fit Regards, I've been working a little on a faster version of BitSet. That's one place where a stateful iterator implementing nextDocNr() can be faster than nextDocNr(docNr) , so I would like to see the nextDocNr() added.
I've been looking at this code and found some minor enhancements that could be done:
1. Any particular reason for SortedVIntList not to implement DocNrSkipper interface, the method getDocNrSkipper() is there, but declaration is missing. 2. Should getDocNrSkipper() DocNrSkipper interface throw IOException? I have tried to add TermDocsSortedIntList to the family, but all methods in TermDocs are throwing IOException, and it is not nice to eat silently this exception too early in DocNrSkipper. Better ideas to deal with that? 3. Paul, why SkipFilter exists (here I refer to the JIRA-330 )? Wouldn't be better to use DocNrSkipper interface instead (SkipFilter does nothing but wrapping this interface). Also, the same question applies to IterFilter. Did I get something wrong here? Must say, excelent work! > 1. Any particular reason for SortedVIntList not to implement DocNrSkipper interface, the method getDocNrSkipper() is there, but declaration is missing.
The object returned by the getDocNrSkipper() method implements the interface by adding a bit of state > 2. Should getDocNrSkipper() DocNrSkipper interface throw IOException? I have tried to add TermDocsSortedIntList to the family, but all methods in TermDocs are throwing IOException, and it is not nice to eat silently this exception too early in DocNrSkipper. Better ideas to deal with that? I have no problem with the addition of throwing an IOException to the DocNrSkipper interface. > 3. Paul, why SkipFilter exists (here I refer to the JIRA-330 )? Wouldn't be better to use DocNrSkipper interface instead (SkipFilter does nothing but wrapping this interface). Also, the same question applies to IterFilter. Did I get something wrong here? The presence of class BitSet in the bits() method of Filter I'd like to somehow have these parallel paths merged, but I don't now how to The IterFilter of > Must say, excelent work! Thanks. I should add that most of the hard work had already been done in Regards, This patches Filter.java and IndexSearcher.java .
Filter.java is modified to implement SkipFilter, to provide The patch also contains some commented test code for Filter.java. When extending Filter in this way, SkipFilter may not be necessary The DocNrSkipper interface contains only one method: I don't think this patch should be added to release 2.0. Starting from SkipFilter1.patch as above, a replacement of Filter by SkipFilter in the various API's
(Searcher, Searchable and implementors) is straightforward. The only thing further needed is a checked cast to Filter in IndexSearcher.search(weight, filter, hitcollector) for the case when the DocNrSkipper is null. (When that cast to Filter fails an IllegalArgumentException can be thrown). After that, all tests pass again, with and without the test code in Filter to always use a DocNrSkipper. That means that it is easier than expected to replace Filter by SkipFilter altogether. This issue is outdated now. The related
Moved to
Those of you who voted for this (5 votes!) may want to vote for |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SortedVIntList.java