mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 13:09:00 +00:00
(index) Correct positions mask to take into account offsets when overlapping
This commit is contained in:
parent
60ad4786bc
commit
87aa869338
@ -184,7 +184,7 @@ public class IndexResultScoreCalculator {
|
||||
docMetadata,
|
||||
htmlFeatures,
|
||||
score,
|
||||
calculatePositionsMask(decodedPositions)
|
||||
calculatePositionsMask(decodedPositions, searchTerms.phraseConstraints)
|
||||
);
|
||||
}
|
||||
|
||||
@ -226,18 +226,13 @@ public class IndexResultScoreCalculator {
|
||||
/** Calculate a bitmask illustrating the intersected positions of the search terms in the document.
|
||||
* This is used in the GUI.
|
||||
* */
|
||||
private long calculatePositionsMask(IntList[] positions) {
|
||||
IntList[] iters = new IntList[rankingContext.regularMask.cardinality()];
|
||||
for (int i = 0, j = 0; i < positions.length; i++) {
|
||||
if (rankingContext.regularMask.get(i)) {
|
||||
iters[j++] = positions[i];
|
||||
}
|
||||
}
|
||||
IntIterator intersection = SequenceOperations.findIntersections(iters).intIterator();
|
||||
private long calculatePositionsMask(IntList[] positions, PhraseConstraintGroupList phraseConstraints) {
|
||||
|
||||
long result = 0;
|
||||
int bit = 0;
|
||||
|
||||
IntIterator intersection = phraseConstraints.getFullGroup().findIntersections(positions).intIterator();
|
||||
|
||||
while (intersection.hasNext() && bit < 64) {
|
||||
bit = (int) (Math.sqrt(intersection.nextInt()));
|
||||
result |= 1L << bit;
|
||||
|
Loading…
Reference in New Issue
Block a user