You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2015/05/04 18:46:20 UTC
[1/4] lucy git commit: Hash_Sum removal broke LucyX::Search::Filter
Repository: lucy
Updated Branches:
refs/heads/master be1b383bf -> 829c6d0a4
Hash_Sum removal broke LucyX::Search::Filter
Use the object address directly instead of calling Hash_Sum.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/829c6d0a
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/829c6d0a
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/829c6d0a
Branch: refs/heads/master
Commit: 829c6d0a4244035123b921e3bb3d3faa456c8c5b
Parents: df1d915
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon May 4 17:28:15 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon May 4 18:45:56 2015 +0200
----------------------------------------------------------------------
perl/lib/LucyX/Search/Filter.pm | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/829c6d0a/perl/lib/LucyX/Search/Filter.pm
----------------------------------------------------------------------
diff --git a/perl/lib/LucyX/Search/Filter.pm b/perl/lib/LucyX/Search/Filter.pm
index 8de55db..e070479 100644
--- a/perl/lib/LucyX/Search/Filter.pm
+++ b/perl/lib/LucyX/Search/Filter.pm
@@ -129,7 +129,7 @@ sub _store_cached_bits {
my ( $self, $seg_reader, $bits ) = @_;
my $pair = { seg_reader => $seg_reader, bits => $bits };
weaken( $pair->{seg_reader} );
- $cached_bits{$$self}{ $seg_reader->hash_sum } = $pair;
+ $cached_bits{$$self}{$$seg_reader} = $pair;
}
# Retrieve a cached BitVector associated with a particular SegReader. As a
@@ -140,15 +140,15 @@ sub _fetch_cached_bits {
my $cached_bits = $cached_bits{$$self};
# Sweep.
- while ( my ( $hash_sum, $pair ) = each %$cached_bits ) {
+ while ( my ( $addr, $pair ) = each %$cached_bits ) {
# If weak ref has decomposed into undef, SegReader is gone... so
# delete.
next if defined $pair->{seg_reader};
- delete $cached_bits->{$hash_sum};
+ delete $cached_bits->{$addr};
}
# Fetch.
- my $pair = $cached_bits->{ $seg_reader->hash_sum };
+ my $pair = $cached_bits->{$$seg_reader};
return $pair->{bits} if defined $pair;
return;
}
[lucy-dev] Re: [4/4] lucy git commit: Fix dumping of Nums
Posted by Marvin Humphrey <ma...@rectangular.com>.
On Mon, May 4, 2015 at 9:46 AM, <nw...@apache.org> wrote:
> Fix dumping of Nums
>
> Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
> Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/78889bcd
> Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/78889bcd
> Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/78889bcd
> http://git-wip-us.apache.org/repos/asf/lucy/blob/78889bcd/core/Lucy/Util/Freezer.c
> ----------------------------------------------------------------------
> diff --git a/core/Lucy/Util/Freezer.c b/core/Lucy/Util/Freezer.c
> index c427d55..7e053fd 100644
> --- a/core/Lucy/Util/Freezer.c
> +++ b/core/Lucy/Util/Freezer.c
> @@ -384,7 +384,7 @@ Freezer_dump(Obj *obj) {
> return Query_Dump((Query*)obj);
> }
> else {
> - return (Obj*)Obj_To_String(obj);
> + return (Obj*)Obj_Clone(obj);
> }
> }
This might be a reasonable design, but it doesn't match the API documentation:
/** Return a representation of the object using only scalars, hashes, and
* arrays. Some classes support JSON serialization via dump() and its
* companion, load(); for others, dump() is only a debugging aid.
* The default simply calls [](cfish:.To_String).
*/
inert incremented Obj*
dump(Obj *obj);
Perhaps consider adding another conditional branch:
else if (Obj_Is_A(obj, NUM)) {
return Obj_Clone(obj);
}
else {
return Obj_To_String(obj);
}
This maintains the guarantee that `Freezer_dump` will always produce a
JSON-izable data structure, even if it means stringifying unsupported types.
Marvin Humphrey
[4/4] lucy git commit: Fix dumping of Nums
Posted by nw...@apache.org.
Fix dumping of Nums
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/78889bcd
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/78889bcd
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/78889bcd
Branch: refs/heads/master
Commit: 78889bcdcfea5f8f7d999cd8da0a74a9036353b4
Parents: be1b383
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon May 4 17:10:28 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon May 4 18:45:56 2015 +0200
----------------------------------------------------------------------
core/Lucy/Util/Freezer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/78889bcd/core/Lucy/Util/Freezer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Freezer.c b/core/Lucy/Util/Freezer.c
index c427d55..7e053fd 100644
--- a/core/Lucy/Util/Freezer.c
+++ b/core/Lucy/Util/Freezer.c
@@ -384,7 +384,7 @@ Freezer_dump(Obj *obj) {
return Query_Dump((Query*)obj);
}
else {
- return (Obj*)Obj_To_String(obj);
+ return (Obj*)Obj_Clone(obj);
}
}
[3/4] lucy git commit: Fix for segment merging test
Posted by nw...@apache.org.
Fix for segment merging test
The changed sort order of duplicate keys made this test fail.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/df1d915f
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/df1d915f
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/df1d915f
Branch: refs/heads/master
Commit: df1d915f16e683fe5afcafede7792df67b166233
Parents: 46023d5
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon May 4 17:19:36 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon May 4 18:45:56 2015 +0200
----------------------------------------------------------------------
perl/t/213-segment_merging.t | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/df1d915f/perl/t/213-segment_merging.t
----------------------------------------------------------------------
diff --git a/perl/t/213-segment_merging.t b/perl/t/213-segment_merging.t
index 900976e..afe05d5 100644
--- a/perl/t/213-segment_merging.t
+++ b/perl/t/213-segment_merging.t
@@ -164,7 +164,7 @@ is( num_segmeta($index_loc), 1, "merged segment files successfully deleted" );
schema => $schema,
manager => NonMergingIndexManager->new,
);
- $indexer->add_doc( { content => $number++ } ) for 1 .. 20;
+ $indexer->add_doc( { content => $number++ } ) for 1 .. 100;
$indexer->commit;
}
my $indexer = Lucy::Index::Indexer->new(
@@ -172,7 +172,7 @@ is( num_segmeta($index_loc), 1, "merged segment files successfully deleted" );
schema => $schema,
);
$indexer->delete_by_term( field => 'content', term => $_ )
- for ( 3, 23, 24, 25 );
+ for ( 3, 103..113 );
$indexer->commit;
ok( $folder->exists("seg_1/segmeta.json"),
[2/4] lucy git commit: Fix and run Freezer tests
Posted by nw...@apache.org.
Fix and run Freezer tests
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/46023d57
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/46023d57
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/46023d57
Branch: refs/heads/master
Commit: 46023d57b89b83e146728aca2e42e325d14efa65
Parents: 78889bc
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon May 4 17:15:40 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon May 4 18:45:56 2015 +0200
----------------------------------------------------------------------
core/Lucy/Test.c | 2 ++
core/Lucy/Test/Util/TestFreezer.c | 2 +-
perl/t/core/037-freezer.t | 23 +++++++++++++++++++++++
3 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/46023d57/core/Lucy/Test.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test.c b/core/Lucy/Test.c
index 196ae6a..6817911 100644
--- a/core/Lucy/Test.c
+++ b/core/Lucy/Test.c
@@ -77,6 +77,7 @@
#include "Lucy/Test/Store/TestRAMFileHandle.h"
#include "Lucy/Test/Store/TestRAMFolder.h"
#include "Lucy/Test/TestSchema.h"
+#include "Lucy/Test/Util/TestFreezer.h"
#include "Lucy/Test/Util/TestIndexFileNames.h"
#include "Lucy/Test/Util/TestJson.h"
#include "Lucy/Test/Util/TestMemoryPool.h"
@@ -93,6 +94,7 @@ Test_create_test_suite() {
TestSuite_Add_Batch(suite, (TestBatch*)TestMemPool_new());
TestSuite_Add_Batch(suite, (TestBatch*)TestIxFileNames_new());
TestSuite_Add_Batch(suite, (TestBatch*)TestJson_new());
+ TestSuite_Add_Batch(suite, (TestBatch*)TestFreezer_new());
TestSuite_Add_Batch(suite, (TestBatch*)TestI32Arr_new());
TestSuite_Add_Batch(suite, (TestBatch*)TestRAMFH_new());
TestSuite_Add_Batch(suite, (TestBatch*)TestFSFH_new());
http://git-wip-us.apache.org/repos/asf/lucy/blob/46023d57/core/Lucy/Test/Util/TestFreezer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestFreezer.c b/core/Lucy/Test/Util/TestFreezer.c
index 90c8336..2b924b9 100644
--- a/core/Lucy/Test/Util/TestFreezer.c
+++ b/core/Lucy/Test/Util/TestFreezer.c
@@ -171,7 +171,7 @@ test_varray(TestBatchRunner *runner) {
void
TestFreezer_Run_IMP(TestFreezer *self, TestBatchRunner *runner) {
- TestBatchRunner_Plan(runner, (TestBatch*)self, 10);
+ TestBatchRunner_Plan(runner, (TestBatch*)self, 11);
test_bytebuf(runner);
test_string(runner);
test_hash(runner);
http://git-wip-us.apache.org/repos/asf/lucy/blob/46023d57/perl/t/core/037-freezer.t
----------------------------------------------------------------------
diff --git a/perl/t/core/037-freezer.t b/perl/t/core/037-freezer.t
new file mode 100644
index 0000000..8772651
--- /dev/null
+++ b/perl/t/core/037-freezer.t
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+use strict;
+use warnings;
+
+use Lucy::Test;
+my $success = Lucy::Test::run_tests("Lucy::Test::Util::TestFreezer");
+
+exit($success ? 0 : 1);
+