Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: kinosearch: commits

r3718 - in trunk: c_src/KinoSearch perl/lib perl/lib/KinoSearch

 

 

kinosearch commits RSS feed   Index | Next | Previous | View Threaded


marvin at rectangular

Aug 4, 2008, 5:38 PM

Post #1 of 1 (536 views)
Permalink
r3718 - in trunk: c_src/KinoSearch perl/lib perl/lib/KinoSearch

Author: creamyg
Date: 2008-08-04 17:38:29 -0700 (Mon, 04 Aug 2008)
New Revision: 3718

Modified:
trunk/c_src/KinoSearch/Schema.bp
trunk/c_src/KinoSearch/Schema.c
trunk/perl/lib/KinoSearch.pm
trunk/perl/lib/KinoSearch/Schema.pm
Log:
Port some Schema methods to C.


Modified: trunk/c_src/KinoSearch/Schema.bp
===================================================================
--- trunk/c_src/KinoSearch/Schema.bp 2008-08-05 00:38:01 UTC (rev 3717)
+++ trunk/c_src/KinoSearch/Schema.bp 2008-08-05 00:38:29 UTC (rev 3718)
@@ -17,6 +17,18 @@
static Schema*
init(Schema *self);

+ public abstract incremented Analyzer*
+ Analyzer(Schema *self);
+
+ public incremented Similarity*
+ Similarity(Schema *self);
+
+ public i32_t
+ Index_Interval(Schema *self);
+
+ public i32_t
+ Skip_Interval(Schema *self);
+
/** Add a field name / field spec pair to the Schema.
*
* @param field The name of the field.

Modified: trunk/c_src/KinoSearch/Schema.c
===================================================================
--- trunk/c_src/KinoSearch/Schema.c 2008-08-05 00:38:01 UTC (rev 3717)
+++ trunk/c_src/KinoSearch/Schema.c 2008-08-05 00:38:29 UTC (rev 3718)
@@ -28,10 +28,10 @@
self->by_num = VA_new(0);

/* Assign. */
- self->index_interval = Native_callback_i(self, "index_interval", 0);
- self->skip_interval = Native_callback_i(self, "skip_interval", 0);
- self->analyzer = (Analyzer*)Native_callback_obj(self, "analyzer", 0);
- self->sim = (Similarity*)Native_callback_obj(self, "similarity", 0);
+ self->index_interval = Schema_Index_Interval(self);
+ self->skip_interval = Schema_Skip_Interval(self);
+ self->analyzer = Schema_Analyzer(self);
+ self->sim = Schema_Similarity(self);
if (!self->analyzer || !OBJ_IS_A(self->analyzer, ANALYZER))
CONFESS("Invalid Analyzer");
if (!self->sim || !OBJ_IS_A(self->sim, SIMILARITY))
@@ -45,6 +45,27 @@
return self;
}

+Similarity*
+Schema_similarity(Schema *self)
+{
+ UNUSED_VAR(self);
+ return Sim_new();
+}
+
+i32_t
+Schema_index_interval(Schema *self)
+{
+ UNUSED_VAR(self);
+ return 128;
+}
+
+i32_t
+Schema_skip_interval(Schema *self)
+{
+ UNUSED_VAR(self);
+ return 16;
+}
+
void
Schema_add_field(Schema *self, const CharBuf *field,
const CharBuf *field_spec_class)
@@ -171,22 +192,6 @@
}
}

-Analyzer*
-Schema_analyzer(Schema *self)
-{
- Analyzer *analyzer = (Analyzer*)Native_callback_obj(self, "analyzer", 0);
- if (!analyzer) CONFESS("Failed to return an Analyzer");
- return analyzer;
-}
-
-Similarity*
-Schema_similarity(Schema *self)
-{
- Similarity *sim = (Similarity*)Native_callback_obj(self, "similarity", 0);
- if (!sim) CONFESS("Failed to return a Similarity");
- return sim;
-}
-
FieldSpec*
Schema_fetch_fspec(Schema *self, const CharBuf *field_name)
{

Modified: trunk/perl/lib/KinoSearch/Schema.pm
===================================================================
--- trunk/perl/lib/KinoSearch/Schema.pm 2008-08-05 00:38:01 UTC (rev 3717)
+++ trunk/perl/lib/KinoSearch/Schema.pm 2008-08-05 00:38:29 UTC (rev 3718)
@@ -20,27 +20,23 @@
}
OUTPUT: RETVAL

-SV*
-field_num(self, field_name)
- kino_Schema *self;
- kino_CharBuf field_name;
-CODE:
-{
- chy_i32_t num = Kino_Schema_Field_Num(self, &field_name);
- RETVAL = num == -1
- ? newSV(0)
- : newSViv(num);
-}
-OUTPUT: RETVAL
-
__AUTO_XS__

{ "KinoSearch::Schema" => {
bind_methods => [.
- qw( fetch_fspec fetch_analyzer fetch_sim fetch_posting num_fields
- _all_fields|all_fields add_field )
+ qw( analyzer
+ similarity
+ index_interval
+ skip_interval
+ fetch_fspec
+ fetch_analyzer
+ fetch_sim
+ fetch_posting
+ num_fields
+ field_num
+ _all_fields|all_fields
+ add_field )
],
- make_getters => [qw( fspecs sims )],
make_constructors => [qw( _new )],
}
}

Modified: trunk/perl/lib/KinoSearch.pm
===================================================================
--- trunk/perl/lib/KinoSearch.pm 2008-08-05 00:38:01 UTC (rev 3717)
+++ trunk/perl/lib/KinoSearch.pm 2008-08-05 00:38:29 UTC (rev 3718)
@@ -365,11 +365,6 @@
package KinoSearch::Schema;
use KinoSearch::Util::ToolSet qw( confess blessed );

- sub analyzer { shift->abstract_death }
- sub similarity { KinoSearch::Search::Similarity->new }
- sub index_interval {128}
- sub skip_interval {16}
-
sub new {
my $either = shift;
my $class = ref($either) || $either;


_______________________________________________
kinosearch-commits mailing list
kinosearch-commits [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch-commits

kinosearch commits RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.