projects
/
angular-mojolicious.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
50eae40
)
improve schema and store original document in json blob
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 7 Dec 2010 18:31:28 +0000
(19:31 +0100)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 7 Dec 2010 18:31:28 +0000
(19:31 +0100)
trigger/KinoSearch.pm
patch
|
blob
|
history
diff --git
a/trigger/KinoSearch.pm
b/trigger/KinoSearch.pm
index
a2cdc16
..
7c2d048
100644
(file)
--- a/
trigger/KinoSearch.pm
+++ b/
trigger/KinoSearch.pm
@@
-11,8
+11,11
@@
my $polyanalyzer = KinoSearch::Analysis::PolyAnalyzer->new(
my $type = KinoSearch::Plan::FullTextType->new(
analyzer => $polyanalyzer,
);
my $type = KinoSearch::Plan::FullTextType->new(
analyzer => $polyanalyzer,
);
-$schema->spec_field( name => '_id', type => $type );
-$schema->spec_field( name => '_rev', type => $type );
+my $blob_type = KinoSearch::Plan::BlobType->new( stored => 1 );
+my $string_type = KinoSearch::Plan::StringType->new;
+$schema->spec_field( name => '_id', type => $string_type );
+$schema->spec_field( name => '_rev', type => $string_type );
+$schema->spec_field( name => 'doc', type => $blob_type );
# Create the index and add documents.
our $indexer;
# Create the index and add documents.
our $indexer;
@@
-54,6
+57,7
@@
sub filter {
$schema->spec_field( name => $field, type => $type );
warn "# +++ $field\n";
}
$schema->spec_field( name => $field, type => $type );
warn "# +++ $field\n";
}
+ $flat->{doc} = encode_json $doc;
warn "# add_doc ",dump($flat);
_indexer->add_doc($flat);
return 0;
warn "# add_doc ",dump($flat);
_indexer->add_doc($flat);
return 0;
@@
-62,7
+66,7
@@
sub filter {
sub commit {
$indexer->commit;
undef $indexer;
sub commit {
$indexer->commit;
undef $indexer;
- warn "# commit index done";
+ warn "# commit index done
\n
";
}
1;
}
1;