aboutsummaryrefslogtreecommitdiff
path: root/icing/scoring/bm25f-calculator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'icing/scoring/bm25f-calculator.cc')
-rw-r--r--icing/scoring/bm25f-calculator.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/icing/scoring/bm25f-calculator.cc b/icing/scoring/bm25f-calculator.cc
index 28ee2ba..f169cda 100644
--- a/icing/scoring/bm25f-calculator.cc
+++ b/icing/scoring/bm25f-calculator.cc
@@ -115,8 +115,8 @@ float Bm25fCalculator::ComputeScore(const DocHitInfoIterator* query_it,
score += idf_weight * normalized_tf;
}
- ICING_VLOG(1) << "BM25F: corpus_id:" << data.corpus_id() << " docid:"
- << hit_info.document_id() << " score:" << score;
+ ICING_VLOG(1) << "BM25F: corpus_id:" << data.corpus_id()
+ << " docid:" << hit_info.document_id() << " score:" << score;
return score;
}
@@ -152,8 +152,8 @@ float Bm25fCalculator::GetCorpusIdfWeightForTerm(std::string_view term,
float idf =
nqi != 0 ? log(1.0f + (num_docs - nqi + 0.5f) / (nqi + 0.5f)) : 0.0f;
corpus_idf_map_.insert({corpus_term_info.value, idf});
- ICING_VLOG(1) << "corpus_id:" << corpus_id << " term:"
- << term << " N:" << num_docs << "nqi:" << nqi << " idf:" << idf;
+ ICING_VLOG(1) << "corpus_id:" << corpus_id << " term:" << term
+ << " N:" << num_docs << "nqi:" << nqi << " idf:" << idf;
return idf;
}
@@ -200,9 +200,10 @@ float Bm25fCalculator::ComputedNormalizedTermFrequency(
float normalized_tf =
f_q * (k1_ + 1) / (f_q + k1_ * (1 - b_ + b_ * dl / avgdl));
- ICING_VLOG(1) << "corpus_id:" << data.corpus_id() << " docid:"
- << hit_info.document_id() << " dl:" << dl << " avgdl:" << avgdl << " f_q:"
- << f_q << " norm_tf:" << normalized_tf;
+ ICING_VLOG(1) << "corpus_id:" << data.corpus_id()
+ << " docid:" << hit_info.document_id() << " dl:" << dl
+ << " avgdl:" << avgdl << " f_q:" << f_q
+ << " norm_tf:" << normalized_tf;
return normalized_tf;
}
@@ -214,8 +215,8 @@ float Bm25fCalculator::ComputeTermFrequencyForMatchedSections(
SchemaTypeId schema_type_id = GetSchemaTypeId(document_id);
while (sections != 0) {
- SectionId section_id = __builtin_ctz(sections);
- sections &= ~(1u << section_id);
+ SectionId section_id = __builtin_ctzll(sections);
+ sections &= ~(UINT64_C(1) << section_id);
Hit::TermFrequency tf = term_match_info.term_frequencies[section_id];
double weighted_tf = tf * section_weights_->GetNormalizedSectionWeight(
@@ -236,7 +237,7 @@ SchemaTypeId Bm25fCalculator::GetSchemaTypeId(DocumentId document_id) const {
// allocated document_ids, which shouldn't be possible since we're getting
// this document_id from the posting lists.
ICING_LOG(WARNING) << "No document filter data for document ["
- << document_id << "]";
+ << document_id << "]";
return kInvalidSchemaTypeId;
}
return filter_data_optional.value().schema_type_id();