aboutsummaryrefslogtreecommitdiff
path: root/icing/join/join-processor.cc
diff options
context:
space:
mode:
authorAlex Saveliev <alexsav@google.com>2023-01-09 13:06:06 -0800
committerAlex Saveliev <alexsav@google.com>2023-01-09 21:26:30 +0000
commit947f3d55bb1871285790facda2aa76e02c27a289 (patch)
tree0ba91ee8775e34738340187614b97b6c5ffcbc8c /icing/join/join-processor.cc
parentf8df5d1dcc23114edb8cd61d0cfb2f1ae6f2ea6f (diff)
parentec29b14d5a908748d6e0699df7c85842a95a7b3c (diff)
downloadicing-947f3d55bb1871285790facda2aa76e02c27a289.tar.gz
Merge remote-tracking branch 'aosp/upstream-master' into androidx-main
Descriptions: ====================================================================== Apply aggregation score to join result and create JoinProcessorTest ====================================================================== Create AggregationScorerTest ====================================================================== Add an EqualsTermMatchInfo matcher to simplify tests that interact with this struct. ====================================================================== Refactor the QueryVisitor to return QueryResults. ====================================================================== Simplify ScoreExpression to ConstantScoreExpression if its evaluation does not depend on a document ====================================================================== Use rvalue and std::move for DocumentStore methods ====================================================================== Downgrade log messages for NOT_FOUND errors in Delete calls. ====================================================================== [NumericSearch][Storage][3.1/x] Add metadata file declaration (Crcs, Info) for IntegerIndexStorage ====================================================================== [NumericSearch][Storage][3.0/x] Declare class IntegerIndexStorage ====================================================================== Cleanup Import from //tools/build_defs/objc ====================================================================== Cleanup LSC: Remove `portable_proto_library()` targets ====================================================================== Bug: 256022027 Bug: 208654892 Bug: 261474063 Bug: 246628980 Bug: 249829533 Bug: 263373214 Change-Id: Ic3238f17efa72dd1c6dbc559d32c11f475cebf88
Diffstat (limited to 'icing/join/join-processor.cc')
-rw-r--r--icing/join/join-processor.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/icing/join/join-processor.cc b/icing/join/join-processor.cc
index 9b17396..7700397 100644
--- a/icing/join/join-processor.cc
+++ b/icing/join/join-processor.cc
@@ -23,6 +23,7 @@
#include "icing/text_classifier/lib3/utils/base/statusor.h"
#include "icing/absl_ports/canonical_errors.h"
#include "icing/absl_ports/str_cat.h"
+#include "icing/join/aggregation-scorer.h"
#include "icing/join/qualified-id.h"
#include "icing/proto/scoring.pb.h"
#include "icing/proto/search.pb.h"
@@ -45,8 +46,6 @@ JoinProcessor::Join(
ScoringSpecProto::Order::DESC));
// TODO(b/256022027):
- // - Aggregate scoring
- // - Calculate the aggregated score if strategy is AGGREGATION_SCORING.
// - Optimization
// - Cache property to speed up property retrieval.
// - If there is no cache, then we still have the flexibility to fetch it
@@ -93,6 +92,9 @@ JoinProcessor::Join(
}
}
+ std::unique_ptr<AggregationScorer> aggregation_scorer =
+ AggregationScorer::Create(join_spec);
+
std::vector<JoinedScoredDocumentHit> joined_scored_document_hits;
joined_scored_document_hits.reserve(parent_scored_document_hits.size());
@@ -110,14 +112,15 @@ JoinProcessor::Join(
"Parent property expression must be ", kQualifiedIdExpr));
}
- // TODO(b/256022027): Derive final score from
- // parent_id_to_child_map[parent_doc_id] and
- // join_spec.aggregation_score_strategy()
- double final_score = parent.score();
- joined_scored_document_hits.emplace_back(
- final_score, std::move(parent),
- std::vector<ScoredDocumentHit>(
- std::move(parent_id_to_child_map[parent_doc_id])));
+ std::vector<ScoredDocumentHit> children;
+ if (auto iter = parent_id_to_child_map.find(parent_doc_id);
+ iter != parent_id_to_child_map.end()) {
+ children = std::move(iter->second);
+ }
+
+ double final_score = aggregation_scorer->GetScore(parent, children);
+ joined_scored_document_hits.emplace_back(final_score, std::move(parent),
+ std::move(children));
}
return joined_scored_document_hits;