@@ -1549,9 +1549,11 @@ Option<bool> CollectionManager::do_search(std::map<std::string, std::string>& re
 
             AnalyticsManager::get_instance().add_suggestion(orig_coll_name, analytics_query, expanded_query,
                                                             true, req_params["x-typesense-user-id"]);
+#ifdef ENABLE_QUERY_HITS
             AnalyticsManager::get_instance().add_query_hits_count(orig_coll_name, analytics_query,
                                                                   req_params["x-typesense-user-id"],
                                                                   result["found"].get<size_t>());
+#endif
         } else if(result.contains("found") == 0 && result["found"].get<size_t>() == 0) {
             std::string analytics_query = Tokenizer::normalize_ascii_no_spaces(raw_query);
             AnalyticsManager::get_instance().add_nohits_query(orig_coll_name, analytics_query,