:Util::Json;
use Scalar::Util qw( blessed );
use KinoSearch qw( to_clownfish );
use KinoSearch::Util::StringHelper qw( utf8_valid utf8_flag_on );
use JSON::XS qw();
my $json_encod
_json {
my ( undef, %args ) = @_;
my $result;
my $instream = $args{folder}->open_in( $args{path} )
or return;
my $len = $instream->length;
my $json;
$instream->read( $json, $len );
if ( utf8_valid($json) ) {
utf8_flag_on($json);
$result = eval { to_clownfish( $json_encoder->decode($json) ) };
}
package KinoSearch::Util::Json;
use KinoSearch;
1;
__END__
__COPYRIGHT__
Copyright 2005-2011 Marvin Humphrey
This program is free software; you can redistribute it and/or modify
under the same te
#!/usr/local/bin/perl
use strict;
use warnings;
use Carp;
use SVN::Class;
use FindBin;
use JSON::XS;
use Email::Stuff;
use Sys::Hostname;
my $config = {
src => Path::Class::Dir->new( $FindBin::Bi
) {
my $config_file = Path::Class::File->new( shift @ARGV );
my $supplied_conf = decode_json( $config_file->slurp );
$config = { %$config, %$supplied_conf };
}
if (!$config->{src}) {
ull
system and test summary is printed to stdout.
You may specify an alternate path to test in a JSON-formatted config file.
Use the 'src' config option to specify a path. Example:
{ 'src' : '/pat
pshot_XXX.json
|--schema_XXX.json
|--write.lock
|
|--seg_1--|
| |--segmeta.json
| |--cfmeta.json
ons]
|
|--seg_2--|
| |--segmeta.json
| |--cfmeta.json
| |--cf.dat-------|
|
the
entire index rather than to a particular segment.
=head2 snapshot_XXX.json
A "snapshot" file, e.g. C<snapshot_m7p.json>, is list of index files and
directories. Because index files, once writt
epresentation of the object using only scalars, hashes, and
arrays. Some implementations support JSON serialization via dump() and
its companion method, load(); for others, dump() is only a debugging
t: its
fields, document count, and so on. The Segment object itself writes one
file, C<< segmeta.json >>; besides storing info needed by Segment
itself, the "segmeta" file serves as a central reposit
d twice.
=over
=item *
B<key> - String identifying an index component.
=item *
B<metadata> - JSON-izable data structure.
=back
=head2 fetch_metadata(key)
Fetch a value from the Segment's metad