Lucy::Plan::Schema - User-created specification for an inverted index.
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 );
A Schema is a specification which indicates how other entities should interpret the raw data in an inverted index and interact with it.
Once an actual index has been created using a particular Schema, existing field definitions may not be changed. However, it is possible to add new fields during subsequent indexing sessions.
my $schema = Lucy::Plan::Schema->new;
Constructor. Takes no arguments.
my $architecture = $schema->architecture();
Factory method which creates an Architecture object for this index.
$schema->spec_field( name => $name # required type => $type # required );
Define the behavior of a field by associating it with a FieldType.
If this method has already been called for the supplied
it will merely test to verify that the supplied FieldType equals() the existing one.
my $field_type = $schema->fetch_type($field);
Return the FieldType for the specified field. If the field can’t be found, return undef.
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.
my $int = $schema->num_fields();
Return the number of fields currently defined.
my $arrayref = $schema->all_fields();
Return all the Schema’s field names as an array.
my $architecture = $schema->get_architecture();
Return the Schema instance’s internal Architecture object.
my $similarity = $schema->get_similarity();
Return the Schema instance’s internal Similarity object.
Lucy::Plan::Schema isa Clownfish::Obj.
Copyright © 2010-2015 The Apache Software Foundation, Licensed under the
Apache License, Version 2.0.
Apache Lucy, Lucy, Apache, the Apache feather logo, and the Apache Lucy project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.