* Test for a previous implematation of Intersect
Before we were moving the postings list everytime we create a new
chained `intersectPostings`. That was causing some postings to be
skipped. This test fails on the older version.
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
* Advance on Seek only when valid.
Issue:
Before in mergedPostings and others we advance everytime we `Seek`,
which causes issues with `Intersect`.
Take the case, where we have a mergedPostings = m merging, a: {10, 20, 30} and
b: {15, 25, 35}. Everytime we `Seek`, we do a.Seek and b.Seek.
Now if we Intersect m with {21, 22, 23, 30}, we would do Seek({21,22,23}) which
would advance a and b beyond 30.
Fix:
Now we advance only when the seeking value is greater than the current
value, as the definition specifies.
Also, posting 0 will not be a valid posting and will be used to signal
finished or un-initialized PostingsList.
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
* Add test for Merge+Intersect edgecase.
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
* Add comments to trivial tests.
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
* newIntersectPostings and newMergePostings should not advance passed
postings automatically.
* listPostings and bigEndianPostings should not panic with index out
of range when At() is called before Next()/Seek().
* Seek() call should advance listPostings/bigEndianPostings.
A bad test was introduced a couple of commits ago which also made
changes to pass the bad test. Fixed the test and revert the changes.
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
* Renamed mergedPostings to make it consistent across the repo
* Fixed bug with Seek
* Added Tests for Seek
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>