csun5285 commented on code in PR #40758:
URL: https://github.com/apache/doris/pull/40758#discussion_r1756725355
##########
be/src/olap/rowset/segment_v2/inverted_index_writer.cpp:
##########
@@ -145,34 +146,15 @@ class InvertedIndexColumnWriterImpl : public
InvertedIndexColumnWriter {
return open_index_directory();
}
- std::unique_ptr<lucene::analysis::Analyzer> create_chinese_analyzer() {
- auto chinese_analyzer =
std::make_unique<lucene::analysis::LanguageBasedAnalyzer>();
- chinese_analyzer->setLanguage(L"chinese");
- chinese_analyzer->initDict(config::inverted_index_dict_path);
-
- auto mode =
get_parser_mode_string_from_properties(_index_meta->properties());
- if (mode == INVERTED_INDEX_PARSER_FINE_GRANULARITY) {
- chinese_analyzer->setMode(lucene::analysis::AnalyzerMode::All);
- } else {
- chinese_analyzer->setMode(lucene::analysis::AnalyzerMode::Default);
- }
-
- return chinese_analyzer;
- }
-
- Status create_char_string_reader(std::unique_ptr<lucene::util::Reader>&
string_reader) {
- CharFilterMap char_filter_map =
-
get_parser_char_filter_map_from_properties(_index_meta->properties());
- if (!char_filter_map.empty()) {
- string_reader =
std::unique_ptr<lucene::util::Reader>(CharFilterFactory::create(
- char_filter_map[INVERTED_INDEX_PARSER_CHAR_FILTER_TYPE],
- new lucene::util::SStringReader<char>(),
- char_filter_map[INVERTED_INDEX_PARSER_CHAR_FILTER_PATTERN],
-
char_filter_map[INVERTED_INDEX_PARSER_CHAR_FILTER_REPLACEMENT]));
- } else {
- string_reader =
std::make_unique<lucene::util::SStringReader<char>>();
+ Status create_char_string_reader(std::unique_ptr<lucene::util::Reader>&
string_reader,
Review Comment:
std::unique_ptr<lucene::util::Reader>* string_reader
##########
be/src/olap/rowset/segment_v2/inverted_index/analyzer/analyzer.h:
##########
@@ -0,0 +1,48 @@
+// 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 <memory>
+
+#include "olap/inverted_index_parser.h"
+#include "olap/rowset/segment_v2/inverted_index_query_type.h"
+
+namespace lucene {
+namespace util {
+class Reader;
+}
+namespace analysis {
+class Analyzer;
+}
+} // namespace lucene
+
+namespace doris::segment_v2::inverted_index {
+class InvertedIndexAnalyzer {
+public:
+ static std::unique_ptr<lucene::util::Reader> create_reader(CharFilterMap&
char_filter_map);
+
+ static std::unique_ptr<lucene::analysis::Analyzer> create_analyzer(
+ const InvertedIndexCtx* inverted_index_ctx);
+
+ static void get_analyse_result(std::vector<std::string>& analyse_result,
Review Comment:
std::vector<std::string>* analyse_result
##########
be/src/olap/rowset/segment_v2/inverted_index_writer.cpp:
##########
@@ -207,54 +189,30 @@ class InvertedIndexColumnWriterImpl : public
InvertedIndexColumnWriter {
return Status::OK();
}
- Status create_analyzer(std::unique_ptr<lucene::analysis::Analyzer>&
analyzer) {
+ Status create_analyzer(std::unique_ptr<lucene::analysis::Analyzer>&
analyzer,
Review Comment:
std::unique_ptr<lucene::analysis::Analyzer>* analyzer
--
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]