mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-22 07:42:16 +00:00
Introduce `fulltext_index`, a new `custom_index` subclass for full-text search (FTS). The index validates that the target column is a text type (text, varchar, or ascii) and supports two WITH OPTIONS keys: - 'analyzer': one of standard, english, german, french, spanish, italian, portuguese, russian, chinese, japanese, korean, simple, whitespace - 'positions': boolean controlling whether term positions are stored `view_should_exist()` returns false — no backing materialized view is created, matching the CDC-backed pattern used by `vector_index`. Fixes: SCYLLADB-1517
44 lines
1.4 KiB
C++
44 lines
1.4 KiB
C++
/*
|
|
* Copyright 2026-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "schema/schema.hh"
|
|
|
|
#include "data_dictionary/data_dictionary.hh"
|
|
#include "cql3/statements/index_target.hh"
|
|
#include "index/secondary_index_manager.hh"
|
|
|
|
#include <vector>
|
|
|
|
namespace secondary_index {
|
|
|
|
class fulltext_index : public custom_index {
|
|
public:
|
|
std::string_view index_type_name() const override {
|
|
return "fulltext";
|
|
}
|
|
|
|
fulltext_index() = default;
|
|
~fulltext_index() override = default;
|
|
std::optional<cql3::description> describe(const index_metadata& im, const schema& base_schema) const override;
|
|
bool view_should_exist() const override;
|
|
void validate(const schema& schema, const cql3::statements::index_specific_prop_defs& properties,
|
|
const std::vector<::shared_ptr<cql3::statements::index_target>>& targets, const gms::feature_service& fs,
|
|
const data_dictionary::database& db) const override;
|
|
utils::UUID index_version(const schema& schema) override;
|
|
|
|
private:
|
|
void check_target(const schema& schema, const std::vector<::shared_ptr<cql3::statements::index_target>>& targets) const;
|
|
void check_index_options(const cql3::statements::index_specific_prop_defs& properties) const;
|
|
};
|
|
|
|
std::unique_ptr<secondary_index::custom_index> fulltext_index_factory();
|
|
|
|
} // namespace secondary_index
|