mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +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,
|
docMetadata,
|
||||||
htmlFeatures,
|
htmlFeatures,
|
||||||
score,
|
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.
|
/** Calculate a bitmask illustrating the intersected positions of the search terms in the document.
|
||||||
* This is used in the GUI.
|
* This is used in the GUI.
|
||||||
* */
|
* */
|
||||||
private long calculatePositionsMask(IntList[] positions) {
|
private long calculatePositionsMask(IntList[] positions, PhraseConstraintGroupList phraseConstraints) {
|
||||||
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();
|
|
||||||
|
|
||||||
long result = 0;
|
long result = 0;
|
||||||
int bit = 0;
|
int bit = 0;
|
||||||
|
|
||||||
|
IntIterator intersection = phraseConstraints.getFullGroup().findIntersections(positions).intIterator();
|
||||||
|
|
||||||
while (intersection.hasNext() && bit < 64) {
|
while (intersection.hasNext() && bit < 64) {
|
||||||
bit = (int) (Math.sqrt(intersection.nextInt()));
|
bit = (int) (Math.sqrt(intersection.nextInt()));
|
||||||
result |= 1L << bit;
|
result |= 1L << bit;
|
||||||
|
Loading…
Reference in New Issue
Block a user