Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/paimon/global_index/lucene/jieba_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
#include "paimon/global_index/lucene/jieba_analyzer.h"

#include "paimon/common/utils/string_utils.h"
#include "paimon/global_index/lucene/lucene_utils.h"

namespace paimon::lucene {
Expand Down Expand Up @@ -82,11 +83,6 @@ void JiebaTokenizer::CutWithMode(const std::string& tokenize_mode, const cppjieb
}
}

bool JiebaTokenizer::IsWhitespaceOnly(const std::string& term) {
return term.empty() ||
std::all_of(term.begin(), term.end(), [](unsigned char c) { return std::isspace(c); });
}

void JiebaTokenizer::Normalize(const std::unordered_set<std::string>& stop_words,
std::vector<std::string>* input_ptr,
std::vector<std::string_view>* output_ptr) {
Expand All @@ -95,7 +91,7 @@ void JiebaTokenizer::Normalize(const std::unordered_set<std::string>& stop_words
output.clear();
output.reserve(input.size());
for (auto& term : input) {
if (IsWhitespaceOnly(term)) {
if (StringUtils::IsNullOrWhitespaceOnly(term)) {
continue;
}
// remove stop words
Expand Down
2 changes: 0 additions & 2 deletions src/paimon/global_index/lucene/jieba_analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ class JiebaTokenizer : public Lucene::Tokenizer {
private:
void InnerReset();

static bool IsWhitespaceOnly(const std::string& term);

private:
JiebaTokenizerContext context_;
size_t term_index_ = 0;
Expand Down
Loading