-
-
04 Jul 2009 01:44:17 UTC
- Development release
- Distribution: KinoSearch
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (5)
- Testers (13 / 3 / 1)
- Kwalitee
Bus factor: 0- License: perl_5
- Activity
24 month- Tools
- Download (611.03KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Marvin Humphrey <marvin at rectangular dot com>
- Dependencies
- JSON::XS
- Lingua::Stem::Snowball
- Lingua::StopWords
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
KinoSearch::Docs::Tutorial::FieldType - Specify per-field properties and behaviors.
DESCRIPTION
The Schema we used in the last chapter specifies three fields:
my $type = KinoSearch::FieldType::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
url
field, a dubious choice. Some URLs contain meaningful information, but these don't, really:http://example.com/us_constitution/amend1.html
We may as well not bother indexing the URL content. To achieve that we need to assign the
url
field to a different FieldType.StringType
Instead of FullTextType, we'll use a 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 = KinoSearch::FieldType::StringType( indexed => 0 ); $schema->spec_field( name => 'url', type => $url_type );
To observe the change in behavior, try searching for
us_constitution
both before and after changing the Schema and re-indexing.Toggling 'stored'
For a taste of other FieldType possibilities, try turning off
stored
for one or more fields.my $content_type = KinoSearch::FieldType::FullTextType->new( analyzer => $polyanalyzer, stored => 0, );
Turning off
stored
for eithertitle
orurl
mangles our results page, but since we're not displayingcontent
, turning it off forcontent
has no effect -- except on index size.Analyzers up next
Analyzers play a crucial role in the behavior of FullTextType fields. In our next tutorial chapter, KinoSearch::Docs::Tutorial::Analysis, we'll see how changing up the Analyzer changes search results.
COPYRIGHT
Copyright 2008-2009 Marvin Humphrey
LICENSE, DISCLAIMER, BUGS, etc.
See KinoSearch version 0.30.
Module Install Instructions
To install KSx::Simple, copy and paste the appropriate command in to your terminal.
cpanm KSx::Simple
perl -MCPAN -e shell install KSx::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.