mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05:18:58 +00:00
(index) Remove position overlap check, coherences will do the work instead
This commit is contained in:
parent
973ced7b13
commit
de0e56f027
@ -97,13 +97,12 @@ public class IndexResultValuationContext {
|
|||||||
boolean allSynthetic = !CompiledQueryAggregates.booleanAggregate(wordMetasQuery, WordFlags.Synthetic::isAbsent);
|
boolean allSynthetic = !CompiledQueryAggregates.booleanAggregate(wordMetasQuery, WordFlags.Synthetic::isAbsent);
|
||||||
int flagsCount = CompiledQueryAggregates.intMaxMinAggregate(wordMetasQuery, wordMeta -> Long.bitCount(wordMeta & flagsFilterMask));
|
int flagsCount = CompiledQueryAggregates.intMaxMinAggregate(wordMetasQuery, wordMeta -> Long.bitCount(wordMeta & flagsFilterMask));
|
||||||
int positionsCount = CompiledQueryAggregates.intMaxMinAggregate(wordMetasQuery, wordMeta -> Long.bitCount(WordMetadata.decodePositions(wordMeta)));
|
int positionsCount = CompiledQueryAggregates.intMaxMinAggregate(wordMetasQuery, wordMeta -> Long.bitCount(WordMetadata.decodePositions(wordMeta)));
|
||||||
boolean noneOverlap = wordMetasQuery.root.visit(new PositionOverlapOperator(wordMetasQuery.data)) != 0;
|
|
||||||
|
|
||||||
if (!meetsQueryStrategyRequirements(wordMetasQuery, queryParams.queryStrategy())) {
|
if (!meetsQueryStrategyRequirements(wordMetasQuery, queryParams.queryStrategy())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flagsCount == 0 && !allSynthetic && (positionsCount == 0 || noneOverlap))
|
if (flagsCount == 0 && !allSynthetic && positionsCount == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
double score = searchResultValuator.calculateSearchResultValue(
|
double score = searchResultValuator.calculateSearchResultValue(
|
||||||
@ -167,42 +166,3 @@ public class IndexResultValuationContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PositionOverlapOperator implements CqExpression.LongVisitor {
|
|
||||||
private final CqDataLong wordMetaData;
|
|
||||||
|
|
||||||
PositionOverlapOperator(CqDataLong wordMetaData) {
|
|
||||||
this.wordMetaData = wordMetaData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long onAnd(List<? extends CqExpression> parts) {
|
|
||||||
long positions = ~0;
|
|
||||||
long flags = 0;
|
|
||||||
|
|
||||||
for (var part : parts) {
|
|
||||||
long pv = part.visit(this);
|
|
||||||
|
|
||||||
flags |= pv;
|
|
||||||
positions &= pv;
|
|
||||||
}
|
|
||||||
|
|
||||||
return positions | (flags & WordMetadata.FLAGS_MASK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long onOr(List<? extends CqExpression> parts) {
|
|
||||||
long ret = 0;
|
|
||||||
|
|
||||||
for (var part : parts) {
|
|
||||||
ret |= part.visit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long onLeaf(int idx) {
|
|
||||||
return wordMetaData.get(idx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user