[KinoSearch] KSx::Search::LongFieldSim in revision 3811
Henka
henka at cityweb.co.za
Fri Sep 5 07:10:55 PDT 2008
Here's the diff for the schema and indexer.
--- sample-orig/USConSchema.pm 2008-09-03 14:43:11.000000000 +0200
+++ sample-longfield-sim/USConSchema.pm 2008-09-05 12:53:02.000000000 +0200
@@ -13,11 +13,18 @@
use base 'KinoSearch::Schema';
use KinoSearch::Analysis::PolyAnalyzer;
+package USConSchema::testfield;
+use base 'KinoSearch::FieldSpec::text';
+use KSx::Search::LongFieldSim;
+sub similarity { KSx::Search::LongFieldSim->new }
+
+
our %fields = (
- title => 'text',
- content => 'text',
- url => 'USConSchema::NotIndexed',
- category => 'USConSchema::NotAnalyzed',
+ title => 'text',
+ content => 'text',
+ url => 'USConSchema::NotIndexed',
+ category => 'USConSchema::NotAnalyzed',
+ testfield => 'USConSchema::testfield',
);
sub analyzer {
----------------------------------
--- sample-orig/invindexer.pl 2008-09-03 14:43:11.000000000 +0200
+++ sample-longfield-sim/invindexer.pl 2008-09-05 16:08:57.000000000 +0200
@@ -4,7 +4,7 @@
# Load configuration file. (Note: change conf.pl location as needed.)
my $conf;
-BEGIN { $conf = do "sample/conf.pl" or die "Can't locate conf.pl"; }
+BEGIN { $conf = do "./conf.pl" or die "Can't locate conf.pl"; }
use lib @{ $conf->{lib} };
use File::Spec::Functions qw( catfile );
@@ -49,10 +49,10 @@
: $filename =~ /preamble/ ? 'preamble'
: die "Can't derive category for $filename";
return {
- title => $title_node->as_trimmed_text,
- content => $bodytext_node->as_trimmed_text,
- url => "/us_constitution/$filename",
- category => $category,
+ title => $title_node->as_trimmed_text,
+ content => $bodytext_node->as_trimmed_text,
+ testfield => $bodytext_node->as_trimmed_text,
+ url => "/us_constitution/$filename",
+ category => $category,
};
}
-
_______________________________________________
KinoSearch mailing list
KinoSearch at rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch
More information about the kinosearch
mailing list