# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#     http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# See the License for the specific language governing permissions and
# limitations under the License.

=head1 NAME

Lucy::Docs::Tutorial::FieldType - Specify per-field properties and


The Schema we used in the last chapter specifies three fields: 

    my $type = Lucy::Plan::FullTextType->new(
        analyzer => $polyanalyzer,
    $schema->spec_field( name => 'title',   type => $type );
    $schema->spec_field( name => 'content', type => $type );
    $schema->spec_field( name => 'url',     type => $type );

Since they are all defined as "full text" fields, they are all searchable --
including the C<url> field, a dubious choice.  Some URLs contain meaningful
information, but these don't, really:


We may as well not bother indexing the URL content.  To achieve that we need
to assign the C<url> field to a different FieldType.  

=head2 StringType

Instead of FullTextType, we'll use a
L<StringType|Lucy::Plan::StringType>, which doesn't use an
Analyzer to break up text into individual fields.  Furthermore, we'll mark
this StringType as unindexed, so that its content won't be searchable at all.

    my $url_type = Lucy::Plan::StringType->new( indexed => 0 );
    $schema->spec_field( name => 'url', type => $url_type );

To observe the change in behavior, try searching for C<us_constitution> both
before and after changing the Schema and re-indexing.

=head2 Toggling 'stored'

For a taste of other FieldType possibilities, try turning off C<stored> for
one or more fields.

    my $content_type = Lucy::Plan::FullTextType->new(
        analyzer => $polyanalyzer,
        stored   => 0,

Turning off C<stored> for either C<title> or C<url> mangles our results page,
but since we're not displaying C<content>, turning it off for C<content> has
no effect -- except on index size.

=head2 Analyzers up next

Analyzers play a crucial role in the behavior of FullTextType fields.  In our
next tutorial chapter, L<Lucy::Docs::Tutorial::Analysis>, we'll see how
changing up the Analyzer changes search results.