(search) Add query strategy requiring link

This commit is contained in:
Viktor Lofgren 2024-01-03 16:23:00 +01:00
parent 0e970b8037
commit 5c2561d05d
3 changed files with 5 additions and 1 deletions

View File

@ -9,6 +9,7 @@ public enum QueryStrategy {
REQUIRE_FIELD_SUBJECT,
REQUIRE_FIELD_URL,
REQUIRE_FIELD_DOMAIN,
REQUIRE_FIELD_LINK,
AUTO
}

View File

@ -172,7 +172,9 @@ public class IndexResultValuator {
else if (queryStrategy == QueryStrategy.REQUIRE_FIELD_DOMAIN) {
return WordMetadata.hasFlags(termScore.encodedWordMetadata(), WordFlags.UrlDomain.asBit());
}
else if (queryStrategy == QueryStrategy.REQUIRE_FIELD_LINK) {
return WordMetadata.hasFlags(termScore.encodedWordMetadata(), WordFlags.ExternalLink.asBit());
}
return true;
}

View File

@ -45,6 +45,7 @@ public class QueryLimitsAccumulator implements TokenVisitor {
case "RF_SITE" -> QueryStrategy.REQUIRE_FIELD_SITE;
case "RF_URL" -> QueryStrategy.REQUIRE_FIELD_URL;
case "RF_DOMAIN" -> QueryStrategy.REQUIRE_FIELD_DOMAIN;
case "RF_LINK" -> QueryStrategy.REQUIRE_FIELD_LINK;
case "SENTENCE" -> QueryStrategy.SENTENCE;
case "TOPIC" -> QueryStrategy.TOPIC;
default -> QueryStrategy.AUTO;