You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/12/23 01:09:32 UTC

[lucy-commits] svn commit: r1222519 - in /incubator/lucy/trunk/perl: MANIFEST buildlib/Lucy/Redacted.pm buildlib/Lucy/Test/TestUtils.pm buildlib/Lucy/Test/USConSchema.pm t/701-uscon.t

Author: marvin
Date: Fri Dec 23 00:09:31 2011
New Revision: 1222519

URL: http://svn.apache.org/viewvc?rev=1222519&view=rev
Log:
Remove subclassed USConSchema.

Remove USConSchema, replace with an ordinary Schema only created once at
index-time.  Replace its use of PolyAnalyzer with EasyAnalyzer.

Removed:
    incubator/lucy/trunk/perl/buildlib/Lucy/Test/USConSchema.pm
Modified:
    incubator/lucy/trunk/perl/MANIFEST
    incubator/lucy/trunk/perl/buildlib/Lucy/Redacted.pm
    incubator/lucy/trunk/perl/buildlib/Lucy/Test/TestUtils.pm
    incubator/lucy/trunk/perl/t/701-uscon.t

Modified: incubator/lucy/trunk/perl/MANIFEST
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/MANIFEST?rev=1222519&r1=1222518&r2=1222519&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/MANIFEST (original)
+++ incubator/lucy/trunk/perl/MANIFEST Fri Dec 23 00:09:31 2011
@@ -2,7 +2,6 @@ Build.PL
 buildlib/Lucy/Build.pm
 buildlib/Lucy/Redacted.pm
 buildlib/Lucy/Test/TestUtils.pm
-buildlib/Lucy/Test/USConSchema.pm
 INSTALL
 lib/Lucy.pm
 lib/Lucy.pod

Modified: incubator/lucy/trunk/perl/buildlib/Lucy/Redacted.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/Lucy/Redacted.pm?rev=1222519&r1=1222518&r2=1222519&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/Lucy/Redacted.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/Lucy/Redacted.pm Fri Dec 23 00:09:31 2011
@@ -54,7 +54,6 @@ sub hidden {
         Lucy::Redacted
         Lucy::Test::Object::TestCharBuf
         Lucy::Test::TestUtils
-        Lucy::Test::USConSchema
         Lucy::Util::BitVector
     );
 }

Modified: incubator/lucy/trunk/perl/buildlib/Lucy/Test/TestUtils.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/Lucy/Test/TestUtils.pm?rev=1222519&r1=1222518&r2=1222519&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/Lucy/Test/TestUtils.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/Lucy/Test/TestUtils.pm Fri Dec 23 00:09:31 2011
@@ -37,10 +37,6 @@ our @EXPORT_OK = qw(
 
 use Lucy;
 use Lucy::Test;
-
-use lib 'sample';
-use Lucy::Test::USConSchema;
-
 use File::Spec::Functions qw( catdir catfile curdir );
 use Encode qw( _utf8_off );
 use File::Path qw( rmtree );
@@ -139,12 +135,28 @@ sub get_uscon_docs {
     return \%docs;
 }
 
+sub _uscon_schema {
+    my $schema     = Lucy::Plan::Schema->new;
+    my $analyzer   = Lucy::Analysis::EasyAnalyzer->new( language => 'en' );
+    my $title_type = Lucy::Plan::FullTextType->new( analyzer => $analyzer, );
+    my $content_type = Lucy::Plan::FullTextType->new(
+        analyzer      => $analyzer,
+        highlightable => 1,
+    );
+    my $url_type = Lucy::Plan::StringType->new( indexed => 0, );
+    my $cat_type = Lucy::Plan::StringType->new;
+    $schema->spec_field( name => 'title',    type => $title_type );
+    $schema->spec_field( name => 'content',  type => $content_type );
+    $schema->spec_field( name => 'url',      type => $url_type );
+    $schema->spec_field( name => 'category', type => $cat_type );
+    return $schema;
+}
+
 sub create_uscon_index {
     my $folder
         = Lucy::Store::FSFolder->new( path => persistent_test_index_loc() );
-    my $schema  = Lucy::Test::USConSchema->new;
     my $indexer = Lucy::Index::Indexer->new(
-        schema   => $schema,
+        schema   => _uscon_schema(),
         index    => $folder,
         truncate => 1,
         create   => 1,
@@ -154,20 +166,14 @@ sub create_uscon_index {
     $indexer->commit;
     undef $indexer;
 
-    $indexer = Lucy::Index::Indexer->new(
-        schema => $schema,
-        index  => $folder,
-    );
+    $indexer = Lucy::Index::Indexer->new( index => $folder );
     my $source_docs = get_uscon_docs();
     $indexer->add_doc( { content => $_->{bodytext} } )
         for values %$source_docs;
     $indexer->commit;
     undef $indexer;
 
-    $indexer = Lucy::Index::Indexer->new(
-        schema => $schema,
-        index  => $folder,
-    );
+    $indexer = Lucy::Index::Indexer->new( index => $folder );
     my @chars = ( 'a' .. 'z' );
     for ( 0 .. 1000 ) {
         my $content = '';

Modified: incubator/lucy/trunk/perl/t/701-uscon.t
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/t/701-uscon.t?rev=1222519&r1=1222518&r2=1222519&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/t/701-uscon.t (original)
+++ incubator/lucy/trunk/perl/t/701-uscon.t Fri Dec 23 00:09:31 2011
@@ -19,7 +19,6 @@ use lib 'buildlib';
 
 use Test::More tests => 9;
 use Lucy::Test::TestUtils qw( persistent_test_index_loc );
-use Lucy::Test::USConSchema;
 
 my $searcher = Lucy::Search::IndexSearcher->new(
     index => persistent_test_index_loc() );