Lucy::...Schema(3pm)
β¨ Lucy::Plan::Schema β the blueprint era β¨
Lucy::Plan::Schema is the user-created spec for an inverted index, straight outta the User Contributed Perl Documentation. She's giving architect energy. π
πΈ SYNOPSIS πΈ
use Lucy::Plan::Schema;
use Lucy::Plan::FullTextType;
use Lucy::Analysis::EasyAnalyzer;
my $schema = Lucy::Plan::Schema->new;
my $easyanalyzer = Lucy::Analysis::EasyAnalyzer->new(
language => 'en',
);
my $type = Lucy::Plan::FullTextType->new(
analyzer => $easyanalyzer,
);
$schema->spec_field( name => 'title', type => $type );
$schema->spec_field( name => 'content', type => $type );
π¦ DESCRIPTION π¦
Okay so bestie, a Schema is a specification β it tells all the other entities how they should interpret the raw data sitting in an inverted index, and how they should interact with it. She's the group chat rules, but for your index. π
Here's the tea though: once an actual index has been created using a particular Schema, the existing field definitions may not be changed. Periodt, that's locked in. However β and this is the slay part β it is possible to add new fields during subsequent indexing sessions. Growth mindset, fr fr. β¨
π CONSTRUCTORS π
new
my $schema = Lucy::Plan::Schema->new;
The constructor, queen. Takes no arguments β she needs nothing from you, she's already that girl. π
π METHODS π
architecture
my $architecture = $schema->architecture();
Factory method that creates an Architecture object for this index. Iconic, lowkey. ποΈ
spec_field
$schema->spec_field(
name => $name, # required
type => $type, # required
);
Define the behavior of a field by associating it with a FieldType. This is where you tell the field who she is. π
If this method has already been called for the supplied "field", it will merely test to verify that the supplied FieldType equals() the existing one. So no drama, she just double-checks. π
- name β The name of the field.
- type β A FieldType.
fetch_type
my $field_type = $schema->fetch_type($field);
Return the FieldType for the specified field. If the field can't be found, return undef. Not me getting ghosted by my own field π
fetch_sim
my $similarity = $schema->fetch_sim($field);
my $similarity = $schema->fetch_sim(); # default: undef
Return the Similarity for the specified field, or undef if either the field can't be found or it isn't associated with a Similarity. She's mysterious like that. π§
num_fields
my $int = $schema->num_fields();
Return the number of fields currently defined. Counting era. π’
all_fields
my $arrayref = $schema->all_fields();
Return all the Schema's field names as an array. The whole roster, the full lineup. β
get_architecture
my $architecture = $schema->get_architecture();
Return the Schema instance's internal Architecture object. Her inner architecture, if you will. ποΈ
get_similarity
my $similarity = $schema->get_similarity();
Return the Schema instance's internal Similarity object. Twin energy with fetch_sim but for the whole Schema. π«Ά
π INHERITANCE π
Lucy::Plan::Schema isa Clownfish::Obj. Family tree slay. π
vibe check passed: this is the User Contributed Perl Documentation version of the page, and the footer energy is perl v5.42.0, dated 2025-07-25. Bestie, you're all caught up β go spec some fields and slay. πβ¨ππ¦πΈπ π«Άππβ
π¦ where this page comes from
- fedora 43: perl-Lucy 0.6.2-26.fc43 Β· Apache-2.0 AND MIT AND Unicode-DFS-2015
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms