1Lucy::Plan::Schema(3) User Contributed Perl DocumentationLucy::Plan::Schema(3)
2
3
4

NAME

6       Lucy::Plan::Schema - User-created specification for an inverted index.
7

SYNOPSIS

9           use Lucy::Plan::Schema;
10           use Lucy::Plan::FullTextType;
11           use Lucy::Analysis::EasyAnalyzer;
12
13           my $schema = Lucy::Plan::Schema->new;
14           my $easyanalyzer = Lucy::Analysis::EasyAnalyzer->new(
15               language => 'en',
16           );
17           my $type = Lucy::Plan::FullTextType->new(
18               analyzer => $easyanalyzer,
19           );
20           $schema->spec_field( name => 'title',   type => $type );
21           $schema->spec_field( name => 'content', type => $type );
22

DESCRIPTION

24       A Schema is a specification which indicates how other entities should
25       interpret the raw data in an inverted index and interact with it.
26
27       Once an actual index has been created using a particular Schema,
28       existing field definitions may not be changed.  However, it is possible
29       to add new fields during subsequent indexing sessions.
30

CONSTRUCTORS

32   new
33           my $schema = Lucy::Plan::Schema->new;
34
35       Constructor.  Takes no arguments.
36

METHODS

38   architecture
39           my $architecture = $schema->architecture();
40
41       Factory method which creates an Architecture object for this index.
42
43   spec_field
44           $schema->spec_field(
45               name => $name,  # required
46               type => $type,  # required
47           );
48
49       Define the behavior of a field by associating it with a FieldType.
50
51       If this method has already been called for the supplied "field", it
52       will merely test to verify that the supplied FieldType equals() the
53       existing one.
54
55name - The name of the field.
56
57type - A FieldType.
58
59   fetch_type
60           my $field_type = $schema->fetch_type($field);
61
62       Return the FieldType for the specified field.  If the field canXt be
63       found, return undef.
64
65   fetch_sim
66           my $similarity = $schema->fetch_sim($field);
67           my $similarity = $schema->fetch_sim();  # default: undef
68
69       Return the Similarity for the specified field, or undef if either the
70       field canXt be found or it isnXt associated with a Similarity.
71
72   num_fields
73           my $int = $schema->num_fields();
74
75       Return the number of fields currently defined.
76
77   all_fields
78           my $arrayref = $schema->all_fields();
79
80       Return all the SchemaXs field names as an array.
81
82   get_architecture
83           my $architecture = $schema->get_architecture();
84
85       Return the Schema instanceXs internal Architecture object.
86
87   get_similarity
88           my $similarity = $schema->get_similarity();
89
90       Return the Schema instanceXs internal Similarity object.
91

INHERITANCE

93       Lucy::Plan::Schema isa Clownfish::Obj.
94
95
96
97perl v5.32.1                      2021-01-27             Lucy::Plan::Schema(3)
Impressum