Permalink
Browse files

Released version 0.03

  • Loading branch information...
1 parent 0dd88e7 commit edb169fe0245ecddecaaa7ecf7e15d76f07be1e6 Clinton Gormley committed May 9, 2011
Showing with 13 additions and 85 deletions.
  1. +6 −0 Changes
  2. +2 −2 META.yml
  3. +1 −1 README
  4. +2 −2 lib/ElasticSearchX/Autocomplete.pm
  5. +2 −0 t/pod-coverage.t
  6. +0 −80 test.pl
View
@@ -1,5 +1,11 @@
Revision history for ElasticSearchX-Autocomplete
+0.03 2011-05-09
+ Changed the structure of the docs to store one doc per context,
+ instead of listing each context inside a rank object
+
+ If UNDEF is returned from the cache, don't treat as not-found.
+
0.02 2011-05-05
Fixed a syntax error in index_phrases
View
@@ -16,7 +16,7 @@ name: ElasticSearchX-Autocomplete
provides:
ElasticSearchX::Autocomplete:
file: lib/ElasticSearchX/Autocomplete.pm
- version: 0.02
+ version: 0.03
ElasticSearchX::Autocomplete::Indexer:
file: lib/ElasticSearchX/Autocomplete/Indexer.pm
ElasticSearchX::Autocomplete::Indexer::Type:
@@ -34,4 +34,4 @@ resources:
bugtracker: https://github.com/clintongormley/ElasticSearchX-Autocomplete/issues
license: http://dev.perl.org/licenses/
repository: https://github.com/clintongormley/ElasticSearchX-Autocomplete/
-version: 0.02
+version: 0.03
View
2 README
@@ -3,7 +3,7 @@ NAME
frequency and geolocation
VERSION
- Version 0.01 - alpha
+ Version 0.03 - alpha
DESCRIPTION
"ElasticSearchX::Autocomplete" helps you to build autocomplete indexes
@@ -10,7 +10,7 @@ use ElasticSearchX::Autocomplete::Type();
use JSON();
our $JSON = JSON->new()->utf8(1);
-our $VERSION = '0.02';
+our $VERSION = '0.03';
__PACKAGE__->_create_accessors(
['cache'],
@@ -82,7 +82,7 @@ and geolocation
=head1 VERSION
-Version 0.02 - alpha
+Version 0.03 - alpha
=head1 DESCRIPTION
View
@@ -2,6 +2,8 @@ use strict;
use warnings;
use Test::More;
+plan skip_all => 'Docs not written yet';
+
# Ensure a recent version of Test::Pod::Coverage
my $min_tpc = 1.08;
eval "use Test::Pod::Coverage $min_tpc";
View
80 test.pl
@@ -1,80 +0,0 @@
-#!/usr/local/bin/perl -d
-
-use strict;
-use warnings;
-
-use lib 'lib';
-use lib '/opt/apache/sites/Projects/ElasticSearch/lib';
-use ElasticSearchX::Autocomplete;
-
-our ( $c, $e );
-
-BEGIN {
- $c = ElasticSearch->new(
- servers => '127.0.0.1:9200',
- transport => 'httplite'
- );
- $e = ElasticSearchX::Autocomplete->new(
- es => $c,
- index => 'suggest',
- type => 'phrase',
- min_length => 1,
- stop_words => [],
- debug => 1,
- );
-
-}
-
-sub restart {
- eval { $e->delete_index() };
- $e->create_index;
- $e->create_type();
-}
-
-sub parse {
- $e->index_phrases(
- min_freq => 2,
-
- # filename => 'phrases.json',
- query => {
- index => 'iannounce_object',
- type => [
- 'memorial', 'anniversary', 'wedding', 'birthday',
- 'bestwish', 'specialday'
- ],
- query => {
- constant_score => {
- filter => {
- and => [
- { term => { parent_id => 2876932 } },
- { exists => { field => 'location' } }
- ]
- }
- }
- }
-
- },
- parser => sub {
- my ( $e, $doc ) = @_;
- my $src = $doc->{_source};
- my ( $pid, $region, $source )
- = map { $src->{$_} } qw(parent_id region source );
- my @contexts = ( $pid, "$pid $region", "$pid $region $source" );
- my @locations;
-
- my $location = $src->{location};
- $location =~ s/[()0-9]+//g;
- $location =~ s/\b(a|aux|le|la|les|du|de|d),/$1 /gi;
- $location =~ s/' /'/g;
- $location =~ s/\s*-\s*/-/g;
-
- for ( grep {$_} split /\s*,\s*/, $location ) {
- next unless $_;
- push @locations, lc $_;
- }
- return
- map { { phrase => $_, label => $_, contexts => \@contexts } }
- @locations;
- }
- );
-}

0 comments on commit edb169f

Please sign in to comment.