Class TokenCoverageRankingStrategy
java.lang.Object
ubic.gemma.rest.ranking.TokenCoverageRankingStrategy
- All Implemented Interfaces:
AnnotationSearchRankingStrategy
@Component("coverage")
public class TokenCoverageRankingStrategy
extends Object
implements AnnotationSearchRankingStrategy
Re-orders hits by what fraction of the query tokens appear in the hit's lowercased value.
Primary sort: coverage descending. Secondary sort: original Lucene rank ascending (stable
relative to the input order for hits with identical coverage).
Empty / blank queries are short-circuited: the input order is returned unchanged so the caller's choice of upstream ordering wins.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()Short stable name used as the value of the?rank=query parameter and as the bean name in the strategy registry.rank(String originalQuery, List<CharacteristicValueObject> rawHits, Map<String, Integer> usageCountsByUri) Re-orderrawHitsaccording to this strategy.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AnnotationSearchRankingStrategy
rank, rank, requiresStringPrior, requiresUsageCounts
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
TokenCoverageRankingStrategy
public TokenCoverageRankingStrategy()
-
-
Method Details
-
rank
public List<CharacteristicValueObject> rank(String originalQuery, List<CharacteristicValueObject> rawHits, Map<String, Integer> usageCountsByUri) Description copied from interface:AnnotationSearchRankingStrategyRe-orderrawHitsaccording to this strategy.- Specified by:
rankin interfaceAnnotationSearchRankingStrategy- Parameters:
originalQuery- the original query string the user typed; whitespace-tokenised and lowercased by token-coverage strategies; may be blank.rawHits- the Lucene-ordered hits; index in this list is the "original rank" used by rank-aware strategies. Must not be mutated.usageCountsByUri- per-URI count of distinct experiments referencing the URI; may be empty.- Returns:
- a new list of the same hits in the desired display order.
-
getName
Description copied from interface:AnnotationSearchRankingStrategyShort stable name used as the value of the?rank=query parameter and as the bean name in the strategy registry. Lowercase, single word.- Specified by:
getNamein interfaceAnnotationSearchRankingStrategy
-