You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by mi...@apache.org on 2010/10/14 10:48:40 UTC
[lucy-commits] svn commit: r1022422 [37/43] - in /incubator/lucy/trunk/import: ./
charmonizer/ charmonizer/src/ charmonizer/src/Charmonizer/
charmonizer/src/Charmonizer/Core/ charmonizer/src/Charmonizer/Probe/
charmonizer/src/Charmonizer/Test/ clownfish/ clownfish/li...
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/Lock.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/Lock.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/Lock.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/Lock.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,77 @@
+package KinoSearch::Store::Lock;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+my $synopsis = <<'END_SYNOPSIS';
+ my $lock = $lock_factory->make_lock(
+ name => 'write',
+ timeout => 5000,
+ );
+ $lock->obtain or die "can't get lock for " . $lock->get_name;
+ do_stuff();
+ $lock->release;
+END_SYNOPSIS
+
+my $constructor = <<'END_CONSTRUCTOR';
+ my $lock = KinoSearch::Store::Lock->new(
+ name => 'commit', # required
+ folder => $folder, # required
+ host => $hostname, # required
+ timeout => 5000, # default: 0
+ interval => 1000, # default: 100
+ );
+END_CONSTRUCTOR
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Store::Lock",
+ bind_methods => [
+ qw(
+ Obtain
+ Request
+ Is_Locked
+ Release
+ Clear_Stale
+ Get_Name
+ Get_Lock_Path
+ Get_Host
+ )
+ ],
+ bind_constructors => ["new"],
+ make_pod => {
+ synopsis => $synopsis,
+ constructor => { sample => $constructor },
+ methods => [
+ qw(
+ obtain
+ request
+ release
+ is_locked
+ clear_stale
+ )
+ ],
+ },
+);
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Store::LockFileLock",
+ bind_constructors => ["new"],
+);
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Store::SharedLock",
+ bind_constructors => ["new"],
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/Lock.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/LockErr.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/LockErr.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/LockErr.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/LockErr.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,38 @@
+package KinoSearch::Store::LockErr;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+my $synopsis = <<'END_SYNOPSIS';
+ while (1) {
+ my $bg_merger = eval {
+ KinoSearch::Index::BackgroundMerger->new( index => $index );
+ };
+ if ( blessed($@) and $@->isa("KinoSearch::Store::LockErr") ) {
+ warn "Retrying...\n";
+ }
+ elsif (!$bg_merger) {
+ # Re-throw.
+ die "Failed to open BackgroundMerger: $@";
+ }
+ ...
+ }
+END_SYNOPSIS
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Store::LockErr",
+ make_pod => { synopsis => $synopsis }
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/LockErr.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/LockFactory.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/LockFactory.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/LockFactory.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/LockFactory.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,52 @@
+package KinoSearch::Store::LockFactory;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+my $synopsis = <<'END_SYNOPSIS';
+ use Sys::Hostname qw( hostname );
+ my $hostname = hostname() or die "Can't get unique hostname";
+ my $folder = KinoSearch::Store::FSFolder->new(
+ path => '/path/to/index',
+ );
+ my $lock_factory = KinoSearch::Store::LockFactory->new(
+ folder => $folder,
+ host => $hostname,
+ );
+ my $write_lock = $lock_factory->make_lock(
+ name => 'write',
+ timeout => 5000,
+ interval => 100,
+ );
+END_SYNOPSIS
+
+my $constructor = <<'END_CONSTRUCTOR';
+ my $lock_factory = KinoSearch::Store::LockFactory->new(
+ folder => $folder, # required
+ host => $hostname, # required
+ );
+END_CONSTRUCTOR
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Store::LockFactory",
+ bind_methods => [qw( Make_Lock Make_Shared_Lock )],
+ bind_constructors => ["new"],
+ make_pod => {
+ methods => [qw( make_lock make_shared_lock)],
+ synopsis => $synopsis,
+ constructor => { sample => $constructor },
+ }
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/LockFactory.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/OutStream.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/OutStream.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/OutStream.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/OutStream.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,76 @@
+package KinoSearch::Store::OutStream;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+my $xs_code = <<'END_XS_CODE';
+MODULE = KinoSearch PACKAGE = KinoSearch::Store::OutStream
+
+void
+print(self, ...)
+ kino_OutStream *self;
+PPCODE:
+{
+ int i;
+ for (i = 1; i < items; i++) {
+ STRLEN len;
+ char *ptr = SvPV( ST(i), len);
+ Kino_OutStream_Write_Bytes(self, ptr, len);
+ }
+}
+
+void
+write_string(self, aSV)
+ kino_OutStream *self;
+ SV *aSV;
+PPCODE:
+{
+ STRLEN len = 0;
+ char *ptr = SvPVutf8(aSV, len);
+ Kino_OutStream_Write_C32(self, len);
+ Kino_OutStream_Write_Bytes(self, ptr, len);
+}
+END_XS_CODE
+
+my $synopsis = <<'END_SYNOPSIS'; # Don't use this yet.
+ my $outstream = $folder->open_out($filename) or die $@;
+ $outstream->write_u64($file_position);
+END_SYNOPSIS
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Store::OutStream",
+ xs_code => $xs_code,
+ bind_methods => [
+ qw(
+ Tell
+ Length
+ Flush
+ Close
+ Absorb
+ Write_I8
+ Write_I32
+ Write_I64
+ Write_U8
+ Write_U32
+ Write_U64
+ Write_C32
+ Write_C64
+ Write_F32
+ Write_F64
+ )
+ ],
+ bind_constructors => ['open|do_open'],
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/OutStream.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFile.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFile.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFile.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFile.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,23 @@
+package KinoSearch::Store::RAMFile;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Store::RAMFile",
+ bind_methods => [qw( Get_Contents )],
+ bind_constructors => ['new'],
+);
+
+__COPYRIGHT__
+
+Copyright 2009-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFile.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFileHandle.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFileHandle.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFileHandle.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFileHandle.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,23 @@
+package KinoSearch::Store::RAMFileHandle;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Store::RAMFileHandle",
+ bind_methods => [qw( Get_File )],
+ bind_constructors => ['_open|do_open'],
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFileHandle.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFolder.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFolder.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFolder.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFolder.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,41 @@
+package KinoSearch::Store::RAMFolder;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+my $synopsis = <<'END_SYNOPSIS';
+ my $folder = KinoSearch::Store::RAMFolder->new;
+
+ # or sometimes...
+ my $folder = KinoSearch::Store::RAMFolder->new(
+ path => $relative_path,
+ );
+END_SYNOPSIS
+
+my $constructor = <<'END_CONSTRUCTOR';
+ my $folder = KinoSearch::Store::RAMFolder->new(
+ path => $relative_path, # default: empty string
+ );
+END_CONSTRUCTOR
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Store::RAMFolder",
+ bind_constructors => ["new"],
+ make_pod => {
+ synopsis => $synopsis,
+ constructor => { sample => $constructor },
+ }
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Store/RAMFolder.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Test.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Test.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Test.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Test.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,287 @@
+package KinoSearch::Test;
+use KinoSearch;
+
+# Set the default memory threshold for PostingListWriter to a low number so
+# that we simulate large indexes by performing a lot of PostingPool flushes.
+KinoSearch::Index::PostingListWriter::set_default_mem_thresh(0x1000);
+
+1;
+
+__END__
+
+__BINDING__
+
+my $xs_code = <<'END_XS_CODE';
+MODULE = KinoSearch PACKAGE = KinoSearch::Test::TestUtils
+
+SV*
+doc_set()
+CODE:
+ RETVAL = KINO_OBJ_TO_SV_NOINC(kino_TestUtils_doc_set());
+OUTPUT: RETVAL
+
+MODULE = KinoSearch PACKAGE = KinoSearch::Test
+
+void
+run_tests(package)
+ char *package;
+PPCODE:
+{
+ // KinoSearch::Analysis
+ if (strEQ(package, "TestCaseFolder")) {
+ kino_TestCaseFolder_run_tests();
+ }
+ else if (strEQ(package, "TestPolyAnalyzer")) {
+ kino_TestPolyAnalyzer_run_tests();
+ }
+ else if (strEQ(package, "TestStopalizer")) {
+ kino_TestStopalizer_run_tests();
+ }
+ else if (strEQ(package, "TestStemmer")) {
+ kino_TestStemmer_run_tests();
+ }
+ else if (strEQ(package, "TestTokenizer")) {
+ kino_TestTokenizer_run_tests();
+ }
+ // KinoSearch::Object
+ else if (strEQ(package, "TestObj")) {
+ kino_TestObj_run_tests();
+ }
+ else if (strEQ(package, "TestI32Array")) {
+ kino_TestI32Arr_run_tests();
+ }
+ else if (strEQ(package, "TestByteBuf")) {
+ kino_TestBB_run_tests();
+ }
+ else if (strEQ(package, "TestLockFreeRegistry")) {
+ kino_TestLFReg_run_tests();
+ }
+ // KinoSearch::Plan
+ else if (strEQ(package, "TestBlobType")) {
+ kino_TestBlobType_run_tests();
+ }
+ else if (strEQ(package, "TestFullTextType")) {
+ kino_TestFullTextType_run_tests();
+ }
+ else if (strEQ(package, "TestNumericType")) {
+ kino_TestNumericType_run_tests();
+ }
+ else if (strEQ(package, "TestSchema")) {
+ kino_TestSchema_run_tests();
+ }
+ // KinoSearch::Index
+ else if (strEQ(package, "TestHighlightWriter")) {
+ kino_TestHLWriter_run_tests();
+ }
+ else if (strEQ(package, "TestDocWriter")) {
+ kino_TestDocWriter_run_tests();
+ }
+ else if (strEQ(package, "TestPostingListWriter")) {
+ kino_TestPListWriter_run_tests();
+ }
+ else if (strEQ(package, "TestSegment")) {
+ kino_TestSeg_run_tests();
+ }
+ else if (strEQ(package, "TestSegWriter")) {
+ kino_TestSegWriter_run_tests();
+ }
+ else if (strEQ(package, "TestSnapshot")) {
+ kino_TestSnapshot_run_tests();
+ }
+ // KinoSearch::Search
+ else if (strEQ(package, "TestANDQuery")) {
+ kino_TestANDQuery_run_tests();
+ }
+ else if (strEQ(package, "TestLeafQuery")) {
+ kino_TestLeafQuery_run_tests();
+ }
+ else if (strEQ(package, "TestMatchAllQuery")) {
+ kino_TestMatchAllQuery_run_tests();
+ }
+ else if (strEQ(package, "TestNoMatchQuery")) {
+ kino_TestNoMatchQuery_run_tests();
+ }
+ else if (strEQ(package, "TestNOTQuery")) {
+ kino_TestNOTQuery_run_tests();
+ }
+ else if (strEQ(package, "TestORQuery")) {
+ kino_TestORQuery_run_tests();
+ }
+ else if (strEQ(package, "TestPhraseQuery")) {
+ kino_TestPhraseQuery_run_tests();
+ }
+ else if (strEQ(package, "TestQueryParserLogic")) {
+ kino_TestQPLogic_run_tests();
+ }
+ else if (strEQ(package, "TestSeriesMatcher")) {
+ kino_TestSeriesMatcher_run_tests();
+ }
+ else if (strEQ(package, "TestRangeQuery")) {
+ kino_TestRangeQuery_run_tests();
+ }
+ else if (strEQ(package, "TestReqOptQuery")) {
+ kino_TestReqOptQuery_run_tests();
+ }
+ else if (strEQ(package, "TestTermQuery")) {
+ kino_TestTermQuery_run_tests();
+ }
+ // KinoSearch::Store
+ else if (strEQ(package, "TestCompoundFileReader")) {
+ kino_TestCFReader_run_tests();
+ }
+ else if (strEQ(package, "TestCompoundFileWriter")) {
+ kino_TestCFWriter_run_tests();
+ }
+ else if (strEQ(package, "TestFileHandle")) {
+ kino_TestFH_run_tests();
+ }
+ else if (strEQ(package, "TestFolder")) {
+ kino_TestFolder_run_tests();
+ }
+ else if (strEQ(package, "TestFSDirHandle")) {
+ kino_TestFSDH_run_tests();
+ }
+ else if (strEQ(package, "TestFSFolder")) {
+ kino_TestFSFolder_run_tests();
+ }
+ else if (strEQ(package, "TestFSFileHandle")) {
+ kino_TestFSFH_run_tests();
+ }
+ else if (strEQ(package, "TestInStream")) {
+ kino_TestInStream_run_tests();
+ }
+ else if (strEQ(package, "TestIOChunks")) {
+ kino_TestIOChunks_run_tests();
+ }
+ else if (strEQ(package, "TestIOPrimitives")) {
+ kino_TestIOPrimitives_run_tests();
+ }
+ else if (strEQ(package, "TestRAMDirHandle")) {
+ kino_TestRAMDH_run_tests();
+ }
+ else if (strEQ(package, "TestRAMFileHandle")) {
+ kino_TestRAMFH_run_tests();
+ }
+ else if (strEQ(package, "TestRAMFolder")) {
+ kino_TestRAMFolder_run_tests();
+ }
+ // KinoSearch::Util
+ else if (strEQ(package, "TestAtomic")) {
+ kino_TestAtomic_run_tests();
+ }
+ else if (strEQ(package, "TestBitVector")) {
+ kino_TestBitVector_run_tests();
+ }
+ else if (strEQ(package, "TestCharBuf")) {
+ kino_TestCB_run_tests();
+ }
+ else if (strEQ(package, "TestHash")) {
+ kino_TestHash_run_tests();
+ }
+ else if (strEQ(package, "TestJson")) {
+ kino_TestJson_run_tests();
+ }
+ else if (strEQ(package, "TestMemory")) {
+ kino_TestMemory_run_tests();
+ }
+ else if (strEQ(package, "TestIndexFileNames")) {
+ kino_TestIxFileNames_run_tests();
+ }
+ else if (strEQ(package, "TestNumberUtils")) {
+ kino_TestNumUtil_run_tests();
+ }
+ else if (strEQ(package, "TestNum")) {
+ kino_TestNum_run_tests();
+ }
+ else if (strEQ(package, "TestPriorityQueue")) {
+ kino_TestPriQ_run_tests();
+ }
+ else if (strEQ(package, "TestStringHelper")) {
+ kino_TestStrHelp_run_tests();
+ }
+ else if (strEQ(package, "TestMemoryPool")) {
+ kino_TestMemPool_run_tests();
+ }
+ else if (strEQ(package, "TestVArray")) {
+ kino_TestVArray_run_tests();
+ }
+ else {
+ THROW(KINO_ERR, "Unknown test id: %s", package);
+ }
+}
+
+MODULE = KinoSearch PACKAGE = KinoSearch::Test::TestQueryParserSyntax
+
+void
+run_tests(index);
+ kino_Folder *index;
+PPCODE:
+ kino_TestQPSyntax_run_tests(index);
+END_XS_CODE
+
+my $charm_xs_code = <<'END_XS_CODE';
+MODULE = KinoSearch PACKAGE = KinoSearch::Test::TestCharmonizer
+
+void
+run_tests(which)
+ char *which;
+PPCODE:
+{
+ chaz_TestBatch *batch = NULL;
+ chaz_Test_init();
+
+ if (strcmp(which, "dirmanip") == 0) {
+ batch = chaz_TestDirManip_prepare();
+ }
+ else if (strcmp(which, "integers") == 0) {
+ batch = chaz_TestIntegers_prepare();
+ }
+ else if (strcmp(which, "func_macro") == 0) {
+ batch = chaz_TestFuncMacro_prepare();
+ }
+ else if (strcmp(which, "headers") == 0) {
+ batch = chaz_TestHeaders_prepare();
+ }
+ else if (strcmp(which, "large_files") == 0) {
+ batch = chaz_TestLargeFiles_prepare();
+ }
+ else if (strcmp(which, "unused_vars") == 0) {
+ batch = chaz_TestUnusedVars_prepare();
+ }
+ else if (strcmp(which, "variadic_macros") == 0) {
+ batch = chaz_TestVariadicMacros_prepare();
+ }
+ else {
+ THROW(KINO_ERR, "Unknown test identifier: '%s'", which);
+ }
+
+ batch->run_test(batch);
+ batch->destroy(batch);
+}
+END_XS_CODE
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Test::TestSchema",
+ bind_constructors => ["new"],
+);
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Test",
+ xs_code => $xs_code,
+);
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Test::TestCharmonizer",
+ xs_code => $charm_xs_code,
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Test.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Test/Util/BBSortEx.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Test/Util/BBSortEx.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Test/Util/BBSortEx.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Test/Util/BBSortEx.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,67 @@
+package KinoSearch::Test::Util::BBSortEx;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+my $xs_code = <<'END_XS_CODE';
+MODULE = KinoSearch PACKAGE = KinoSearch::Test::Util::BBSortEx
+
+SV*
+fetch(self)
+ kino_BBSortEx *self;
+CODE:
+{
+ void *address = Kino_BBSortEx_Fetch(self);
+ if (address) {
+ RETVAL = XSBind_kino_to_perl(*(kino_Obj**)address);
+ KINO_DECREF(*(kino_Obj**)address);
+ }
+ else {
+ RETVAL = newSV(0);
+ }
+}
+OUTPUT: RETVAL
+
+SV*
+peek(self)
+ kino_BBSortEx *self;
+CODE:
+{
+ void *address = Kino_BBSortEx_Peek(self);
+ if (address) {
+ RETVAL = XSBind_kino_to_perl(*(kino_Obj**)address);
+ }
+ else {
+ RETVAL = newSV(0);
+ }
+}
+OUTPUT: RETVAL
+
+void
+feed(self, bb)
+ kino_BBSortEx *self;
+ kino_ByteBuf *bb;
+CODE:
+ KINO_INCREF(bb);
+ Kino_BBSortEx_Feed(self, &bb);
+
+END_XS_CODE
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Test::Util::BBSortEx",
+ bind_constructors => ["new"],
+ xs_code => $xs_code,
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Test/Util/BBSortEx.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/BitVector.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/BitVector.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/BitVector.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/BitVector.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,14 @@
+package KinoSearch::Util::BitVector;
+use KinoSearch;
+
+1;
+
+__END__
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/BitVector.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Debug.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Debug.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Debug.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Debug.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,95 @@
+package KinoSearch::Util::Debug;
+use strict;
+use warnings;
+
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+my $xs_code = <<'END_XS_CODE';
+MODULE = KinoSearch PACKAGE = KinoSearch::Util::Debug
+
+#include "KinoSearch/Util/Debug.h"
+
+void
+DEBUG_PRINT(message)
+ char *message;
+PPCODE:
+ KINO_DEBUG_PRINT("%s", message);
+
+void
+DEBUG(message)
+ char *message;
+PPCODE:
+ KINO_DEBUG("%s", message);
+
+chy_bool_t
+DEBUG_ENABLED()
+CODE:
+ RETVAL = KINO_DEBUG_ENABLED;
+OUTPUT: RETVAL
+
+=for comment
+
+Keep track of any KS objects that have been assigned to global Perl variables.
+This is useful when accounting how many objects should have been destroyed and
+diagnosing memory leaks.
+
+=cut
+
+void
+track_globals(...)
+PPCODE:
+{
+ CHY_UNUSED_VAR(items);
+ KINO_IFDEF_DEBUG(kino_Debug_num_globals++;);
+}
+
+void
+set_env_cache(str)
+ char *str;
+PPCODE:
+ kino_Debug_set_env_cache(str);
+
+void
+ASSERT(maybe)
+ int maybe;
+PPCODE:
+ KINO_ASSERT(maybe, "XS ASSERT binding test");
+
+IV
+num_allocated()
+CODE:
+ RETVAL = kino_Debug_num_allocated;
+OUTPUT: RETVAL
+
+IV
+num_freed()
+CODE:
+ RETVAL = kino_Debug_num_freed;
+OUTPUT: RETVAL
+
+IV
+num_globals()
+CODE:
+ RETVAL = kino_Debug_num_globals;
+OUTPUT: RETVAL
+END_XS_CODE
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Util::Debug",
+ xs_code => $xs_code,
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Debug.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/IndexFileNames.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/IndexFileNames.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/IndexFileNames.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/IndexFileNames.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,44 @@
+package KinoSearch::Util::IndexFileNames;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+my $xs_code = <<'END_XS_CODE';
+MODULE = KinoSearch PACKAGE = KinoSearch::Util::IndexFileNames
+
+uint64_t
+extract_gen(name)
+ const kino_CharBuf *name;
+CODE:
+ RETVAL = kino_IxFileNames_extract_gen(name);
+OUTPUT: RETVAL
+
+SV*
+latest_snapshot(folder)
+ kino_Folder *folder;
+CODE:
+{
+ kino_CharBuf *latest = kino_IxFileNames_latest_snapshot(folder);
+ RETVAL = XSBind_cb_to_sv(latest);
+ KINO_DECREF(latest);
+}
+OUTPUT: RETVAL
+END_XS_CODE
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Util::IndexFileNames",
+ xs_code => $xs_code,
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/IndexFileNames.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Json.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Json.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Json.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Json.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,14 @@
+package KinoSearch::Util::Json;
+use KinoSearch;
+
+1;
+
+__END__
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Json.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/MemoryPool.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/MemoryPool.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/MemoryPool.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/MemoryPool.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,22 @@
+package KinoSearch::Util::MemoryPool;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Util::MemoryPool",
+ bind_constructors => ["new"],
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/MemoryPool.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/PriorityQueue.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/PriorityQueue.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/PriorityQueue.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/PriorityQueue.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,32 @@
+package KinoSearch::Util::PriorityQueue;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Util::PriorityQueue",
+ bind_methods => [
+ qw(
+ Less_Than
+ Insert
+ Pop
+ Pop_All
+ Peek
+ Get_Size
+ )
+ ],
+ bind_constructors => ["new"],
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/PriorityQueue.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/SortExternal.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/SortExternal.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/SortExternal.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/SortExternal.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,44 @@
+package KinoSearch::Util::SortExternal;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+my $xs_code = <<'END_XS_CODE';
+MODULE = KinoSearch PACKAGE = KinoSearch::Util::SortExternal
+
+IV
+_DEFAULT_MEM_THRESHOLD()
+CODE:
+ RETVAL = KINO_SORTEX_DEFAULT_MEM_THRESHOLD;
+OUTPUT: RETVAL
+END_XS_CODE
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Util::SortExternal",
+ xs_code => $xs_code,
+ bind_methods => [
+ qw(
+ Flush
+ Flip
+ Add_Run
+ Refill
+ Sort_Cache
+ Cache_Count
+ Clear_Cache
+ Set_Mem_Thresh
+ )
+ ],
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/SortExternal.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Stepper.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Stepper.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Stepper.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Stepper.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,22 @@
+package KinoSearch::Util::Stepper;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Util::Stepper",
+ bind_methods => [qw( Read_Record )],
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/Stepper.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/StringHelper.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/StringHelper.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/StringHelper.pm (added)
+++ incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/StringHelper.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,113 @@
+package KinoSearch::Util::StringHelper;
+use KinoSearch;
+
+1;
+
+__END__
+
+__BINDING__
+
+my $xs_code = <<'END_XS_CODE';
+MODULE = KinoSearch PACKAGE = KinoSearch::Util::StringHelper
+
+=for comment
+
+Turn an SV's UTF8 flag on. Equivalent to Encode::_utf8_on, but we don't have
+to load Encode.
+
+=cut
+
+void
+utf8_flag_on(sv)
+ SV *sv;
+PPCODE:
+ SvUTF8_on(sv);
+
+=for comment
+
+Turn an SV's UTF8 flag off.
+
+=cut
+
+void
+utf8_flag_off(sv)
+ SV *sv;
+PPCODE:
+ SvUTF8_off(sv);
+
+SV*
+to_base36(num)
+ uint64_t num;
+CODE:
+{
+ char base36[kino_StrHelp_MAX_BASE36_BYTES];
+ size_t size = kino_StrHelp_to_base36(num, &base36);
+ RETVAL = newSVpvn(base36, size);
+}
+OUTPUT: RETVAL
+
+IV
+from_base36(str)
+ char *str;
+CODE:
+ RETVAL = strtol(str, NULL, 36);
+OUTPUT: RETVAL
+
+=for comment
+
+Upgrade a SV to UTF8, converting Latin1 if necessary. Equivalent to
+utf::upgrade().
+
+=cut
+
+void
+utf8ify(sv)
+ SV *sv;
+PPCODE:
+ sv_utf8_upgrade(sv);
+
+chy_bool_t
+utf8_valid(sv)
+ SV *sv;
+CODE:
+{
+ STRLEN len;
+ char *ptr = SvPV(sv, len);
+ RETVAL = kino_StrHelp_utf8_valid(ptr, len);
+}
+OUTPUT: RETVAL
+
+=for comment
+
+Concatenate one scalar onto the end of the other, ignoring UTF-8 status of the
+second scalar. This is necessary because $not_utf8 . $utf8 results in a
+scalar which has been infected by the UTF-8 flag of the second argument.
+
+=cut
+
+void
+cat_bytes(sv, catted)
+ SV *sv;
+ SV *catted;
+PPCODE:
+{
+ STRLEN len;
+ char *ptr = SvPV(catted, len);
+ if (SvUTF8(sv)) { KINO_THROW(KINO_ERR, "Can't cat_bytes onto a UTF-8 SV"); }
+ sv_catpvn(sv, ptr, len);
+}
+END_XS_CODE
+
+Clownfish::Binding::Perl::Class->register(
+ parcel => "KinoSearch",
+ class_name => "KinoSearch::Util::StringHelper",
+ xs_code => $xs_code,
+);
+
+__COPYRIGHT__
+
+Copyright 2005-2010 Marvin Humphrey
+
+This program is free software; you can redistribute it and/or modify
+under the same terms as Perl itself.
+
Propchange: incubator/lucy/trunk/import/perl/lib/KinoSearch/Util/StringHelper.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/FlatQueryParser.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/FlatQueryParser.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/FlatQueryParser.pm (added)
+++ incubator/lucy/trunk/import/perl/sample/FlatQueryParser.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,123 @@
+use strict;
+use warnings;
+
+package FlatQueryParser;
+use base qw( KinoSearch::Search::QueryParser );
+use KinoSearch::Search::TermQuery;
+use KinoSearch::Search::PhraseQuery;
+use KinoSearch::Search::ORQuery;
+use KinoSearch::Search::NoMatchQuery;
+use PrefixQuery;
+use Parse::RecDescent;
+use Carp;
+
+our %rd_parser;
+
+my $grammar = <<'END_GRAMMAR';
+
+tree:
+ leaf_queries
+ {
+ $return = KinoSearch::Search::ORQuery->new;
+ $return->add_child($_) for @{ $item[1] };
+ }
+
+leaf_queries:
+ leaf_query(s?)
+ { $item{'leaf_query(s?)'} }
+
+leaf_query:
+ phrase_query
+ | prefix_query
+ | term_query
+
+term_query:
+ /(\S+)/
+ { KinoSearch::Search::LeafQuery->new( text => $1 ) }
+
+phrase_query:
+ /("[^"]*(?:"|$))/ # terminated by either quote or end of string
+ { KinoSearch::Search::LeafQuery->new( text => $1 ) }
+
+prefix_query:
+ /(\w+\*)/
+ { KinoSearch::Search::LeafQuery->new( text => $1 ) }
+
+END_GRAMMAR
+
+sub new {
+ my $class = shift;
+ my $self = $class->SUPER::new(@_);
+ $rd_parser{$$self} = Parse::RecDescent->new($grammar);
+ return $self;
+}
+
+sub DESTROY {
+ my $self = shift;
+ delete $rd_parser{$$self};
+ $self->SUPER::DESTROY;
+}
+
+sub parse {
+ my ( $self, $query_string ) = @_;
+ my $tree = $self->tree($query_string);
+ return $tree
+ ? $self->expand($tree)
+ : KinoSearch::Search::NoMatchQuery->new;
+}
+
+sub tree {
+ my ( $self, $query_string ) = @_;
+ return $rd_parser{$$self}->tree($query_string);
+}
+
+sub expand_leaf {
+ my ( $self, $leaf_query ) = @_;
+ my $text = $leaf_query->get_text;
+ if ( $text =~ /\*$/ ) {
+ my $or_query = KinoSearch::Search::ORQuery->new;
+ for my $field ( @{ $self->get_fields } ) {
+ my $prefix_query = PrefixQuery->new(
+ field => $field,
+ query_string => $text,
+ );
+ $or_query->add_child($prefix_query);
+ }
+ return $or_query;
+ }
+ else {
+ return $self->SUPER::expand_leaf($leaf_query);
+ }
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+FlatQueryParser - Simple query parser, with no boolean operators.
+
+=head1 SYNOPSIS
+
+ my $searcher = KinoSearch::Search::IndexSearcher->new(
+ index => '/path/to/index'
+ );
+ my $parser = FlatQueryParser->new( $searcher->get_schema );
+ my $query = $parser->parse($query_string);
+ my $hits = $searcher->hits( query => $query );
+ ...
+
+=head1 DESCRIPTION
+
+See L<KinoSearch::Docs::Cookbook::CustomQueryParser>.
+
+=head1 COPYRIGHT
+
+Copyright 2008-2010 Marvin Humphrey
+
+=head1 LICENSE, DISCLAIMER, BUGS, etc.
+
+See L<KinoSearch> version 0.30.
+
+=cut
Propchange: incubator/lucy/trunk/import/perl/sample/FlatQueryParser.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/PrefixQuery.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/PrefixQuery.pm?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/PrefixQuery.pm (added)
+++ incubator/lucy/trunk/import/perl/sample/PrefixQuery.pm Thu Oct 14 08:48:04 2010
@@ -0,0 +1,185 @@
+use strict;
+use warnings;
+
+package PrefixQuery;
+use base qw( KinoSearch::Search::Query );
+use Carp;
+use Scalar::Util qw( blessed );
+
+# Inside-out member vars and hand-rolled accessors.
+my %query_string;
+my %field;
+sub get_query_string { my $self = shift; return $query_string{$$self} }
+sub get_field { my $self = shift; return $field{$$self} }
+
+sub new {
+ my ( $class, %args ) = @_;
+ my $query_string = delete $args{query_string};
+ my $field = delete $args{field};
+ my $self = $class->SUPER::new(%args);
+ confess("'query_string' param is required")
+ unless defined $query_string;
+ confess("Invalid query_string: '$query_string'")
+ unless $query_string =~ /\*\s*$/;
+ confess("'field' param is required")
+ unless defined $field;
+ $query_string{$$self} = $query_string;
+ $field{$$self} = $field;
+ return $self;
+}
+
+sub DESTROY {
+ my $self = shift;
+ delete $query_string{$$self};
+ delete $field{$$self};
+ $self->SUPER::DESTROY;
+}
+
+sub equals {
+ my ( $self, $other ) = @_;
+ return 0 unless blessed($other);
+ return 0 unless $other->isa("PrefixQuery");
+ return 0 unless $field{$$self} eq $field{$$other};
+ return 0 unless $query_string{$$self} eq $query_string{$$other};
+ return 1;
+}
+
+sub to_string {
+ my $self = shift;
+ return "$field{$$self}:$query_string{$$self}";
+}
+
+sub make_compiler {
+ my $self = shift;
+ return PrefixCompiler->new( @_, parent => $self );
+}
+
+package PrefixCompiler;
+use base qw( KinoSearch::Search::Compiler );
+
+sub make_matcher {
+ my ( $self, %args ) = @_;
+ my $seg_reader = $args{reader};
+
+ # Retrieve low-level components LexiconReader and PostingListReader.
+ my $lex_reader
+ = $seg_reader->obtain("KinoSearch::Index::LexiconReader");
+ my $plist_reader
+ = $seg_reader->obtain("KinoSearch::Index::PostingListReader");
+
+ # Acquire a Lexicon and seek it to our query string.
+ my $substring = $self->get_parent->get_query_string;
+ $substring =~ s/\*.\s*$//;
+ my $field = $self->get_parent->get_field;
+ my $lexicon = $lex_reader->lexicon( field => $field );
+ return unless $lexicon;
+ $lexicon->seek($substring);
+
+ # Accumulate PostingLists for each matching term.
+ my @posting_lists;
+ while ( defined( my $term = $lexicon->get_term ) ) {
+ last unless $term =~ /^\Q$substring/;
+ my $posting_list = $plist_reader->posting_list(
+ field => $field,
+ term => $term,
+ );
+ if ($posting_list) {
+ push @posting_lists, $posting_list;
+ }
+ last unless $lexicon->next;
+ }
+ return unless @posting_lists;
+
+ return PrefixScorer->new( posting_lists => \@posting_lists );
+}
+
+package PrefixScorer;
+use base qw( KinoSearch::Search::Matcher );
+
+# Inside-out member vars.
+my %doc_ids;
+my %tally;
+my %tick;
+
+sub new {
+ my ( $class, %args ) = @_;
+ my $posting_lists = delete $args{posting_lists};
+ my $self = $class->SUPER::new(%args);
+
+ # Cheesy but simple way of interleaving PostingList doc sets.
+ my %all_doc_ids;
+ for my $posting_list (@$posting_lists) {
+ while ( my $doc_id = $posting_list->next ) {
+ $all_doc_ids{$doc_id} = undef;
+ }
+ }
+ my @doc_ids = sort { $a <=> $b } keys %all_doc_ids;
+ $doc_ids{$$self} = \@doc_ids;
+
+ $tick{$$self} = -1;
+ $tally{$$self} = KinoSearch::Search::Tally->new;
+ $tally{$$self}->set_score(1.0); # fixed score of 1.0
+
+ return $self;
+}
+
+sub DESTROY {
+ my $self = shift;
+ delete $doc_ids{$$self};
+ delete $tick{$$self};
+ delete $tally{$$self};
+ $self->SUPER::DESTROY;
+}
+
+sub next {
+ my $self = shift;
+ my $doc_ids = $doc_ids{$$self};
+ my $tick = ++$tick{$$self};
+ return 0 if $tick >= scalar @$doc_ids;
+ return $doc_ids->[$tick];
+}
+
+sub get_doc_id {
+ my $self = shift;
+ my $tick = $tick{$$self};
+ my $doc_ids = $doc_ids{$$self};
+ return $tick < scalar @$doc_ids ? $doc_ids->[$tick] : 0;
+}
+
+sub tally {
+ my $self = shift;
+ return $tally{$$self};
+}
+
+1;
+
+__END__
+
+__POD__
+
+=head1 SAMPLE CLASS
+
+PrefixQuery - Sample subclass of KinoSearch::Query, supporting trailing
+wildcards.
+
+=head1 SYNOPSIS
+
+ my $prefix_query = PrefixQuery->new(
+ field => 'content',
+ query_string => 'foo*',
+ );
+ my $hits = $searcher->hits( query => $prefix_query );
+
+=head1 DESCRIPTION
+
+Seek L<KinoSearch::Docs::Cookbook::CustomQuery>.
+
+=head1 COPYRIGHT
+
+Copyright 2008-2010 Marvin Humphrey
+
+=head1 LICENSE, DISCLAIMER, BUGS, etc.
+
+See L<KinoSearch> version 0.30.
+
+=cut
Propchange: incubator/lucy/trunk/import/perl/sample/PrefixQuery.pm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/README.txt
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/README.txt?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/README.txt (added)
+++ incubator/lucy/trunk/import/perl/sample/README.txt Thu Oct 14 08:48:04 2010
@@ -0,0 +1,2 @@
+For more information on the sample code in this directory, see
+KinoSearch::Docs::Tutorial and KinoSearch::Docs::Cookbook.
\ No newline at end of file
Propchange: incubator/lucy/trunk/import/perl/sample/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/indexer.pl
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/indexer.pl?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/indexer.pl (added)
+++ incubator/lucy/trunk/import/perl/sample/indexer.pl Thu Oct 14 08:48:04 2010
@@ -0,0 +1,81 @@
+#!/usr/local/bin/perl
+use strict;
+use warnings;
+
+# (Change configuration variables as needed.)
+my $path_to_index = '/path/to/index';
+my $uscon_source = '/usr/local/apache2/htdocs/us_constitution';
+
+use File::Spec::Functions qw( catfile );
+use HTML::TreeBuilder;
+use KinoSearch::Plan::Schema;
+use KinoSearch::Plan::FullTextType;
+use KinoSearch::Analysis::PolyAnalyzer;
+use KinoSearch::Index::Indexer;
+
+# Create Schema.
+my $schema = KinoSearch::Plan::Schema->new;
+my $polyanalyzer = KinoSearch::Analysis::PolyAnalyzer->new(
+ language => 'en',
+);
+my $title_type = KinoSearch::Plan::FullTextType->new(
+ analyzer => $polyanalyzer,
+);
+my $content_type = KinoSearch::Plan::FullTextType->new(
+ analyzer => $polyanalyzer,
+ highlightable => 1,
+);
+my $url_type = KinoSearch::Plan::StringType->new( indexed => 0, );
+my $cat_type = KinoSearch::Plan::StringType->new( stored => 0, );
+$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 );
+
+# Create an Indexer object.
+my $indexer = KinoSearch::Index::Indexer->new(
+ index => $path_to_index,
+ schema => $schema,
+ create => 1,
+ truncate => 1,
+);
+
+# Collect names of source html files.
+opendir( my $dh, $uscon_source )
+ or die "Couldn't opendir '$uscon_source': $!";
+my @filenames = grep { $_ =~ /\.html/ && $_ ne 'index.html' } readdir $dh;
+
+# Iterate over list of source files.
+for my $filename (@filenames) {
+ print "Indexing $filename\n";
+ my $doc = parse_file($filename);
+ $indexer->add_doc($doc);
+}
+
+# Finalize the index and print a confirmation message.
+$indexer->commit;
+print "Finished.\n";
+
+# Parse an HTML file from our US Constitution collection and return a
+# hashref with the fields title, body, url, and category.
+sub parse_file {
+ my $filename = shift;
+ my $filepath = catfile( $uscon_source, $filename );
+ my $tree = HTML::TreeBuilder->new;
+ $tree->parse_file($filepath);
+ my $title_node = $tree->look_down( _tag => 'title' )
+ or die "No title element in $filepath";
+ my $bodytext_node = $tree->look_down( id => 'bodytext' )
+ or die "No div with id 'bodytext' in $filepath";
+ my $category
+ = $filename =~ /art/ ? 'article'
+ : $filename =~ /amend/ ? 'amendment'
+ : $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,
+ };
+}
Propchange: incubator/lucy/trunk/import/perl/sample/indexer.pl
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/search.cgi
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/search.cgi?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/search.cgi (added)
+++ incubator/lucy/trunk/import/perl/sample/search.cgi Thu Oct 14 08:48:04 2010
@@ -0,0 +1,225 @@
+#!/usr/local/bin/perl -T
+use strict;
+use warnings;
+
+# (Change configuration variables as needed.)
+my $path_to_index = '/path/to/index';
+
+use CGI;
+use Data::Pageset;
+use HTML::Entities qw( encode_entities );
+use KinoSearch::Search::IndexSearcher;
+use KinoSearch::Highlight::Highlighter;
+use KinoSearch::Search::QueryParser;
+use KinoSearch::Search::TermQuery;
+use KinoSearch::Search::ANDQuery;
+
+my $cgi = CGI->new;
+my $q = $cgi->param('q') || '';
+my $offset = $cgi->param('offset') || 0;
+my $category = $cgi->param('category') || '';
+my $hits_per_page = 10;
+
+# Create an IndexSearcher and a QueryParser.
+my $searcher = KinoSearch::Search::IndexSearcher->new(
+ index => $path_to_index,
+);
+my $qparser = KinoSearch::Search::QueryParser->new(
+ schema => $searcher->get_schema,
+);
+
+# Build up a Query.
+my $query = $qparser->parse($q);
+if ($category) {
+ my $category_query = KinoSearch::Search::TermQuery->new(
+ field => 'category',
+ term => $category,
+ );
+ $query = KinoSearch::Search::ANDQuery->new(
+ children => [ $query, $category_query ]
+ );
+}
+
+# Execute the Query and get a Hits object.
+my $hits = $searcher->hits(
+ query => $query,
+ offset => $offset,
+ num_wanted => $hits_per_page,
+);
+my $hit_count = $hits->total_hits;
+
+# Arrange for highlighted excerpts to be created.
+my $highlighter = KinoSearch::Highlight::Highlighter->new(
+ searcher => $searcher,
+ query => $q,
+ field => 'content'
+);
+
+# Create result list.
+my $report = '';
+while ( my $hit = $hits->next ) {
+ my $score = sprintf( "%0.3f", $hit->get_score );
+ my $title = encode_entities( $hit->{title} );
+ my $excerpt = $highlighter->create_excerpt($hit);
+ $report .= qq|
+ <p>
+ <a href="$hit->{url}"><strong>$title</strong></a>
+ <em>$score</em>
+ <br />
+ $excerpt
+ <br />
+ <span class="excerptURL">$hit->{url}</span>
+ </p>
+ |;
+}
+
+#--------------------------------------------------------------------------#
+# No KinoSearch tutorial material below this point - just html generation. #
+#--------------------------------------------------------------------------#
+
+# Generate html, print and exit.
+my $paging_links = generate_paging_info( $q, $hit_count );
+my $cat_select = generate_category_select($category);
+blast_out_content( $q, $report, $paging_links, $cat_select );
+
+# Create html fragment with links for paging through results n-at-a-time.
+sub generate_paging_info {
+ my ( $query_string, $total_hits ) = @_;
+ $query_string = encode_entities($query_string);
+ my $paging_info;
+ if ( !length $query_string ) {
+ # No query? No display.
+ $paging_info = '';
+ }
+ elsif ( $total_hits == 0 ) {
+ # Alert the user that their search failed.
+ $paging_info
+ = qq|<p>No matches for <strong>$query_string</strong></p>|;
+ }
+ else {
+ my $current_page = ( $offset / $hits_per_page ) + 1;
+ my $pager = Data::Pageset->new(
+ { total_entries => $total_hits,
+ entries_per_page => $hits_per_page,
+ current_page => $current_page,
+ pages_per_set => 10,
+ mode => 'slide',
+ }
+ );
+ my $last_result = $pager->last;
+ my $first_result = $pager->first;
+
+ # Display the result nums, start paging info.
+ $paging_info = qq|
+ <p>
+ Results <strong>$first_result-$last_result</strong>
+ of <strong>$total_hits</strong>
+ for <strong>$query_string</strong>.
+ </p>
+ <p>
+ Results Page:
+ |;
+
+ # Create a url for use in paging links.
+ my $href = $cgi->url( -relative => 1 ) . "?" . $cgi->query_string;
+ $href .= ";offset=0" unless $href =~ /offset=/;
+
+ # Generate the "Prev" link.
+ if ( $current_page > 1 ) {
+ my $new_offset = ( $current_page - 2 ) * $hits_per_page;
+ $href =~ s/(?<=offset=)\d+/$new_offset/;
+ $paging_info .= qq|<a href="$href"><= Prev</a>\n|;
+ }
+
+ # Generate paging links.
+ for my $page_num ( @{ $pager->pages_in_set } ) {
+ if ( $page_num == $current_page ) {
+ $paging_info .= qq|$page_num \n|;
+ }
+ else {
+ my $new_offset = ( $page_num - 1 ) * $hits_per_page;
+ $href =~ s/(?<=offset=)\d+/$new_offset/;
+ $paging_info .= qq|<a href="$href">$page_num</a>\n|;
+ }
+ }
+
+ # Generate the "Next" link.
+ if ( $current_page != $pager->last_page ) {
+ my $new_offset = $current_page * $hits_per_page;
+ $href =~ s/(?<=offset=)\d+/$new_offset/;
+ $paging_info .= qq|<a href="$href">Next =></a>\n|;
+ }
+
+ # Close tag.
+ $paging_info .= "</p>\n";
+ }
+
+ return $paging_info;
+}
+
+# Build up the HTML "select" object for the "category" field.
+sub generate_category_select {
+ my $cat = shift;
+ my $select = qq|
+ <select name="category">
+ <option value="">All Sections</option>
+ <option value="article">Articles</option>
+ <option value="amendment">Amendments</option>
+ </select>|;
+ if ($cat) {
+ $select =~ s/"$cat"/"$cat" selected/;
+ }
+ return $select;
+}
+
+# Print content to output.
+sub blast_out_content {
+ my ( $query_string, $hit_list, $paging_info, $category_select ) = @_;
+ $query_string = encode_entities($query_string);
+ print "Content-type: text/html\n\n";
+ print qq|
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-type"
+ content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css"
+ href="/us_constitution/uscon.css">
+ <title>KinoSearch: $query_string</title>
+</head>
+
+<body>
+
+ <div id="navigation">
+ <form id="usconSearch" action="">
+ <strong>
+ Search the
+ <a href="/us_constitution/index.html">US Constitution</a>:
+ </strong>
+ <input type="text" name="q" id="q" value="$query_string">
+ $category_select
+ <input type="submit" value="=>">
+ </form>
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ $hit_list
+
+ $paging_info
+
+ <p style="font-size: smaller; color: #666">
+ <em>
+ Powered by
+ <a href="http://www.rectangular.com/kinosearch/">KinoSearch</a>
+ </em>
+ </p>
+ </div><!--bodytext-->
+
+</body>
+
+</html>
+|;
+}
+
Propchange: incubator/lucy/trunk/import/perl/sample/search.cgi
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lucy/trunk/import/perl/sample/search.cgi
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend1.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend1.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend1.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend1.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment I</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment I
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend1.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend10.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend10.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend10.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend10.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment X</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment X
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>The powers not delegated to the United States by the Constitution, nor prohibited by it to the States, are reserved to the States respectively, or to the people.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend10.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend11.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend11.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend11.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend11.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XI</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XI
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>The Judicial power of the United States shall not be construed to extend to any suit in law or equity, commenced or prosecuted against one of the United States by Citizens of another State, or by Citizens or Subjects of any Foreign State.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend11.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend12.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend12.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend12.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend12.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,32 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XII</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XII
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>The Electors shall meet in their respective states, and vote by ballot for President and Vice-President, one of whom, at least, shall not be an inhabitant of the same state with themselves; they shall name in their ballots the person voted for as President, and in distinct ballots the person voted for as Vice-President, and they shall make distinct lists of all persons voted for as President, and of all persons voted for as Vice-President and of the number of votes for each, which lists they shall sign and certify, and transmit sealed to the seat of the government of the United States, directed to the President of the Senate; </p>
+ <p>The President of the Senate shall, in the presence of the Senate and House of Representatives, open all the certificates and the votes shall then be counted; </p>
+ <p>The person having the greatest Number of votes for President, shall be the President, if such number be a majority of the whole number of Electors appointed; and if no person have such majority, then from the persons having the highest numbers not exceeding three on the list of those voted for as President, the House of Representatives shall choose immediately, by ballot, the President. But in choosing the President, the votes shall be taken by states, the representation from each state having one vote; a quorum for this purpose shall consist of a member or members from two-thirds of the states, and a majority of all the states shall be necessary to a choice. And if the House of Representatives shall not choose a President whenever the right of choice shall devolve upon them, before the fourth day of March next following, then the Vice-President shall act as President, as in the case of the death or other constitutional disability of the President. </p>
+ <p>The person having the greatest number of votes as Vice-President, shall be the Vice-President, if such number be a majority of the whole number of Electors appointed, and if no person have a majority, then from the two highest numbers on the list, the Senate shall choose the Vice-President; a quorum for the purpose shall consist of two-thirds of the whole number of Senators, and a majority of the whole number shall be necessary to a choice. But no person constitutionally ineligible to the office of President shall be eligible to that of Vice-President of the United States.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend12.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend13.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend13.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend13.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend13.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XIII</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XIII
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>1. Neither slavery nor involuntary servitude, except as a punishment for crime whereof the party shall have been duly convicted, shall exist within the United States, or any place subject to their jurisdiction. </p>
+ <p>2. Congress shall have power to enforce this article by appropriate legislation.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend13.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend14.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend14.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend14.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend14.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XIV</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XIV
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>1. All persons born or naturalized in the United States, and subject to the jurisdiction thereof, are citizens of the United States and of the State wherein they reside. No State shall make or enforce any law which shall abridge the privileges or immunities of citizens of the United States; nor shall any State deprive any person of life, liberty, or property, without due process of law; nor deny to any person within its jurisdiction the equal protection of the laws. </p>
+ <p>2. Representatives shall be apportioned among the several States according to their respective numbers, counting the whole number of persons in each State, excluding Indians not taxed. But when the right to vote at any election for the choice of electors for President and Vice-President of the United States, Representatives in Congress, the Executive and Judicial officers of a State, or the members of the Legislature thereof, is denied to any of the male inhabitants of such State, being twenty-one years of age, and citizens of the United States, or in any way abridged, except for participation in rebellion, or other crime, the basis of representation therein shall be reduced in the proportion which the number of such male citizens shall bear to the whole number of male citizens twenty-one years of age in such State. </p>
+ <p>3. No person shall be a Senator or Representative in Congress, or elector of President and Vice-President, or hold any office, civil or military, under the United States, or under any State, who, having previously taken an oath, as a member of Congress, or as an officer of the United States, or as a member of any State legislature, or as an executive or judicial officer of any State, to support the Constitution of the United States, shall have engaged in insurrection or rebellion against the same, or given aid or comfort to the enemies thereof. But Congress may by a vote of two-thirds of each House, remove such disability. </p>
+ <p>4. The validity of the public debt of the United States, authorized by law, including debts incurred for payment of pensions and bounties for services in suppressing insurrection or rebellion, shall not be questioned. But neither the United States nor any State shall assume or pay any debt or obligation incurred in aid of insurrection or rebellion against the United States, or any claim for the loss or emancipation of any slave; but all such debts, obligations and claims shall be held illegal and void. </p>
+ <p>5. The Congress shall have power to enforce, by appropriate legislation, the provisions of this article.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend14.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend15.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend15.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend15.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend15.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XV</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XV
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>1. The right of citizens of the United States to vote shall not be denied or abridged by the United States or by any State on account of race, color, or previous condition of servitude. </p>
+ <p>2. The Congress shall have power to enforce this article by appropriate legislation.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend15.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend16.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend16.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend16.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend16.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XVI</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XVI
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p> The Congress shall have power to lay and collect taxes on incomes, from whatever source derived, without apportionment among the several States, and without regard to any census or enumeration.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend16.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend17.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend17.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend17.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend17.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,31 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XVII</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XVII
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>The Senate of the United States shall be composed of two Senators from each State, elected by the people thereof, for six years; and each Senator shall have one vote. The electors in each State shall have the qualifications requisite for electors of the most numerous branch of the State legislatures. </p>
+ <p>When vacancies happen in the representation of any State in the Senate, the executive authority of such State shall issue writs of election to fill such vacancies: Provided, That the legislature of any State may empower the executive thereof to make temporary appointments until the people fill the vacancies by election as the legislature may direct. </p>
+ <p>This amendment shall not be so construed as to affect the election or term of any Senator chosen before it becomes valid as part of the Constitution.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend17.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend18.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend18.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend18.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend18.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,31 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XVIII</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XVIII
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>1. After one year from the ratification of this article the manufacture, sale, or transportation of intoxicating liquors within, the importation thereof into, or the exportation thereof from the United States and all territory subject to the jurisdiction thereof for beverage purposes is hereby prohibited. </p>
+ <p>2. The Congress and the several States shall have concurrent power to enforce this article by appropriate legislation. </p>
+ <p>3. This article shall be inoperative unless it shall have been ratified as an amendment to the Constitution by the legislatures of the several States, as provided in the Constitution, within seven years from the date of the submission hereof to the States by the Congress.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend18.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend19.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend19.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend19.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend19.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XIX</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XIX
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>The right of citizens of the United States to vote shall not be denied or abridged by the United States or by any State on account of sex. </p>
+ <p>Congress shall have power to enforce this article by appropriate legislation.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend19.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend2.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend2.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend2.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend2.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment II</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment II
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed. </p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend2.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend20.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend20.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend20.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend20.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XX</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XX
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>1. The terms of the President and Vice President shall end at noon on the 20th day of January, and the terms of Senators and Representatives at noon on the 3d day of January, of the years in which such terms would have ended if this article had not been ratified; and the terms of their successors shall then begin. </p>
+ <p>2. The Congress shall assemble at least once in every year, and such meeting shall begin at noon on the 3d day of January, unless they shall by law appoint a different day. </p>
+ <p>3. If, at the time fixed for the beginning of the term of the President, the President elect shall have died, the Vice President elect shall become President. If a President shall not have been chosen before the time fixed for the beginning of his term, or if the President elect shall have failed to qualify, then the Vice President elect shall act as President until a President shall have qualified; and the Congress may by law provide for the case wherein neither a President elect nor a Vice President elect shall have qualified, declaring who shall then act as President, or the manner in which one who is to act shall be selected, and such person shall act accordingly until a President or Vice President shall have qualified. </p>
+ <p>4. The Congress may by law provide for the case of the death of any of the persons from whom the House of Representatives may choose a President whenever the right of choice shall have devolved upon them, and for the case of the death of any of the persons from whom the Senate may choose a Vice President whenever the right of choice shall have devolved upon them. </p>
+ <p>5. Sections 1 and 2 shall take effect on the 15th day of October following the ratification of this article. </p>
+ <p>6. This article shall be inoperative unless it shall have been ratified as an amendment to the Constitution by the legislatures of three-fourths of the several States within seven years from the date of its submission.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend20.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend21.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend21.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend21.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend21.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,31 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XXI</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XXI
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>1. The eighteenth article of amendment to the Constitution of the United States is hereby repealed. </p>
+ <p>2. The transportation or importation into any State, Territory, or possession of the United States for delivery or use therein of intoxicating liquors, in violation of the laws thereof, is hereby prohibited. </p>
+ <p>3. The article shall be inoperative unless it shall have been ratified as an amendment to the Constitution by conventions in the several States, as provided in the Constitution, within seven years from the date of the submission hereof to the States by the Congress.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend21.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend22.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend22.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend22.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend22.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XXII</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XXII
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>1. No person shall be elected to the office of the President more than twice, and no person who has held the office of President, or acted as President, for more than two years of a term to which some other person was elected President shall be elected to the office of the President more than once. But this Article shall not apply to any person holding the office of President, when this Article was proposed by the Congress, and shall not prevent any person who may be holding the office of President, or acting as President, during the term within which this Article becomes operative from holding the office of President or acting as President during the remainder of such term. </p>
+ <p>2. This article shall be inoperative unless it shall have been ratified as an amendment to the Constitution by the legislatures of three-fourths of the several States within seven years from the date of its submission to the States by the Congress.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend22.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/trunk/import/perl/sample/us_constitution/amend23.html
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/perl/sample/us_constitution/amend23.html?rev=1022422&view=auto
==============================================================================
--- incubator/lucy/trunk/import/perl/sample/us_constitution/amend23.html (added)
+++ incubator/lucy/trunk/import/perl/sample/us_constitution/amend23.html Thu Oct 14 08:48:04 2010
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
+ <link rel="stylesheet" type="text/css" href="uscon.css">
+ <title>Amendment XXIII</title>
+ </head>
+
+ <body>
+
+ <div id="navigation">
+ <a href="index.html">US Constitution</a> >
+ <a href="index.html#amendments">Amendments</a> >
+ Amendment XXIII
+ </div><!--navigation-->
+
+ <div id="bodytext">
+
+ <p>1. The District constituting the seat of Government of the United States shall appoint in such manner as the Congress may direct: A number of electors of President and Vice President equal to the whole number of Senators and Representatives in Congress to which the District would be entitled if it were a State, but in no event more than the least populous State; they shall be in addition to those appointed by the States, but they shall be considered, for the purposes of the election of President and Vice President, to be electors appointed by a State; and they shall meet in the District and perform such duties as provided by the twelfth article of amendment. </p>
+ <p>2. The Congress shall have power to enforce this article by appropriate legislation.</p>
+
+
+ </div><!--bodytext-->
+
+ </body>
+
+</html>
+
Propchange: incubator/lucy/trunk/import/perl/sample/us_constitution/amend23.html
------------------------------------------------------------------------------
svn:eol-style = native