diff options
Diffstat (limited to 'icing/result/result-state-v2.cc')
-rw-r--r-- | icing/result/result-state-v2.cc | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/icing/result/result-state-v2.cc b/icing/result/result-state-v2.cc index e42620e..9459910 100644 --- a/icing/result/result-state-v2.cc +++ b/icing/result/result-state-v2.cc @@ -15,54 +15,33 @@ #include "icing/result/result-state-v2.h" #include <atomic> +#include <cstdint> #include <memory> +#include <string> +#include <vector> -#include "icing/proto/scoring.pb.h" #include "icing/proto/search.pb.h" -#include "icing/proto/term.pb.h" -#include "icing/result/projection-tree.h" -#include "icing/result/snippet-context.h" +#include "icing/result/result-adjustment-info.h" #include "icing/scoring/scored-document-hits-ranker.h" +#include "icing/store/document-store.h" namespace icing { namespace lib { -namespace { -SnippetContext CreateSnippetContext(SectionRestrictQueryTermsMap query_terms, - const SearchSpecProto& search_spec, - const ResultSpecProto& result_spec) { - if (result_spec.snippet_spec().num_to_snippet() > 0 && - result_spec.snippet_spec().num_matches_per_property() > 0) { - // Needs snippeting - return SnippetContext(std::move(query_terms), result_spec.snippet_spec(), - search_spec.term_match_type()); - } - return SnippetContext(/*query_terms_in=*/{}, - ResultSpecProto::SnippetSpecProto::default_instance(), - TermMatchType::UNKNOWN); -} -} // namespace - ResultStateV2::ResultStateV2( std::unique_ptr<ScoredDocumentHitsRanker> scored_document_hits_ranker_in, - SectionRestrictQueryTermsMap query_terms, - const SearchSpecProto& search_spec, const ScoringSpecProto& scoring_spec, + std::unique_ptr<ResultAdjustmentInfo> parent_adjustment_info, + std::unique_ptr<ResultAdjustmentInfo> child_adjustment_info, const ResultSpecProto& result_spec, const DocumentStore& document_store) : scored_document_hits_ranker(std::move(scored_document_hits_ranker_in)), num_returned(0), - snippet_context_(CreateSnippetContext(std::move(query_terms), search_spec, - result_spec)), + parent_adjustment_info_(std::move(parent_adjustment_info)), + child_adjustment_info_(std::move(child_adjustment_info)), num_per_page_(result_spec.num_per_page()), num_total_bytes_per_page_threshold_( result_spec.num_total_bytes_per_page_threshold()), num_total_hits_(nullptr), result_group_type_(result_spec.result_group_type()) { - for (const TypePropertyMask& type_field_mask : - result_spec.type_property_masks()) { - projection_tree_map_.insert( - {type_field_mask.schema_type(), ProjectionTree(type_field_mask)}); - } - for (const ResultSpecProto::ResultGrouping& result_grouping : result_spec.result_groupings()) { int group_id = group_result_limits.size(); |