aboutsummaryrefslogtreecommitdiff
path: root/icing/scoring/priority-queue-scored-document-hits-ranker.h
diff options
context:
space:
mode:
authorArmaan Danewalia <adanewalia@google.com>2022-11-11 18:53:19 +0000
committerArmaan Danewalia <adanewalia@google.com>2022-11-11 20:38:15 +0000
commit2658f90984737e5bf6c76d82024103dccd4d51c6 (patch)
tree829722f920f1bca12a8e15bf3b81d87c24673e24 /icing/scoring/priority-queue-scored-document-hits-ranker.h
parent0cdc7152cbee44a55b800ef1ac4cb4ee609c0389 (diff)
downloadicing-2658f90984737e5bf6c76d82024103dccd4d51c6.tar.gz
Sync from upstream.
Descriptions: ====================================================================== Include equals-proto and convert CodeToString methods to inline. ====================================================================== Add schema and document generators used by monkey test ====================================================================== Create in-memory icing for monkey testing ====================================================================== [NumericSearch][Storage][refactor_posting_list][1/x] Create PostingListUsedHitSerializer ====================================================================== [NumericSearch][Storage][refactor_posting_list][2/x] Create PostingListUsedHitSerializerTest ====================================================================== [NumericSearch][Storage][refactor_posting_list][3/x] Refactor all posting list related classes to use PostingListUsedSerializer ====================================================================== Adds a JoinSpecProto, and a new ranking strategy ====================================================================== Create Monkey Test Runner that randomly performs Icing API calls and check the results with the in-memory Icing ====================================================================== Support monkey testing the DeleteByQuery and Search APIs of Icing search engine ====================================================================== Directly include proto.h files from portable_proto_library() instead of wrapper pb.h files. ====================================================================== Directly include proto.h files from portable_proto_library() instead of wrapper pb.h files. ====================================================================== Directly include proto.h files from portable_proto_library() instead of wrapper pb.h files. ====================================================================== Removes nested_query from JoinSpec, as nested_search_spec includes it. ====================================================================== Directly include proto.h files from portable_proto_library() instead of wrapper pb.h files. ====================================================================== Swap the order when we build the doc-hit-info-iterator-and. ====================================================================== Support monkey testing section restrictions in the DeleteByQuery and Search APIs ====================================================================== Allow the in-memory icing to return the number of deleted documents, and check it with the delete stats of DeleteByNamespace, DeleteBySchemaType, and DeleteByQuery in the monkey test ====================================================================== [NumericSearch][Storage][refactor_posting_list][4/x] Move posting list common files into another directory ====================================================================== Add file-skipping for exports to Jetpack using @exportToAOSP:skipFile() tag ====================================================================== Change invalid type int32 to int32_t in icing-search-enging-jni.cc. ====================================================================== Minor fix, move generate term_iterator inside of the ranking_strategy checking ====================================================================== Address index out of bounds issue in third_party/icing/result/snippet-retriever.cc. This issue is causing test failures (see example failure: http://sponge2/cfcda71a-1312-455a-9a70-821c74c708e6). ====================================================================== Fix 1 DependencyCleaner findings: ====================================================================== Implement URL tokenization for Icing-lib [2/2]: ====================================================================== [NumericSearch][General][1/x] Create numeric.proto and add IntegerIndexingConfig ====================================================================== [NumericSearch][General][2/x] Refactor GetStringSectionContent and GetStringPropertyContent ====================================================================== [NumericSearch][General][3/x] Add DataType into SectionMetadata and change AssignSections ====================================================================== Move unit test constant definition into schema builder ====================================================================== [NumericSearch][General][4/x] Create templated Section and SectionGroup ====================================================================== [NumericSearch][General][5/x] Create BasicHit ====================================================================== Change URL tokenizer's url_parse dependency to use third_party/url_parse:url_parse_stripped_down ====================================================================== Exclude memory-mapped-file-leak_test.cc from export to AOSP. ====================================================================== Rollback of changelist 487633403. Reason: This cl breaks YouTube Music builds due to duplicate symbols. ====================================================================== [ez] Fix ScoredDocumentHit related comparators ====================================================================== Bug: 193244409 Bug: 246984163 Bug: 249829533 Bug: 256022027 Bug: 256679292 Bug: 246964044 Change-Id: I55c2ed417a31321c22de377e97ffe0096478d28c
Diffstat (limited to 'icing/scoring/priority-queue-scored-document-hits-ranker.h')
-rw-r--r--icing/scoring/priority-queue-scored-document-hits-ranker.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/icing/scoring/priority-queue-scored-document-hits-ranker.h b/icing/scoring/priority-queue-scored-document-hits-ranker.h
index e0ae4b0..3ef2ae5 100644
--- a/icing/scoring/priority-queue-scored-document-hits-ranker.h
+++ b/icing/scoring/priority-queue-scored-document-hits-ranker.h
@@ -51,7 +51,14 @@ class PriorityQueueScoredDocumentHitsRanker : public ScoredDocumentHitsRanker {
bool operator()(const ScoredDocumentHit& lhs,
const ScoredDocumentHit& rhs) const {
- return is_ascending_ == !(lhs < rhs);
+ // STL comparator requirement: equal MUST return false.
+ // If writing `return is_ascending_ == !(lhs < rhs)`:
+ // - When lhs == rhs, !(lhs < rhs) is true
+ // - If is_ascending_ is true, then we return true for equal case!
+ if (is_ascending_) {
+ return rhs < lhs;
+ }
+ return lhs < rhs;
}
private: