Copilot commented on code in PR #56329:
URL: https://github.com/apache/doris/pull/56329#discussion_r2371429265
##########
be/src/olap/rowset/segment_v2/inverted_index/query_v2/intersection_scorer.cpp:
##########
@@ -90,6 +91,78 @@ ScorerPtr intersection_scorer_build(std::vector<ScorerPtr>&
scorers) {
std::move(others));
}
+AndNotScorer::AndNotScorer(ScorerPtr include, std::vector<ScorerPtr> excludes)
+ : _include(std::move(include)), _excludes(std::move(excludes)) {
+ if (_include != nullptr) {
+ _align(_include->doc());
Review Comment:
The constructor calls `_align()` but doesn't store its return value, which
could leave the scorer in an inconsistent state if the initial document needs
to be skipped due to exclusions.
```suggestion
uint32_t aligned_doc = _align(_include->doc());
// If there is a member variable to store the doc, assign it here.
// _doc = aligned_doc; // Uncomment if _doc exists.
```
##########
be/src/olap/rowset/segment_v2/inverted_index/query_v2/match_all_docs_scorer.h:
##########
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <utility>
+#include <vector>
+
+#include "CLucene.h" // IWYU pragma: keep
+#include "olap/rowset/segment_v2/inverted_index/query_v2/scorer.h"
+
+namespace doris::segment_v2::inverted_index::query_v2 {
+
+class MatchAllDocsScorer : public Scorer {
+public:
+ MatchAllDocsScorer(uint32_t max_doc,
std::vector<lucene::index::IndexReader*> readers)
+ : _max_doc(max_doc), _readers(std::move(readers)) {
Review Comment:
The constructor parameter `readers` should be passed by const reference
instead of by value to avoid unnecessary copying of the vector.
```suggestion
MatchAllDocsScorer(uint32_t max_doc, const
std::vector<lucene::index::IndexReader*>& readers)
: _max_doc(max_doc), _readers(readers) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]