You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/05/02 01:50:38 UTC
[lucy-commits] svn commit: r1098445 [13/23] - in /incubator/lucy/trunk: charmonizer/
charmonizer/src/Charmonizer/ charmonizer/src/Charmonizer/Core/
charmonizer/src/Charmonizer/Probe/ charmonizer/src/Charmonizer/Test/
clownfish/lib/ clownfish/lib/Clownfish/Binding/ cl...
Modified: incubator/lucy/trunk/core/Lucy/Search/LeafQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/LeafQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/LeafQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/LeafQuery.c Sun May 1 23:50:24 2011
@@ -24,15 +24,13 @@
#include "Lucy/Store/OutStream.h"
LeafQuery*
-LeafQuery_new(const CharBuf *field, const CharBuf *text)
-{
+LeafQuery_new(const CharBuf *field, const CharBuf *text) {
LeafQuery *self = (LeafQuery*)VTable_Make_Obj(LEAFQUERY);
return LeafQuery_init(self, field, text);
}
LeafQuery*
-LeafQuery_init(LeafQuery *self, const CharBuf *field, const CharBuf *text)
-{
+LeafQuery_init(LeafQuery *self, const CharBuf *field, const CharBuf *text) {
Query_init((Query*)self, 1.0f);
self->field = field ? CB_Clone(field) : NULL;
self->text = CB_Clone(text);
@@ -40,21 +38,24 @@ LeafQuery_init(LeafQuery *self, const Ch
}
void
-LeafQuery_destroy(LeafQuery *self)
-{
+LeafQuery_destroy(LeafQuery *self) {
DECREF(self->field);
DECREF(self->text);
SUPER_DESTROY(self, LEAFQUERY);
}
-CharBuf*
-LeafQuery_get_field(LeafQuery *self) { return self->field; }
-CharBuf*
-LeafQuery_get_text(LeafQuery *self) { return self->text; }
+CharBuf*
+LeafQuery_get_field(LeafQuery *self) {
+ return self->field;
+}
+
+CharBuf*
+LeafQuery_get_text(LeafQuery *self) {
+ return self->text;
+}
bool_t
-LeafQuery_equals(LeafQuery *self, Obj *other)
-{
+LeafQuery_equals(LeafQuery *self, Obj *other) {
LeafQuery *twin = (LeafQuery*)other;
if (twin == self) return true;
if (!Obj_Is_A(other, LEAFQUERY)) return false;
@@ -68,8 +69,7 @@ LeafQuery_equals(LeafQuery *self, Obj *o
}
CharBuf*
-LeafQuery_to_string(LeafQuery *self)
-{
+LeafQuery_to_string(LeafQuery *self) {
if (self->field) {
return CB_newf("%o:%o", self->field, self->text);
}
@@ -79,8 +79,7 @@ LeafQuery_to_string(LeafQuery *self)
}
void
-LeafQuery_serialize(LeafQuery *self, OutStream *outstream)
-{
+LeafQuery_serialize(LeafQuery *self, OutStream *outstream) {
if (self->field) {
OutStream_Write_U8(outstream, true);
CB_Serialize(self->field, outstream);
@@ -93,20 +92,18 @@ LeafQuery_serialize(LeafQuery *self, Out
}
LeafQuery*
-LeafQuery_deserialize(LeafQuery *self, InStream *instream)
-{
+LeafQuery_deserialize(LeafQuery *self, InStream *instream) {
self = self ? self : (LeafQuery*)VTable_Make_Obj(LEAFQUERY);
- self->field = InStream_Read_U8(instream)
- ? CB_deserialize(NULL, instream)
- : NULL;
+ self->field = InStream_Read_U8(instream)
+ ? CB_deserialize(NULL, instream)
+ : NULL;
self->text = CB_deserialize(NULL, instream);
self->boost = InStream_Read_F32(instream);
return self;
}
Compiler*
-LeafQuery_make_compiler(LeafQuery *self, Searcher *searcher, float boost)
-{
+LeafQuery_make_compiler(LeafQuery *self, Searcher *searcher, float boost) {
UNUSED_VAR(self);
UNUSED_VAR(searcher);
UNUSED_VAR(boost);
Modified: incubator/lucy/trunk/core/Lucy/Search/LeafQuery.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/LeafQuery.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/LeafQuery.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/LeafQuery.cfh Sun May 1 23:50:24 2011
@@ -25,7 +25,7 @@ parcel Lucy;
* L<PhraseQuery|Lucy::Search::PhraseQuery> objects, as attempting to
* search a LeafQuery causes an error.
*/
-class Lucy::Search::LeafQuery inherits Lucy::Search::Query
+class Lucy::Search::LeafQuery inherits Lucy::Search::Query
: dumpable {
CharBuf *field;
Modified: incubator/lucy/trunk/core/Lucy/Search/MatchAllMatcher.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/MatchAllMatcher.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/MatchAllMatcher.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/MatchAllMatcher.c Sun May 1 23:50:24 2011
@@ -20,16 +20,14 @@
#include "Lucy/Search/MatchAllMatcher.h"
MatchAllMatcher*
-MatchAllMatcher_new(float score, int32_t doc_max)
-{
- MatchAllMatcher *self
+MatchAllMatcher_new(float score, int32_t doc_max) {
+ MatchAllMatcher *self
= (MatchAllMatcher*)VTable_Make_Obj(MATCHALLMATCHER);
return MatchAllMatcher_init(self, score, doc_max);
}
MatchAllMatcher*
-MatchAllMatcher_init(MatchAllMatcher *self, float score, int32_t doc_max)
-{
+MatchAllMatcher_init(MatchAllMatcher *self, float score, int32_t doc_max) {
Matcher_init((Matcher*)self);
self->doc_id = 0;
self->score = score;
@@ -38,8 +36,7 @@ MatchAllMatcher_init(MatchAllMatcher *se
}
int32_t
-MatchAllMatcher_next(MatchAllMatcher* self)
-{
+MatchAllMatcher_next(MatchAllMatcher* self) {
if (++self->doc_id <= self->doc_max) {
return self->doc_id;
}
@@ -50,21 +47,18 @@ MatchAllMatcher_next(MatchAllMatcher* se
}
int32_t
-MatchAllMatcher_advance(MatchAllMatcher* self, int32_t target)
-{
+MatchAllMatcher_advance(MatchAllMatcher* self, int32_t target) {
self->doc_id = target - 1;
return MatchAllMatcher_next(self);
}
float
-MatchAllMatcher_score(MatchAllMatcher* self)
-{
+MatchAllMatcher_score(MatchAllMatcher* self) {
return self->score;
}
-int32_t
-MatchAllMatcher_get_doc_id(MatchAllMatcher* self)
-{
+int32_t
+MatchAllMatcher_get_doc_id(MatchAllMatcher* self) {
return self->doc_id;
}
Modified: incubator/lucy/trunk/core/Lucy/Search/MatchAllMatcher.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/MatchAllMatcher.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/MatchAllMatcher.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/MatchAllMatcher.cfh Sun May 1 23:50:24 2011
@@ -41,7 +41,7 @@ class Lucy::Search::MatchAllMatcher inhe
public float
Score(MatchAllMatcher* self);
- public int32_t
+ public int32_t
Get_Doc_ID(MatchAllMatcher* self);
}
Modified: incubator/lucy/trunk/core/Lucy/Search/MatchAllQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/MatchAllQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/MatchAllQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/MatchAllQuery.c Sun May 1 23:50:24 2011
@@ -30,21 +30,18 @@
#include "Lucy/Util/Freezer.h"
MatchAllQuery*
-MatchAllQuery_new()
-{
+MatchAllQuery_new() {
MatchAllQuery *self = (MatchAllQuery*)VTable_Make_Obj(MATCHALLQUERY);
return MatchAllQuery_init(self);
}
MatchAllQuery*
-MatchAllQuery_init(MatchAllQuery *self)
-{
+MatchAllQuery_init(MatchAllQuery *self) {
return (MatchAllQuery*)Query_init((Query*)self, 0.0f);
}
bool_t
-MatchAllQuery_equals(MatchAllQuery *self, Obj *other)
-{
+MatchAllQuery_equals(MatchAllQuery *self, Obj *other) {
MatchAllQuery *twin = (MatchAllQuery*)other;
if (!Obj_Is_A(other, MATCHALLQUERY)) return false;
if (self->boost != twin->boost) return false;
@@ -52,51 +49,45 @@ MatchAllQuery_equals(MatchAllQuery *self
}
CharBuf*
-MatchAllQuery_to_string(MatchAllQuery *self)
-{
+MatchAllQuery_to_string(MatchAllQuery *self) {
UNUSED_VAR(self);
return CB_new_from_trusted_utf8("[MATCHALL]", 10);
}
Compiler*
-MatchAllQuery_make_compiler(MatchAllQuery *self, Searcher *searcher,
- float boost)
-{
+MatchAllQuery_make_compiler(MatchAllQuery *self, Searcher *searcher,
+ float boost) {
return (Compiler*)MatchAllCompiler_new(self, searcher, boost);
}
/**********************************************************************/
MatchAllCompiler*
-MatchAllCompiler_new(MatchAllQuery *parent, Searcher *searcher,
- float boost)
-{
- MatchAllCompiler *self
+MatchAllCompiler_new(MatchAllQuery *parent, Searcher *searcher,
+ float boost) {
+ MatchAllCompiler *self
= (MatchAllCompiler*)VTable_Make_Obj(MATCHALLCOMPILER);
return MatchAllCompiler_init(self, parent, searcher, boost);
}
MatchAllCompiler*
-MatchAllCompiler_init(MatchAllCompiler *self, MatchAllQuery *parent,
- Searcher *searcher, float boost)
-{
- return (MatchAllCompiler*)Compiler_init((Compiler*)self,
- (Query*)parent, searcher, NULL, boost);
+MatchAllCompiler_init(MatchAllCompiler *self, MatchAllQuery *parent,
+ Searcher *searcher, float boost) {
+ return (MatchAllCompiler*)Compiler_init((Compiler*)self, (Query*)parent,
+ searcher, NULL, boost);
}
MatchAllCompiler*
-MatchAllCompiler_deserialize(MatchAllCompiler *self, InStream *instream)
-{
- self = self
- ? self
- : (MatchAllCompiler*)VTable_Make_Obj(MATCHALLCOMPILER);
+MatchAllCompiler_deserialize(MatchAllCompiler *self, InStream *instream) {
+ self = self
+ ? self
+ : (MatchAllCompiler*)VTable_Make_Obj(MATCHALLCOMPILER);
return (MatchAllCompiler*)Compiler_deserialize((Compiler*)self, instream);
}
Matcher*
MatchAllCompiler_make_matcher(MatchAllCompiler *self, SegReader *reader,
- bool_t need_score)
-{
+ bool_t need_score) {
float weight = MatchAllCompiler_Get_Weight(self);
UNUSED_VAR(need_score);
return (Matcher*)MatchAllMatcher_new(weight, SegReader_Doc_Max(reader));
Modified: incubator/lucy/trunk/core/Lucy/Search/MatchAllQuery.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/MatchAllQuery.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/MatchAllQuery.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/MatchAllQuery.cfh Sun May 1 23:50:24 2011
@@ -23,7 +23,7 @@ parcel Lucy;
* which matches against another part of the query will be ranked higher than
* a document which matches only via the MatchAllQuery.
*/
-abstract class Lucy::Search::MatchAllQuery
+abstract class Lucy::Search::MatchAllQuery
inherits Lucy::Search::Query : dumpable {
inert incremented MatchAllQuery*
@@ -44,7 +44,7 @@ abstract class Lucy::Search::MatchAllQue
Make_Compiler(MatchAllQuery *self, Searcher *searcher, float boost);
}
-class Lucy::Search::MatchAllCompiler
+class Lucy::Search::MatchAllCompiler
inherits Lucy::Search::Compiler {
inert incremented MatchAllCompiler*
@@ -55,7 +55,7 @@ class Lucy::Search::MatchAllCompiler
Searcher *searcher, float boost);
public incremented nullable Matcher*
- Make_Matcher(MatchAllCompiler *self, SegReader *reader,
+ Make_Matcher(MatchAllCompiler *self, SegReader *reader,
bool_t need_score);
public incremented MatchAllCompiler*
Modified: incubator/lucy/trunk/core/Lucy/Search/MatchDoc.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/MatchDoc.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/MatchDoc.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/MatchDoc.c Sun May 1 23:50:24 2011
@@ -22,15 +22,13 @@
#include "Lucy/Store/OutStream.h"
MatchDoc*
-MatchDoc_new(int32_t doc_id, float score, VArray *values)
-{
+MatchDoc_new(int32_t doc_id, float score, VArray *values) {
MatchDoc *self = (MatchDoc*)VTable_Make_Obj(MATCHDOC);
return MatchDoc_init(self, doc_id, score, values);
}
MatchDoc*
-MatchDoc_init(MatchDoc *self, int32_t doc_id, float score, VArray *values)
-{
+MatchDoc_init(MatchDoc *self, int32_t doc_id, float score, VArray *values) {
self->doc_id = doc_id;
self->score = score;
self->values = (VArray*)INCREF(values);
@@ -38,15 +36,13 @@ MatchDoc_init(MatchDoc *self, int32_t do
}
void
-MatchDoc_destroy(MatchDoc *self)
-{
+MatchDoc_destroy(MatchDoc *self) {
DECREF(self->values);
SUPER_DESTROY(self, MATCHDOC);
}
void
-MatchDoc_serialize(MatchDoc *self, OutStream *outstream)
-{
+MatchDoc_serialize(MatchDoc *self, OutStream *outstream) {
OutStream_Write_C32(outstream, self->doc_id);
OutStream_Write_F32(outstream, self->score);
OutStream_Write_U8(outstream, self->values ? 1 : 0);
@@ -54,8 +50,7 @@ MatchDoc_serialize(MatchDoc *self, OutSt
}
MatchDoc*
-MatchDoc_deserialize(MatchDoc *self, InStream *instream)
-{
+MatchDoc_deserialize(MatchDoc *self, InStream *instream) {
self = self ? self : (MatchDoc*)VTable_Make_Obj(MATCHDOC);
self->doc_id = InStream_Read_C32(instream);
self->score = InStream_Read_F32(instream);
@@ -66,20 +61,32 @@ MatchDoc_deserialize(MatchDoc *self, InS
}
int32_t
-MatchDoc_get_doc_id(MatchDoc *self) { return self->doc_id; }
+MatchDoc_get_doc_id(MatchDoc *self) {
+ return self->doc_id;
+}
+
float
-MatchDoc_get_score(MatchDoc *self) { return self->score; }
+MatchDoc_get_score(MatchDoc *self) {
+ return self->score;
+}
+
VArray*
-MatchDoc_get_values(MatchDoc *self) { return self->values; }
+MatchDoc_get_values(MatchDoc *self) {
+ return self->values;
+}
+
void
-MatchDoc_set_doc_id(MatchDoc *self, int32_t doc_id)
- { self->doc_id = doc_id; }
+MatchDoc_set_doc_id(MatchDoc *self, int32_t doc_id) {
+ self->doc_id = doc_id;
+}
+
void
-MatchDoc_set_score(MatchDoc *self, float score)
- { self->score = score; }
+MatchDoc_set_score(MatchDoc *self, float score) {
+ self->score = score;
+}
+
void
-MatchDoc_set_values(MatchDoc *self, VArray *values)
-{
+MatchDoc_set_values(MatchDoc *self, VArray *values) {
DECREF(self->values);
self->values = (VArray*)INCREF(values);
}
Modified: incubator/lucy/trunk/core/Lucy/Search/MatchDoc.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/MatchDoc.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/MatchDoc.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/MatchDoc.cfh Sun May 1 23:50:24 2011
@@ -49,7 +49,7 @@ class Lucy::Search::MatchDoc inherits Lu
void
Set_Score(MatchDoc *self, float score);
- nullable VArray*
+ nullable VArray*
Get_Values(MatchDoc *self);
void
Modified: incubator/lucy/trunk/core/Lucy/Search/Matcher.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/Matcher.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/Matcher.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/Matcher.c Sun May 1 23:50:24 2011
@@ -24,28 +24,25 @@
#include "Lucy/Search/Collector.h"
Matcher*
-Matcher_init(Matcher *self)
-{
+Matcher_init(Matcher *self) {
ABSTRACT_CLASS_CHECK(self, MATCHER);
return self;
}
int32_t
-Matcher_advance(Matcher *self, int32_t target)
-{
+Matcher_advance(Matcher *self, int32_t target) {
while (1) {
int32_t doc_id = Matcher_Next(self);
if (doc_id == 0 || doc_id >= target) {
- return doc_id;
+ return doc_id;
}
}
}
void
-Matcher_collect(Matcher *self, Collector *collector, Matcher *deletions)
-{
- int32_t doc_id = 0;
- int32_t next_deletion = deletions ? 0 : I32_MAX;
+Matcher_collect(Matcher *self, Collector *collector, Matcher *deletions) {
+ int32_t doc_id = 0;
+ int32_t next_deletion = deletions ? 0 : I32_MAX;
Coll_Set_Matcher(collector, self);
@@ -74,7 +71,7 @@ Matcher_collect(Matcher *self, Collector
}
else {
doc_id = Matcher_Advance(self, doc_id + 1);
- if (doc_id >= next_deletion) {
+ if (doc_id >= next_deletion) {
next_deletion = Matcher_Advance(deletions, doc_id);
if (doc_id == next_deletion) { continue; }
}
@@ -83,8 +80,8 @@ Matcher_collect(Matcher *self, Collector
if (doc_id) {
Coll_Collect(collector, doc_id);
}
- else {
- break;
+ else {
+ break;
}
}
Modified: incubator/lucy/trunk/core/Lucy/Search/Matcher.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/Matcher.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/Matcher.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/Matcher.cfh Sun May 1 23:50:24 2011
@@ -68,7 +68,7 @@ abstract class Lucy::Search::Matcher inh
* @param deletions A deletions iterator.
*/
void
- Collect(Matcher *self, Collector *collector,
+ Collect(Matcher *self, Collector *collector,
Matcher *deletions = NULL);
}
Modified: incubator/lucy/trunk/core/Lucy/Search/NOTMatcher.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/NOTMatcher.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/NOTMatcher.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/NOTMatcher.c Sun May 1 23:50:24 2011
@@ -22,15 +22,13 @@
#include "Lucy/Plan/Schema.h"
NOTMatcher*
-NOTMatcher_new(Matcher *negated_matcher, int32_t doc_max)
-{
+NOTMatcher_new(Matcher *negated_matcher, int32_t doc_max) {
NOTMatcher *self = (NOTMatcher*)VTable_Make_Obj(NOTMATCHER);
return NOTMatcher_init(self, negated_matcher, doc_max);
}
NOTMatcher*
-NOTMatcher_init(NOTMatcher *self, Matcher *negated_matcher, int32_t doc_max)
-{
+NOTMatcher_init(NOTMatcher *self, Matcher *negated_matcher, int32_t doc_max) {
VArray *children = VA_new(1);
VA_Push(children, INCREF(negated_matcher));
PolyMatcher_init((PolyMatcher*)self, children, NULL);
@@ -40,7 +38,7 @@ NOTMatcher_init(NOTMatcher *self, Matche
self->next_negation = 0;
// Assign.
- self->negated_matcher = (Matcher*)INCREF(negated_matcher);
+ self->negated_matcher = (Matcher*)INCREF(negated_matcher);
self->doc_max = doc_max;
DECREF(children);
@@ -49,21 +47,19 @@ NOTMatcher_init(NOTMatcher *self, Matche
}
void
-NOTMatcher_destroy(NOTMatcher *self)
-{
+NOTMatcher_destroy(NOTMatcher *self) {
DECREF(self->negated_matcher);
SUPER_DESTROY(self, NOTMATCHER);
}
int32_t
-NOTMatcher_next(NOTMatcher *self)
-{
+NOTMatcher_next(NOTMatcher *self) {
while (1) {
self->doc_id++;
// Get next negated doc id.
if (self->next_negation < self->doc_id) {
- self->next_negation
+ self->next_negation
= Matcher_Advance(self->negated_matcher, self->doc_id);
if (self->next_negation == 0) {
DECREF(self->negated_matcher);
@@ -84,21 +80,18 @@ NOTMatcher_next(NOTMatcher *self)
}
int32_t
-NOTMatcher_advance(NOTMatcher *self, int32_t target)
-{
+NOTMatcher_advance(NOTMatcher *self, int32_t target) {
self->doc_id = target - 1;
return NOTMatcher_next(self);
}
int32_t
-NOTMatcher_get_doc_id(NOTMatcher *self)
-{
+NOTMatcher_get_doc_id(NOTMatcher *self) {
return self->doc_id;
}
float
-NOTMatcher_score(NOTMatcher *self)
-{
+NOTMatcher_score(NOTMatcher *self) {
UNUSED_VAR(self);
return 0.0f;
}
Modified: incubator/lucy/trunk/core/Lucy/Search/NOTMatcher.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/NOTMatcher.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/NOTMatcher.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/NOTMatcher.cfh Sun May 1 23:50:24 2011
@@ -21,15 +21,15 @@ parcel Lucy;
class Lucy::Search::NOTMatcher inherits Lucy::Search::PolyMatcher {
- Matcher *negated_matcher;
+ Matcher *negated_matcher;
int32_t doc_id;
int32_t doc_max;
int32_t next_negation;
- inert incremented NOTMatcher*
+ inert incremented NOTMatcher*
new(Matcher* negated_matcher, int32_t doc_max);
- inert NOTMatcher*
+ inert NOTMatcher*
init(NOTMatcher *self, Matcher *negated_matcher, int32_t doc_max);
public void
@@ -44,7 +44,7 @@ class Lucy::Search::NOTMatcher inherits
public float
Score(NOTMatcher *self);
- public int32_t
+ public int32_t
Get_Doc_ID(NOTMatcher *self);
}
Modified: incubator/lucy/trunk/core/Lucy/Search/NOTQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/NOTQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/NOTQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/NOTQuery.c Sun May 1 23:50:24 2011
@@ -28,15 +28,13 @@
#include "Lucy/Store/OutStream.h"
NOTQuery*
-NOTQuery_new(Query *negated_query)
-{
+NOTQuery_new(Query *negated_query) {
NOTQuery *self = (NOTQuery*)VTable_Make_Obj(NOTQUERY);
return NOTQuery_init(self, negated_query);
}
NOTQuery*
-NOTQuery_init(NOTQuery *self, Query *negated_query)
-{
+NOTQuery_init(NOTQuery *self, Query *negated_query) {
self = (NOTQuery*)PolyQuery_init((PolyQuery*)self, NULL);
NOTQuery_Set_Boost(self, 0.0f);
PolyQuery_add_child((PolyQuery*)self, negated_query);
@@ -44,20 +42,17 @@ NOTQuery_init(NOTQuery *self, Query *neg
}
Query*
-NOTQuery_get_negated_query(NOTQuery *self)
-{
+NOTQuery_get_negated_query(NOTQuery *self) {
return (Query*)VA_Fetch(self->children, 0);
}
void
-NOTQuery_set_negated_query(NOTQuery *self, Query *negated_query)
-{
+NOTQuery_set_negated_query(NOTQuery *self, Query *negated_query) {
VA_Store(self->children, 0, INCREF(negated_query));
}
CharBuf*
-NOTQuery_to_string(NOTQuery *self)
-{
+NOTQuery_to_string(NOTQuery *self) {
CharBuf *neg_string = Obj_To_String(VA_Fetch(self->children, 0));
CharBuf *retval = CB_newf("-%o", neg_string);
DECREF(neg_string);
@@ -65,49 +60,43 @@ NOTQuery_to_string(NOTQuery *self)
}
bool_t
-NOTQuery_equals(NOTQuery *self, Obj *other)
-{
+NOTQuery_equals(NOTQuery *self, Obj *other) {
if ((NOTQuery*)other == self) { return true; }
if (!Obj_Is_A(other, NOTQUERY)) { return false; }
return PolyQuery_equals((PolyQuery*)self, other);
}
Compiler*
-NOTQuery_make_compiler(NOTQuery *self, Searcher *searcher, float boost)
-{
+NOTQuery_make_compiler(NOTQuery *self, Searcher *searcher, float boost) {
return (Compiler*)NOTCompiler_new(self, searcher, boost);
}
/**********************************************************************/
NOTCompiler*
-NOTCompiler_new(NOTQuery *parent, Searcher *searcher, float boost)
-{
+NOTCompiler_new(NOTQuery *parent, Searcher *searcher, float boost) {
NOTCompiler *self = (NOTCompiler*)VTable_Make_Obj(NOTCOMPILER);
return NOTCompiler_init(self, parent, searcher, boost);
}
NOTCompiler*
-NOTCompiler_init(NOTCompiler *self, NOTQuery *parent, Searcher *searcher,
- float boost)
-{
- PolyCompiler_init((PolyCompiler*)self, (PolyQuery*)parent, searcher,
- boost);
+NOTCompiler_init(NOTCompiler *self, NOTQuery *parent, Searcher *searcher,
+ float boost) {
+ PolyCompiler_init((PolyCompiler*)self, (PolyQuery*)parent, searcher,
+ boost);
NOTCompiler_Normalize(self);
return self;
}
float
-NOTCompiler_sum_of_squared_weights(NOTCompiler *self)
-{
+NOTCompiler_sum_of_squared_weights(NOTCompiler *self) {
UNUSED_VAR(self);
return 0.0f;
}
VArray*
-NOTCompiler_highlight_spans(NOTCompiler *self, Searcher *searcher,
- DocVector *doc_vec, const CharBuf *field)
-{
+NOTCompiler_highlight_spans(NOTCompiler *self, Searcher *searcher,
+ DocVector *doc_vec, const CharBuf *field) {
UNUSED_VAR(self);
UNUSED_VAR(searcher);
UNUSED_VAR(doc_vec);
@@ -116,12 +105,11 @@ NOTCompiler_highlight_spans(NOTCompiler
}
Matcher*
-NOTCompiler_make_matcher(NOTCompiler *self, SegReader *reader,
- bool_t need_score)
-{
- Compiler *negated_compiler = (Compiler*)CERTIFY(
- VA_Fetch(self->children, 0), COMPILER);
- Matcher *negated_matcher
+NOTCompiler_make_matcher(NOTCompiler *self, SegReader *reader,
+ bool_t need_score) {
+ Compiler *negated_compiler
+ = (Compiler*)CERTIFY(VA_Fetch(self->children, 0), COMPILER);
+ Matcher *negated_matcher
= Compiler_Make_Matcher(negated_compiler, reader, false);
UNUSED_VAR(need_score);
Modified: incubator/lucy/trunk/core/Lucy/Search/NOTQuery.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/NOTQuery.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/NOTQuery.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/NOTQuery.cfh Sun May 1 23:50:24 2011
@@ -27,7 +27,7 @@ parcel Lucy;
* semantics.
*/
-class Lucy::Search::NOTQuery inherits Lucy::Search::PolyQuery
+class Lucy::Search::NOTQuery inherits Lucy::Search::PolyQuery
: dumpable {
/**
@@ -60,14 +60,14 @@ class Lucy::Search::NOTQuery inherits Lu
Equals(NOTQuery *self, Obj *other);
}
-class Lucy::Search::NOTCompiler
+class Lucy::Search::NOTCompiler
inherits Lucy::Search::PolyCompiler {
inert incremented NOTCompiler*
new(NOTQuery *parent, Searcher *searcher, float boost);
inert NOTCompiler*
- init(NOTCompiler *self, NOTQuery *parent, Searcher *searcher,
+ init(NOTCompiler *self, NOTQuery *parent, Searcher *searcher,
float boost);
public incremented nullable Matcher*
@@ -77,7 +77,7 @@ class Lucy::Search::NOTCompiler
Sum_Of_Squared_Weights(NOTCompiler *self);
public incremented VArray*
- Highlight_Spans(NOTCompiler *self, Searcher *searcher,
+ Highlight_Spans(NOTCompiler *self, Searcher *searcher,
DocVector *doc_vec, const CharBuf *field);
}
Modified: incubator/lucy/trunk/core/Lucy/Search/NoMatchMatcher.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/NoMatchMatcher.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/NoMatchMatcher.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/NoMatchMatcher.c Sun May 1 23:50:24 2011
@@ -23,28 +23,24 @@
#include "Lucy/Plan/Schema.h"
NoMatchMatcher*
-NoMatchMatcher_new()
-{
+NoMatchMatcher_new() {
NoMatchMatcher *self = (NoMatchMatcher*)VTable_Make_Obj(NOMATCHMATCHER);
return NoMatchMatcher_init(self);
}
NoMatchMatcher*
-NoMatchMatcher_init(NoMatchMatcher *self)
-{
+NoMatchMatcher_init(NoMatchMatcher *self) {
return (NoMatchMatcher*)Matcher_init((Matcher*)self);
-}
+}
int32_t
-NoMatchMatcher_next(NoMatchMatcher* self)
-{
+NoMatchMatcher_next(NoMatchMatcher* self) {
UNUSED_VAR(self);
return 0;
}
int32_t
-NoMatchMatcher_advance(NoMatchMatcher* self, int32_t target)
-{
+NoMatchMatcher_advance(NoMatchMatcher* self, int32_t target) {
UNUSED_VAR(self);
UNUSED_VAR(target);
return 0;
Modified: incubator/lucy/trunk/core/Lucy/Search/NoMatchQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/NoMatchQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/NoMatchQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/NoMatchQuery.c Sun May 1 23:50:24 2011
@@ -28,23 +28,20 @@
#include "Lucy/Util/Freezer.h"
NoMatchQuery*
-NoMatchQuery_new()
-{
+NoMatchQuery_new() {
NoMatchQuery *self = (NoMatchQuery*)VTable_Make_Obj(NOMATCHQUERY);
return NoMatchQuery_init(self);
}
NoMatchQuery*
-NoMatchQuery_init(NoMatchQuery *self)
-{
+NoMatchQuery_init(NoMatchQuery *self) {
Query_init((Query*)self, 0.0f);
self->fails_to_match = true;
return self;
}
bool_t
-NoMatchQuery_equals(NoMatchQuery *self, Obj *other)
-{
+NoMatchQuery_equals(NoMatchQuery *self, Obj *other) {
NoMatchQuery *twin = (NoMatchQuery*)other;
if (!Obj_Is_A(other, NOMATCHQUERY)) return false;
if (self->boost != twin->boost) return false;
@@ -53,42 +50,41 @@ NoMatchQuery_equals(NoMatchQuery *self,
}
CharBuf*
-NoMatchQuery_to_string(NoMatchQuery *self)
-{
+NoMatchQuery_to_string(NoMatchQuery *self) {
UNUSED_VAR(self);
return CB_new_from_trusted_utf8("[NOMATCH]", 9);
}
Compiler*
-NoMatchQuery_make_compiler(NoMatchQuery *self, Searcher *searcher,
- float boost)
-{
+NoMatchQuery_make_compiler(NoMatchQuery *self, Searcher *searcher,
+ float boost) {
return (Compiler*)NoMatchCompiler_new(self, searcher, boost);
}
void
-NoMatchQuery_set_fails_to_match(NoMatchQuery *self, bool_t fails_to_match)
- { self->fails_to_match = fails_to_match; }
+NoMatchQuery_set_fails_to_match(NoMatchQuery *self, bool_t fails_to_match) {
+ self->fails_to_match = fails_to_match;
+}
+
bool_t
-NoMatchQuery_get_fails_to_match(NoMatchQuery *self)
- { return self->fails_to_match; }
+NoMatchQuery_get_fails_to_match(NoMatchQuery *self) {
+ return self->fails_to_match;
+}
Obj*
-NoMatchQuery_dump(NoMatchQuery *self)
-{
+NoMatchQuery_dump(NoMatchQuery *self) {
NoMatchQuery_dump_t super_dump
= (NoMatchQuery_dump_t)SUPER_METHOD(NOMATCHQUERY, NoMatchQuery, Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
- Hash_Store_Str(dump, "fails_to_match", 14, (Obj*)CB_newf("%i64",
- (int64_t)self->fails_to_match));
+ Hash_Store_Str(dump, "fails_to_match", 14,
+ (Obj*)CB_newf("%i64", (int64_t)self->fails_to_match));
return (Obj*)dump;
}
NoMatchQuery*
-NoMatchQuery_load(NoMatchQuery *self, Obj *dump)
-{
+NoMatchQuery_load(NoMatchQuery *self, Obj *dump) {
Hash *source = (Hash*)CERTIFY(dump, HASH);
- NoMatchQuery_load_t super_load
+ NoMatchQuery_load_t super_load
= (NoMatchQuery_load_t)SUPER_METHOD(NOMATCHQUERY, NoMatchQuery, Load);
NoMatchQuery *loaded = super_load(self, dump);
Obj *fails = Cfish_Hash_Fetch_Str(source, "fails_to_match", 14);
@@ -102,14 +98,12 @@ NoMatchQuery_load(NoMatchQuery *self, Ob
}
void
-NoMatchQuery_serialize(NoMatchQuery *self, OutStream *outstream)
-{
+NoMatchQuery_serialize(NoMatchQuery *self, OutStream *outstream) {
OutStream_Write_I8(outstream, !!self->fails_to_match);
}
NoMatchQuery*
-NoMatchQuery_deserialize(NoMatchQuery *self, InStream *instream)
-{
+NoMatchQuery_deserialize(NoMatchQuery *self, InStream *instream) {
self = self ? self : (NoMatchQuery*)VTable_Make_Obj(NOMATCHQUERY);
NoMatchQuery_init(self);
self->fails_to_match = !!InStream_Read_I8(instream);
@@ -119,33 +113,29 @@ NoMatchQuery_deserialize(NoMatchQuery *s
/**********************************************************************/
NoMatchCompiler*
-NoMatchCompiler_new(NoMatchQuery *parent, Searcher *searcher,
- float boost)
-{
- NoMatchCompiler *self
+NoMatchCompiler_new(NoMatchQuery *parent, Searcher *searcher,
+ float boost) {
+ NoMatchCompiler *self
= (NoMatchCompiler*)VTable_Make_Obj(NOMATCHCOMPILER);
return NoMatchCompiler_init(self, parent, searcher, boost);
}
NoMatchCompiler*
-NoMatchCompiler_init(NoMatchCompiler *self, NoMatchQuery *parent,
- Searcher *searcher, float boost)
-{
- return (NoMatchCompiler*)Compiler_init((Compiler*)self,
- (Query*)parent, searcher, NULL, boost);
+NoMatchCompiler_init(NoMatchCompiler *self, NoMatchQuery *parent,
+ Searcher *searcher, float boost) {
+ return (NoMatchCompiler*)Compiler_init((Compiler*)self, (Query*)parent,
+ searcher, NULL, boost);
}
NoMatchCompiler*
-NoMatchCompiler_deserialize(NoMatchCompiler *self, InStream *instream)
-{
+NoMatchCompiler_deserialize(NoMatchCompiler *self, InStream *instream) {
self = self ? self : (NoMatchCompiler*)VTable_Make_Obj(NOMATCHCOMPILER);
return (NoMatchCompiler*)Compiler_deserialize((Compiler*)self, instream);
}
Matcher*
-NoMatchCompiler_make_matcher(NoMatchCompiler *self, SegReader *reader,
- bool_t need_score)
-{
+NoMatchCompiler_make_matcher(NoMatchCompiler *self, SegReader *reader,
+ bool_t need_score) {
UNUSED_VAR(self);
UNUSED_VAR(reader);
UNUSED_VAR(need_score);
Modified: incubator/lucy/trunk/core/Lucy/Search/NoMatchQuery.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/NoMatchQuery.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/NoMatchQuery.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/NoMatchQuery.cfh Sun May 1 23:50:24 2011
@@ -64,7 +64,7 @@ class Lucy::Search::NoMatchQuery inherit
Make_Compiler(NoMatchQuery *self, Searcher *searcher, float boost);
}
-class Lucy::Search::NoMatchCompiler
+class Lucy::Search::NoMatchCompiler
inherits Lucy::Search::Compiler {
inert incremented NoMatchCompiler*
@@ -76,7 +76,7 @@ class Lucy::Search::NoMatchCompiler
public incremented nullable Matcher*
Make_Matcher(NoMatchCompiler *self, SegReader *reader, bool_t need_score);
-
+
public incremented NoMatchCompiler*
Deserialize(NoMatchCompiler *self, InStream *instream);
}
Modified: incubator/lucy/trunk/core/Lucy/Search/ORMatcher.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/ORMatcher.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/ORMatcher.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/ORMatcher.c Sun May 1 23:50:24 2011
@@ -23,11 +23,11 @@
// Add an element to the queue. Unsafe -- bounds checking of queue size is
// left to the caller.
-static void
+static void
S_add_element(ORMatcher *self, Matcher *matcher, int32_t doc_id);
// Empty out the queue.
-static void
+static void
S_clear(ORMatcher *self);
// Call Matcher_Next() on the top queue element and adjust the queue,
@@ -63,15 +63,13 @@ static void
S_sift_down(ORMatcher *self);
ORMatcher*
-ORMatcher_new(VArray *children)
-{
+ORMatcher_new(VArray *children) {
ORMatcher *self = (ORMatcher*)VTable_Make_Obj(ORMATCHER);
return ORMatcher_init(self, children);
}
static ORMatcher*
-S_ormatcher_init2(ORMatcher *self, VArray *children, Similarity *sim)
-{
+S_ormatcher_init2(ORMatcher *self, VArray *children, Similarity *sim) {
size_t amount_to_malloc;
uint32_t i;
@@ -101,19 +99,17 @@ S_ormatcher_init2(ORMatcher *self, VArra
Matcher *matcher = (Matcher*)VA_Fetch(children, i);
S_add_element(self, (Matcher*)INCREF(matcher), 0);
}
-
+
return self;
}
ORMatcher*
-ORMatcher_init(ORMatcher *self, VArray *children)
-{
+ORMatcher_init(ORMatcher *self, VArray *children) {
return S_ormatcher_init2(self, children, NULL);
}
void
-ORMatcher_destroy(ORMatcher *self)
-{
+ORMatcher_destroy(ORMatcher *self) {
if (self->blob) { S_clear(self); }
FREEMEM(self->blob);
FREEMEM(self->pool);
@@ -122,10 +118,9 @@ ORMatcher_destroy(ORMatcher *self)
}
int32_t
-ORMatcher_next(ORMatcher *self)
-{
- if (self->size == 0) {
- return 0;
+ORMatcher_next(ORMatcher *self) {
+ if (self->size == 0) {
+ return 0;
}
else {
int32_t last_doc_id = self->top_hmd->doc;
@@ -140,60 +135,54 @@ ORMatcher_next(ORMatcher *self)
}
int32_t
-ORMatcher_advance(ORMatcher *self, int32_t target)
-{
+ORMatcher_advance(ORMatcher *self, int32_t target) {
if (!self->size) { return 0; }
do {
int32_t least = SI_top_advance(self, target);
if (least >= target) { return least; }
- if (!least) {
- if (!self->size) { return 0; }
+ if (!least) {
+ if (!self->size) { return 0; }
}
} while (true);
}
int32_t
-ORMatcher_get_doc_id(ORMatcher *self)
-{
+ORMatcher_get_doc_id(ORMatcher *self) {
return self->top_hmd->doc;
}
-static void
-S_clear(ORMatcher *self)
-{
+static void
+S_clear(ORMatcher *self) {
HeapedMatcherDoc **const heap = self->heap;
HeapedMatcherDoc **const pool = self->pool;
// Node 0 is held empty, to make the algo clearer.
- for ( ; self->size > 0; self->size--) {
- HeapedMatcherDoc *hmd = heap[ self->size ];
- heap[ self->size ] = NULL;
+ for (; self->size > 0; self->size--) {
+ HeapedMatcherDoc *hmd = heap[self->size];
+ heap[self->size] = NULL;
DECREF(hmd->matcher);
// Put HMD back in pool.
- pool[ self->size ] = hmd;
- }
+ pool[self->size] = hmd;
+ }
}
static INLINE int32_t
-SI_top_next(ORMatcher *self)
-{
+SI_top_next(ORMatcher *self) {
HeapedMatcherDoc *const top_hmd = self->top_hmd;
top_hmd->doc = Matcher_Next(top_hmd->matcher);
return S_adjust_root(self);
}
static INLINE int32_t
-SI_top_advance(ORMatcher *self, int32_t target)
-{
+SI_top_advance(ORMatcher *self, int32_t target) {
HeapedMatcherDoc *const top_hmd = self->top_hmd;
top_hmd->doc = Matcher_Advance(top_hmd->matcher, target);
return S_adjust_root(self);
}
-static void
-S_add_element(ORMatcher *self, Matcher *matcher, int32_t doc_id)
-{
+static void
+S_add_element(ORMatcher *self, Matcher *matcher, int32_t doc_id) {
HeapedMatcherDoc **const heap = self->heap;
HeapedMatcherDoc **const pool = self->pool;
HeapedMatcherDoc *hmd;
@@ -202,32 +191,31 @@ S_add_element(ORMatcher *self, Matcher *
self->size++;
// Put element at the bottom of the heap.
- hmd = pool[ self->size ];
+ hmd = pool[self->size];
hmd->matcher = matcher;
hmd->doc = doc_id;
- heap[ self->size ] = hmd;
+ heap[self->size] = hmd;
// Adjust heap.
S_bubble_up(self);
}
static int32_t
-S_adjust_root(ORMatcher *self)
-{
+S_adjust_root(ORMatcher *self) {
HeapedMatcherDoc *const top_hmd = self->top_hmd;
// Inlined pop.
if (!top_hmd->doc) {
- HeapedMatcherDoc *const last_hmd = self->heap[ self->size ];
+ HeapedMatcherDoc *const last_hmd = self->heap[self->size];
// Last to first.
DECREF(top_hmd->matcher);
top_hmd->matcher = last_hmd->matcher;
top_hmd->doc = last_hmd->doc;
- self->heap[ self->size ] = NULL;
+ self->heap[self->size] = NULL;
// Put back in pool.
- self->pool[ self->size ] = last_hmd;
+ self->pool[self->size] = last_hmd;
self->size--;
if (self->size == 0) {
@@ -242,8 +230,7 @@ S_adjust_root(ORMatcher *self)
}
static void
-S_bubble_up(ORMatcher *self)
-{
+S_bubble_up(ORMatcher *self) {
HeapedMatcherDoc **const heap = self->heap;
uint32_t i = self->size;
uint32_t j = i >> 1;
@@ -259,8 +246,7 @@ S_bubble_up(ORMatcher *self)
}
static void
-S_sift_down(ORMatcher *self)
-{
+S_sift_down(ORMatcher *self) {
HeapedMatcherDoc **const heap = self->heap;
uint32_t i = 1;
uint32_t j = i << 1;
@@ -282,7 +268,7 @@ S_sift_down(ORMatcher *self)
}
}
heap[i] = node;
-
+
self->top_hmd = heap[1];
}
@@ -298,18 +284,16 @@ static int32_t
S_advance_after_current(ORScorer *self);
ORScorer*
-ORScorer_new(VArray *children, Similarity *sim)
-{
+ORScorer_new(VArray *children, Similarity *sim) {
ORScorer *self = (ORScorer*)VTable_Make_Obj(ORSCORER);
return ORScorer_init(self, children, sim);
}
ORScorer*
-ORScorer_init(ORScorer *self, VArray *children, Similarity *sim)
-{
+ORScorer_init(ORScorer *self, VArray *children, Similarity *sim) {
S_ormatcher_init2((ORMatcher*)self, children, sim);
- self->doc_id = 0;
- self->scores = (float*)MALLOCATE(self->num_kids * sizeof(float));
+ self->doc_id = 0;
+ self->scores = (float*)MALLOCATE(self->num_kids * sizeof(float));
// Establish the state of all child matchers being past the current doc
// id, by invoking ORMatcher's Next() method.
@@ -319,21 +303,18 @@ ORScorer_init(ORScorer *self, VArray *ch
}
void
-ORScorer_destroy(ORScorer *self)
-{
+ORScorer_destroy(ORScorer *self) {
FREEMEM(self->scores);
SUPER_DESTROY(self, ORSCORER);
}
int32_t
-ORScorer_next(ORScorer *self)
-{
+ORScorer_next(ORScorer *self) {
return S_advance_after_current(self);
}
static int32_t
-S_advance_after_current(ORScorer *self)
-{
+S_advance_after_current(ORScorer *self) {
float *const scores = self->scores;
Matcher *child;
@@ -362,7 +343,7 @@ S_advance_after_current(ORScorer *self)
else {
// Accumulate score.
child = self->top_hmd->matcher;
- scores[ self->matching_kids ] = Matcher_Score(child);
+ scores[self->matching_kids] = Matcher_Score(child);
self->matching_kids++;
}
} while (true);
@@ -371,8 +352,7 @@ S_advance_after_current(ORScorer *self)
}
int32_t
-ORScorer_advance(ORScorer *self, int32_t target)
-{
+ORScorer_advance(ORScorer *self, int32_t target) {
// Return sentinel once exhausted.
if (!self->size) { return 0; }
@@ -388,30 +368,28 @@ ORScorer_advance(ORScorer *self, int32_t
}
// Not caught up yet, so keep skipping matchers.
- if ( !SI_top_advance((ORMatcher*)self, target) ) {
+ if (!SI_top_advance((ORMatcher*)self, target)) {
if (!self->size) { return 0; }
}
} while (true);
}
int32_t
-ORScorer_get_doc_id(ORScorer *self)
-{
+ORScorer_get_doc_id(ORScorer *self) {
return self->doc_id;
}
float
-ORScorer_score(ORScorer *self)
-{
+ORScorer_score(ORScorer *self) {
float *const scores = self->scores;
- float score = 0.0f;
+ float score = 0.0f;
uint32_t i;
// Accumulate score, then factor in coord bonus.
for (i = 0; i < self->matching_kids; i++) {
score += scores[i];
}
- score *= self->coord_factors[ self->matching_kids ];
+ score *= self->coord_factors[self->matching_kids];
return score;
}
Modified: incubator/lucy/trunk/core/Lucy/Search/ORMatcher.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/ORMatcher.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/ORMatcher.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/ORMatcher.cfh Sun May 1 23:50:24 2011
@@ -63,7 +63,7 @@ class Lucy::Search::ORMatcher inherits L
public int32_t
Advance(ORMatcher *self, int32_t target);
- public int32_t
+ public int32_t
Get_Doc_ID(ORMatcher *self);
}
@@ -78,10 +78,10 @@ class Lucy::Search::ORScorer inherits Lu
float *scores;
int32_t doc_id;
- inert incremented ORScorer*
+ inert incremented ORScorer*
new(VArray *children, Similarity *similarity);
- inert ORScorer*
+ inert ORScorer*
init(ORScorer *self, VArray *children, Similarity *similarity);
public void
@@ -96,7 +96,7 @@ class Lucy::Search::ORScorer inherits Lu
public float
Score(ORScorer *self);
- public int32_t
+ public int32_t
Get_Doc_ID(ORScorer *self);
}
Modified: incubator/lucy/trunk/core/Lucy/Search/ORQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/ORQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/ORQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/ORQuery.c Sun May 1 23:50:24 2011
@@ -27,35 +27,30 @@
#include "Lucy/Store/OutStream.h"
ORQuery*
-ORQuery_new(VArray *children)
-{
+ORQuery_new(VArray *children) {
ORQuery *self = (ORQuery*)VTable_Make_Obj(ORQUERY);
return ORQuery_init(self, children);
}
ORQuery*
-ORQuery_init(ORQuery *self, VArray *children)
-{
+ORQuery_init(ORQuery *self, VArray *children) {
return (ORQuery*)PolyQuery_init((PolyQuery*)self, children);
}
Compiler*
-ORQuery_make_compiler(ORQuery *self, Searcher *searcher, float boost)
-{
+ORQuery_make_compiler(ORQuery *self, Searcher *searcher, float boost) {
return (Compiler*)ORCompiler_new(self, searcher, boost);
}
bool_t
-ORQuery_equals(ORQuery *self, Obj *other)
-{
+ORQuery_equals(ORQuery *self, Obj *other) {
if ((ORQuery*)other == self) { return true; }
if (!Obj_Is_A(other, ORQUERY)) { return false; }
return PolyQuery_equals((PolyQuery*)self, other);
}
CharBuf*
-ORQuery_to_string(ORQuery *self)
-{
+ORQuery_to_string(ORQuery *self) {
uint32_t num_kids = VA_Get_Size(self->children);
if (!num_kids) return CB_new_from_trusted_utf8("()", 2);
else {
@@ -80,26 +75,23 @@ ORQuery_to_string(ORQuery *self)
/**********************************************************************/
ORCompiler*
-ORCompiler_new(ORQuery *parent, Searcher *searcher, float boost)
-{
+ORCompiler_new(ORQuery *parent, Searcher *searcher, float boost) {
ORCompiler *self = (ORCompiler*)VTable_Make_Obj(ORCOMPILER);
return ORCompiler_init(self, parent, searcher, boost);
}
ORCompiler*
-ORCompiler_init(ORCompiler *self, ORQuery *parent, Searcher *searcher,
- float boost)
-{
- PolyCompiler_init((PolyCompiler*)self, (PolyQuery*)parent, searcher,
- boost);
+ORCompiler_init(ORCompiler *self, ORQuery *parent, Searcher *searcher,
+ float boost) {
+ PolyCompiler_init((PolyCompiler*)self, (PolyQuery*)parent, searcher,
+ boost);
ORCompiler_Normalize(self);
return self;
}
Matcher*
-ORCompiler_make_matcher(ORCompiler *self, SegReader *reader,
- bool_t need_score)
-{
+ORCompiler_make_matcher(ORCompiler *self, SegReader *reader,
+ bool_t need_score) {
uint32_t num_kids = VA_Get_Size(self->children);
if (num_kids == 1) {
@@ -114,7 +106,7 @@ ORCompiler_make_matcher(ORCompiler *self
// Accumulate sub-matchers.
for (i = 0; i < num_kids; i++) {
Compiler *child = (Compiler*)VA_Fetch(self->children, i);
- Matcher *submatcher
+ Matcher *submatcher
= Compiler_Make_Matcher(child, reader, need_score);
if (submatcher != NULL) {
VA_Push(submatchers, (Obj*)submatcher);
@@ -136,8 +128,8 @@ ORCompiler_make_matcher(ORCompiler *self
else {
Similarity *sim = ORCompiler_Get_Similarity(self);
Matcher *retval = need_score
- ? (Matcher*)ORScorer_new(submatchers, sim)
- : (Matcher*)ORMatcher_new(submatchers);
+ ? (Matcher*)ORScorer_new(submatchers, sim)
+ : (Matcher*)ORMatcher_new(submatchers);
DECREF(submatchers);
return retval;
}
Modified: incubator/lucy/trunk/core/Lucy/Search/ORQuery.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/ORQuery.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/ORQuery.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/ORQuery.cfh Sun May 1 23:50:24 2011
@@ -24,7 +24,7 @@ parcel Lucy;
* child Queries.
*/
-class Lucy::Search::ORQuery inherits Lucy::Search::PolyQuery
+class Lucy::Search::ORQuery inherits Lucy::Search::PolyQuery
: dumpable {
inert incremented ORQuery*
@@ -46,14 +46,14 @@ class Lucy::Search::ORQuery inherits Luc
Equals(ORQuery *self, Obj *other);
}
-class Lucy::Search::ORCompiler
+class Lucy::Search::ORCompiler
inherits Lucy::Search::PolyCompiler {
inert incremented ORCompiler*
new(ORQuery *parent, Searcher *searcher, float boost);
inert ORCompiler*
- init(ORCompiler *self, ORQuery *parent, Searcher *searcher,
+ init(ORCompiler *self, ORQuery *parent, Searcher *searcher,
float boost);
public incremented nullable Matcher*
Modified: incubator/lucy/trunk/core/Lucy/Search/PhraseMatcher.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/PhraseMatcher.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/PhraseMatcher.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/PhraseMatcher.c Sun May 1 23:50:24 2011
@@ -26,8 +26,7 @@
#include "Lucy/Search/Compiler.h"
PhraseMatcher*
-PhraseMatcher_new(Similarity *sim, VArray *plists, Compiler *compiler)
-{
+PhraseMatcher_new(Similarity *sim, VArray *plists, Compiler *compiler) {
PhraseMatcher *self = (PhraseMatcher*)VTable_Make_Obj(PHRASEMATCHER);
return PhraseMatcher_init(self, sim, plists, compiler);
@@ -35,8 +34,7 @@ PhraseMatcher_new(Similarity *sim, VArra
PhraseMatcher*
PhraseMatcher_init(PhraseMatcher *self, Similarity *similarity, VArray *plists,
- Compiler *compiler)
-{
+ Compiler *compiler) {
Matcher_init((Matcher*)self);
// Init.
@@ -49,10 +47,10 @@ PhraseMatcher_init(PhraseMatcher *self,
// Extract PostingLists out of VArray into local C array for quick access.
self->num_elements = VA_Get_Size(plists);
self->plists = (PostingList**)MALLOCATE(
- self->num_elements * sizeof(PostingList*));
+ self->num_elements * sizeof(PostingList*));
for (size_t i = 0; i < self->num_elements; i++) {
- PostingList *const plist = (PostingList*)CERTIFY(
- VA_Fetch(plists, i), POSTINGLIST);
+ PostingList *const plist
+ = (PostingList*)CERTIFY(VA_Fetch(plists, i), POSTINGLIST);
if (plist == NULL) {
THROW(ERR, "Missing element %u32", i);
}
@@ -68,8 +66,7 @@ PhraseMatcher_init(PhraseMatcher *self,
}
void
-PhraseMatcher_destroy(PhraseMatcher *self)
-{
+PhraseMatcher_destroy(PhraseMatcher *self) {
if (self->plists) {
for (size_t i = 0; i < self->num_elements; i++) {
DECREF(self->plists[i]);
@@ -83,8 +80,7 @@ PhraseMatcher_destroy(PhraseMatcher *sel
}
int32_t
-PhraseMatcher_next(PhraseMatcher *self)
-{
+PhraseMatcher_next(PhraseMatcher *self) {
if (self->first_time) {
return PhraseMatcher_Advance(self, 1);
}
@@ -98,8 +94,7 @@ PhraseMatcher_next(PhraseMatcher *self)
}
int32_t
-PhraseMatcher_advance(PhraseMatcher *self, int32_t target)
-{
+PhraseMatcher_advance(PhraseMatcher *self, int32_t target) {
PostingList **const plists = self->plists;
const uint32_t num_elements = self->num_elements;
int32_t highest = 0;
@@ -193,11 +188,10 @@ PhraseMatcher_advance(PhraseMatcher *sel
}
}
-static INLINE uint32_t
+static INLINE uint32_t
SI_winnow_anchors(uint32_t *anchors_start, const uint32_t *const anchors_end,
const uint32_t *candidates, const uint32_t *const candidates_end,
- uint32_t offset)
-{
+ uint32_t offset) {
uint32_t *anchors = anchors_start;
uint32_t *anchors_found = anchors_start;
uint32_t target_anchor;
@@ -219,36 +213,35 @@ SI_winnow_anchors(uint32_t *anchors_star
* But given the vagaries of modern processors, it merits actual
* testing.*/
- SPIN_CANDIDATES:
+SPIN_CANDIDATES:
target_candidate = *anchors + offset;
while (*candidates < target_candidate) {
if (++candidates == candidates_end) goto DONE;
- }
+ }
if (*candidates == target_candidate) goto MATCH;
- goto SPIN_ANCHORS;
+ goto SPIN_ANCHORS;
- SPIN_ANCHORS:
+SPIN_ANCHORS:
target_anchor = *candidates - offset;
- while (*anchors < target_anchor) {
+ while (*anchors < target_anchor) {
if (++anchors == anchors_end) goto DONE;
};
if (*anchors == target_anchor) goto MATCH;
- goto SPIN_CANDIDATES;
+ goto SPIN_CANDIDATES;
- MATCH:
+MATCH:
*anchors_found++ = *anchors;
if (++anchors == anchors_end) goto DONE;
- goto SPIN_CANDIDATES;
+ goto SPIN_CANDIDATES;
- DONE:
+DONE:
// Return number of anchors remaining.
- return anchors_found - anchors_start;
+ return anchors_found - anchors_start;
}
float
-PhraseMatcher_calc_phrase_freq(PhraseMatcher *self)
-{
- PostingList **const plists = self->plists;
+PhraseMatcher_calc_phrase_freq(PhraseMatcher *self) {
+ PostingList **const plists = self->plists;
/* Create a overwriteable "anchor set" from the first posting.
*
@@ -288,8 +281,9 @@ PhraseMatcher_calc_phrase_freq(PhraseMat
// Splice out anchors that don't match the next term. Bail out if
// we've eliminated all possible anchors.
- anchors_remaining = SI_winnow_anchors(anchors_start, anchors_end,
- candidates_start, candidates_end, i);
+ anchors_remaining
+ = SI_winnow_anchors(anchors_start, anchors_end,
+ candidates_start, candidates_end, i);
if (!anchors_remaining) { return 0.0f; }
// Adjust end for number of anchors that remain.
@@ -301,18 +295,16 @@ PhraseMatcher_calc_phrase_freq(PhraseMat
}
int32_t
-PhraseMatcher_get_doc_id(PhraseMatcher *self)
-{
+PhraseMatcher_get_doc_id(PhraseMatcher *self) {
return self->doc_id;
}
float
-PhraseMatcher_score(PhraseMatcher *self)
-{
+PhraseMatcher_score(PhraseMatcher *self) {
ScorePosting *posting = (ScorePosting*)PList_Get_Posting(self->plists[0]);
- float score = Sim_TF(self->sim, self->phrase_freq)
- * self->weight
- * posting->weight;
+ float score = Sim_TF(self->sim, self->phrase_freq)
+ * self->weight
+ * posting->weight;
return score;
}
Modified: incubator/lucy/trunk/core/Lucy/Search/PhraseMatcher.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/PhraseMatcher.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/PhraseMatcher.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/PhraseMatcher.cfh Sun May 1 23:50:24 2011
@@ -37,7 +37,7 @@ class Lucy::Search::PhraseMatcher inheri
new(Similarity *similarity, VArray *posting_lists, Compiler *compiler);
inert PhraseMatcher*
- init(PhraseMatcher *self, Similarity *similarity, VArray *posting_lists,
+ init(PhraseMatcher *self, Similarity *similarity, VArray *posting_lists,
Compiler *compiler);
public void
@@ -49,7 +49,7 @@ class Lucy::Search::PhraseMatcher inheri
public int32_t
Advance(PhraseMatcher *self, int32_t target);
- public int32_t
+ public int32_t
Get_Doc_ID(PhraseMatcher *self);
public float
Modified: incubator/lucy/trunk/core/Lucy/Search/PhraseQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/PhraseQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/PhraseQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/PhraseQuery.c Sun May 1 23:50:24 2011
@@ -45,29 +45,25 @@ static PhraseQuery*
S_do_init(PhraseQuery *self, CharBuf *field, VArray *terms, float boost);
PhraseQuery*
-PhraseQuery_new(const CharBuf *field, VArray *terms)
-{
+PhraseQuery_new(const CharBuf *field, VArray *terms) {
PhraseQuery *self = (PhraseQuery*)VTable_Make_Obj(PHRASEQUERY);
return PhraseQuery_init(self, field, terms);
}
PhraseQuery*
-PhraseQuery_init(PhraseQuery *self, const CharBuf *field, VArray *terms)
-{
+PhraseQuery_init(PhraseQuery *self, const CharBuf *field, VArray *terms) {
return S_do_init(self, CB_Clone(field), VA_Clone(terms), 1.0f);
}
void
-PhraseQuery_destroy(PhraseQuery *self)
-{
+PhraseQuery_destroy(PhraseQuery *self) {
DECREF(self->terms);
DECREF(self->field);
SUPER_DESTROY(self, PHRASEQUERY);
}
static PhraseQuery*
-S_do_init(PhraseQuery *self, CharBuf *field, VArray *terms, float boost)
-{
+S_do_init(PhraseQuery *self, CharBuf *field, VArray *terms, float boost) {
uint32_t i, max;
Query_init((Query*)self, boost);
for (i = 0, max = VA_Get_Size(terms); i < max; i++) {
@@ -79,26 +75,23 @@ S_do_init(PhraseQuery *self, CharBuf *fi
}
void
-PhraseQuery_serialize(PhraseQuery *self, OutStream *outstream)
-{
+PhraseQuery_serialize(PhraseQuery *self, OutStream *outstream) {
OutStream_Write_F32(outstream, self->boost);
CB_Serialize(self->field, outstream);
VA_Serialize(self->terms, outstream);
}
PhraseQuery*
-PhraseQuery_deserialize(PhraseQuery *self, InStream *instream)
-{
- float boost = InStream_Read_F32(instream);
- CharBuf *field = CB_deserialize(NULL, instream);
- VArray *terms = VA_deserialize(NULL, instream);
+PhraseQuery_deserialize(PhraseQuery *self, InStream *instream) {
+ float boost = InStream_Read_F32(instream);
+ CharBuf *field = CB_deserialize(NULL, instream);
+ VArray *terms = VA_deserialize(NULL, instream);
self = self ? self : (PhraseQuery*)VTable_Make_Obj(PHRASEQUERY);
return S_do_init(self, field, terms, boost);
}
bool_t
-PhraseQuery_equals(PhraseQuery *self, Obj *other)
-{
+PhraseQuery_equals(PhraseQuery *self, Obj *other) {
PhraseQuery *twin = (PhraseQuery*)other;
if (twin == self) return true;
if (!Obj_Is_A(other, PHRASEQUERY)) return false;
@@ -113,14 +106,13 @@ PhraseQuery_equals(PhraseQuery *self, Ob
}
CharBuf*
-PhraseQuery_to_string(PhraseQuery *self)
-{
+PhraseQuery_to_string(PhraseQuery *self) {
uint32_t i;
- uint32_t num_terms = VA_Get_Size(self->terms);
- CharBuf *retval = CB_Clone(self->field);
+ uint32_t num_terms = VA_Get_Size(self->terms);
+ CharBuf *retval = CB_Clone(self->field);
CB_Cat_Trusted_Str(retval, ":\"", 2);
for (i = 0; i < num_terms; i++) {
- Obj *term = VA_Fetch(self->terms, i);
+ Obj *term = VA_Fetch(self->terms, i);
CharBuf *term_string = Obj_To_String(term);
CB_Cat(retval, term_string);
DECREF(term_string);
@@ -133,17 +125,17 @@ PhraseQuery_to_string(PhraseQuery *self)
}
Compiler*
-PhraseQuery_make_compiler(PhraseQuery *self, Searcher *searcher,
- float boost)
-{
+PhraseQuery_make_compiler(PhraseQuery *self, Searcher *searcher,
+ float boost) {
if (VA_Get_Size(self->terms) == 1) {
// Optimize for one-term "phrases".
Obj *term = VA_Fetch(self->terms, 0);
TermQuery *term_query = TermQuery_new(self->field, term);
TermCompiler *term_compiler;
TermQuery_Set_Boost(term_query, self->boost);
- term_compiler = (TermCompiler*)TermQuery_Make_Compiler(term_query,
- searcher, boost);
+ term_compiler
+ = (TermCompiler*)TermQuery_Make_Compiler(term_query, searcher,
+ boost);
DECREF(term_query);
return (Compiler*)term_compiler;
}
@@ -153,23 +145,26 @@ PhraseQuery_make_compiler(PhraseQuery *s
}
CharBuf*
-PhraseQuery_get_field(PhraseQuery *self) { return self->field; }
+PhraseQuery_get_field(PhraseQuery *self) {
+ return self->field;
+}
+
VArray*
-PhraseQuery_get_terms(PhraseQuery *self) { return self->terms; }
+PhraseQuery_get_terms(PhraseQuery *self) {
+ return self->terms;
+}
/*********************************************************************/
PhraseCompiler*
-PhraseCompiler_new(PhraseQuery *parent, Searcher *searcher, float boost)
-{
+PhraseCompiler_new(PhraseQuery *parent, Searcher *searcher, float boost) {
PhraseCompiler *self = (PhraseCompiler*)VTable_Make_Obj(PHRASECOMPILER);
return PhraseCompiler_init(self, parent, searcher, boost);
}
PhraseCompiler*
-PhraseCompiler_init(PhraseCompiler *self, PhraseQuery *parent,
- Searcher *searcher, float boost)
-{
+PhraseCompiler_init(PhraseCompiler *self, PhraseQuery *parent,
+ Searcher *searcher, float boost) {
Schema *schema = Searcher_Get_Schema(searcher);
Similarity *sim = Schema_Fetch_Sim(schema, parent->field);
VArray *terms = parent->terms;
@@ -184,9 +179,9 @@ PhraseCompiler_init(PhraseCompiler *self
// Store IDF for the phrase.
self->idf = 0;
for (i = 0, max = VA_Get_Size(terms); i < max; i++) {
- Obj *term = VA_Fetch(terms, i);
- int32_t doc_max = Searcher_Doc_Max(searcher);
- int32_t doc_freq = Searcher_Doc_Freq(searcher, parent->field, term);
+ Obj *term = VA_Fetch(terms, i);
+ int32_t doc_max = Searcher_Doc_Max(searcher);
+ int32_t doc_freq = Searcher_Doc_Freq(searcher, parent->field, term);
self->idf += Sim_IDF(sim, doc_freq, doc_max);
}
@@ -200,8 +195,7 @@ PhraseCompiler_init(PhraseCompiler *self
}
void
-PhraseCompiler_serialize(PhraseCompiler *self, OutStream *outstream)
-{
+PhraseCompiler_serialize(PhraseCompiler *self, OutStream *outstream) {
Compiler_serialize((Compiler*)self, outstream);
OutStream_Write_F32(outstream, self->idf);
OutStream_Write_F32(outstream, self->raw_weight);
@@ -210,8 +204,7 @@ PhraseCompiler_serialize(PhraseCompiler
}
PhraseCompiler*
-PhraseCompiler_deserialize(PhraseCompiler *self, InStream *instream)
-{
+PhraseCompiler_deserialize(PhraseCompiler *self, InStream *instream) {
self = self ? self : (PhraseCompiler*)VTable_Make_Obj(PHRASECOMPILER);
Compiler_deserialize((Compiler*)self, instream);
self->idf = InStream_Read_F32(instream);
@@ -222,8 +215,7 @@ PhraseCompiler_deserialize(PhraseCompile
}
bool_t
-PhraseCompiler_equals(PhraseCompiler *self, Obj *other)
-{
+PhraseCompiler_equals(PhraseCompiler *self, Obj *other) {
PhraseCompiler *twin = (PhraseCompiler*)other;
if (!Obj_Is_A(other, PHRASECOMPILER)) return false;
if (!Compiler_equals((Compiler*)self, other)) return false;
@@ -235,28 +227,24 @@ PhraseCompiler_equals(PhraseCompiler *se
}
float
-PhraseCompiler_get_weight(PhraseCompiler *self)
-{
+PhraseCompiler_get_weight(PhraseCompiler *self) {
return self->normalized_weight;
}
float
-PhraseCompiler_sum_of_squared_weights(PhraseCompiler *self)
-{
+PhraseCompiler_sum_of_squared_weights(PhraseCompiler *self) {
return self->raw_weight * self->raw_weight;
}
void
-PhraseCompiler_apply_norm_factor(PhraseCompiler *self, float factor)
-{
+PhraseCompiler_apply_norm_factor(PhraseCompiler *self, float factor) {
self->query_norm_factor = factor;
self->normalized_weight = self->raw_weight * self->idf * factor;
}
Matcher*
PhraseCompiler_make_matcher(PhraseCompiler *self, SegReader *reader,
- bool_t need_score)
-{
+ bool_t need_score) {
UNUSED_VAR(need_score);
PhraseQuery *const parent = (PhraseQuery*)self->parent;
VArray *const terms = parent->terms;
@@ -275,15 +263,16 @@ PhraseCompiler_make_matcher(PhraseCompil
DECREF(posting);
// Bail if there's no PostingListReader for this segment.
- PostingListReader *const plist_reader = (PostingListReader*)SegReader_Fetch(
- reader, VTable_Get_Name(POSTINGLISTREADER));
+ PostingListReader *const plist_reader
+ = (PostingListReader*)SegReader_Fetch(
+ reader, VTable_Get_Name(POSTINGLISTREADER));
if (!plist_reader) { return NULL; }
// Look up each term.
VArray *plists = VA_new(num_terms);
for (uint32_t i = 0; i < num_terms; i++) {
Obj *term = VA_Fetch(terms, i);
- PostingList *plist
+ PostingList *plist
= PListReader_Posting_List(plist_reader, parent->field, term);
// Bail if any one of the terms isn't in the index.
@@ -295,24 +284,23 @@ PhraseCompiler_make_matcher(PhraseCompil
VA_Push(plists, (Obj*)plist);
}
- Matcher *retval
+ Matcher *retval
= (Matcher*)PhraseMatcher_new(sim, plists, (Compiler*)self);
DECREF(plists);
return retval;
}
VArray*
-PhraseCompiler_highlight_spans(PhraseCompiler *self, Searcher *searcher,
- DocVector *doc_vec, const CharBuf *field)
-{
- PhraseQuery *const parent = (PhraseQuery*)self->parent;
- VArray *const terms = parent->terms;
- VArray *const spans = VA_new(0);
+PhraseCompiler_highlight_spans(PhraseCompiler *self, Searcher *searcher,
+ DocVector *doc_vec, const CharBuf *field) {
+ PhraseQuery *const parent = (PhraseQuery*)self->parent;
+ VArray *const terms = parent->terms;
+ VArray *const spans = VA_new(0);
VArray *term_vectors;
BitVector *posit_vec;
BitVector *other_posit_vec;
uint32_t i;
- const uint32_t num_terms = VA_Get_Size(terms);
+ const uint32_t num_terms = VA_Get_Size(terms);
uint32_t num_tvs;
UNUSED_VAR(searcher);
@@ -325,7 +313,7 @@ PhraseCompiler_highlight_spans(PhraseCom
other_posit_vec = BitVec_new(0);
for (i = 0; i < num_terms; i++) {
Obj *term = VA_Fetch(terms, i);
- TermVector *term_vector
+ TermVector *term_vector
= DocVec_Term_Vector(doc_vec, field, (CharBuf*)term);
// Bail if any term is missing.
@@ -363,7 +351,7 @@ PhraseCompiler_highlight_spans(PhraseCom
num_tvs = VA_Get_Size(term_vectors);
if (num_tvs == num_terms) {
TermVector *first_tv = (TermVector*)VA_Fetch(term_vectors, 0);
- TermVector *last_tv
+ TermVector *last_tv
= (TermVector*)VA_Fetch(term_vectors, num_tvs - 1);
I32Array *tv_start_positions = TV_Get_Positions(first_tv);
I32Array *tv_end_positions = TV_Get_Positions(last_tv);
@@ -397,8 +385,8 @@ PhraseCompiler_highlight_spans(PhraseCom
}
}
- VA_Push(spans, (Obj*)Span_new(start_offset,
- end_offset - start_offset, weight) );
+ VA_Push(spans, (Obj*)Span_new(start_offset,
+ end_offset - start_offset, weight));
i++, j++;
}
Modified: incubator/lucy/trunk/core/Lucy/Search/PhraseQuery.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/PhraseQuery.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/PhraseQuery.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/PhraseQuery.cfh Sun May 1 23:50:24 2011
@@ -67,7 +67,7 @@ class Lucy::Search::PhraseQuery inherits
Destroy(PhraseQuery *self);
}
-class Lucy::Search::PhraseCompiler
+class Lucy::Search::PhraseCompiler
inherits Lucy::Search::Compiler {
float idf;
@@ -79,7 +79,7 @@ class Lucy::Search::PhraseCompiler
new(PhraseQuery *parent, Searcher *searcher, float boost);
inert PhraseCompiler*
- init(PhraseCompiler *self, PhraseQuery *parent, Searcher *searcher,
+ init(PhraseCompiler *self, PhraseQuery *parent, Searcher *searcher,
float boost);
public incremented nullable Matcher*
@@ -95,7 +95,7 @@ class Lucy::Search::PhraseCompiler
Apply_Norm_Factor(PhraseCompiler *self, float factor);
public incremented VArray*
- Highlight_Spans(PhraseCompiler *self, Searcher *searcher,
+ Highlight_Spans(PhraseCompiler *self, Searcher *searcher,
DocVector *doc_vec, const CharBuf *field);
public bool_t
Modified: incubator/lucy/trunk/core/Lucy/Search/PolyMatcher.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/PolyMatcher.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/PolyMatcher.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/PolyMatcher.c Sun May 1 23:50:24 2011
@@ -21,15 +21,13 @@
#include "Lucy/Index/Similarity.h"
PolyMatcher*
-PolyMatcher_new(VArray *children, Similarity *sim)
-{
+PolyMatcher_new(VArray *children, Similarity *sim) {
PolyMatcher *self = (PolyMatcher*)VTable_Make_Obj(POLYMATCHER);
return PolyMatcher_init(self, children, sim);
}
PolyMatcher*
-PolyMatcher_init(PolyMatcher *self, VArray *children, Similarity *similarity)
-{
+PolyMatcher_init(PolyMatcher *self, VArray *children, Similarity *similarity) {
uint32_t i;
Matcher_init((Matcher*)self);
@@ -39,15 +37,14 @@ PolyMatcher_init(PolyMatcher *self, VArr
self->coord_factors = (float*)MALLOCATE((self->num_kids + 1) * sizeof(float));
for (i = 0; i <= self->num_kids; i++) {
self->coord_factors[i] = similarity
- ? Sim_Coord(similarity, i, self->num_kids)
- : 1.0f;
+ ? Sim_Coord(similarity, i, self->num_kids)
+ : 1.0f;
}
return self;
}
void
-PolyMatcher_destroy(PolyMatcher *self)
-{
+PolyMatcher_destroy(PolyMatcher *self) {
DECREF(self->children);
DECREF(self->sim);
FREEMEM(self->coord_factors);
Modified: incubator/lucy/trunk/core/Lucy/Search/PolyMatcher.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/PolyMatcher.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/PolyMatcher.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/PolyMatcher.cfh Sun May 1 23:50:24 2011
@@ -27,10 +27,10 @@ class Lucy::Search::PolyMatcher inherits
uint32_t matching_kids;
float *coord_factors;
- inert incremented PolyMatcher*
+ inert incremented PolyMatcher*
new(VArray *children, Similarity *similarity);
- inert PolyMatcher*
+ inert PolyMatcher*
init(PolyMatcher *self, VArray *children, Similarity *similarity);
public void
Modified: incubator/lucy/trunk/core/Lucy/Search/PolyQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/PolyQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/PolyQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/PolyQuery.c Sun May 1 23:50:24 2011
@@ -29,8 +29,7 @@
#include "Lucy/Util/Freezer.h"
PolyQuery*
-PolyQuery_init(PolyQuery *self, VArray *children)
-{
+PolyQuery_init(PolyQuery *self, VArray *children) {
uint32_t i;
const uint32_t num_kids = children ? VA_Get_Size(children) : 0;
Query_init((Query*)self, 1.0f);
@@ -42,33 +41,31 @@ PolyQuery_init(PolyQuery *self, VArray *
}
void
-PolyQuery_destroy(PolyQuery *self)
-{
+PolyQuery_destroy(PolyQuery *self) {
DECREF(self->children);
SUPER_DESTROY(self, POLYQUERY);
}
void
-PolyQuery_add_child(PolyQuery *self, Query *query)
-{
+PolyQuery_add_child(PolyQuery *self, Query *query) {
CERTIFY(query, QUERY);
VA_Push(self->children, INCREF(query));
}
void
-PolyQuery_set_children(PolyQuery *self, VArray *children)
-{
+PolyQuery_set_children(PolyQuery *self, VArray *children) {
DECREF(self->children);
self->children = (VArray*)INCREF(children);
}
VArray*
-PolyQuery_get_children(PolyQuery *self) { return self->children; }
+PolyQuery_get_children(PolyQuery *self) {
+ return self->children;
+}
void
-PolyQuery_serialize(PolyQuery *self, OutStream *outstream)
-{
- const uint32_t num_kids = VA_Get_Size(self->children);
+PolyQuery_serialize(PolyQuery *self, OutStream *outstream) {
+ const uint32_t num_kids = VA_Get_Size(self->children);
uint32_t i;
OutStream_Write_F32(outstream, self->boost);
OutStream_Write_U32(outstream, num_kids);
@@ -79,10 +76,9 @@ PolyQuery_serialize(PolyQuery *self, Out
}
PolyQuery*
-PolyQuery_deserialize(PolyQuery *self, InStream *instream)
-{
- float boost = InStream_Read_F32(instream);
- uint32_t num_children = InStream_Read_U32(instream);
+PolyQuery_deserialize(PolyQuery *self, InStream *instream) {
+ float boost = InStream_Read_F32(instream);
+ uint32_t num_children = InStream_Read_U32(instream);
if (!self) THROW(ERR, "Abstract class");
PolyQuery_init(self, NULL);
@@ -97,8 +93,7 @@ PolyQuery_deserialize(PolyQuery *self, I
}
bool_t
-PolyQuery_equals(PolyQuery *self, Obj *other)
-{
+PolyQuery_equals(PolyQuery *self, Obj *other) {
PolyQuery *twin = (PolyQuery*)other;
if (twin == self) return true;
if (!Obj_Is_A(other, POLYQUERY)) return false;
@@ -111,9 +106,8 @@ PolyQuery_equals(PolyQuery *self, Obj *o
PolyCompiler*
-PolyCompiler_init(PolyCompiler *self, PolyQuery *parent,
- Searcher *searcher, float boost)
-{
+PolyCompiler_init(PolyCompiler *self, PolyQuery *parent,
+ Searcher *searcher, float boost) {
uint32_t i;
const uint32_t num_kids = VA_Get_Size(parent->children);
@@ -124,24 +118,22 @@ PolyCompiler_init(PolyCompiler *self, Po
for (i = 0; i < num_kids; i++) {
Query *child_query = (Query*)VA_Fetch(parent->children, i);
float sub_boost = boost * Query_Get_Boost(child_query);
- VA_Push(self->children,
- (Obj*)Query_Make_Compiler(child_query, searcher, sub_boost));
+ VA_Push(self->children,
+ (Obj*)Query_Make_Compiler(child_query, searcher, sub_boost));
}
return self;
}
void
-PolyCompiler_destroy(PolyCompiler *self)
-{
+PolyCompiler_destroy(PolyCompiler *self) {
DECREF(self->children);
SUPER_DESTROY(self, POLYCOMPILER);
}
float
-PolyCompiler_sum_of_squared_weights(PolyCompiler *self)
-{
- float sum = 0;
+PolyCompiler_sum_of_squared_weights(PolyCompiler *self) {
+ float sum = 0;
uint32_t i, max;
float my_boost = PolyCompiler_Get_Boost(self);
@@ -157,8 +149,7 @@ PolyCompiler_sum_of_squared_weights(Poly
}
void
-PolyCompiler_apply_norm_factor(PolyCompiler *self, float factor)
-{
+PolyCompiler_apply_norm_factor(PolyCompiler *self, float factor) {
uint32_t i, max;
for (i = 0, max = VA_Get_Size(self->children); i < max; i++) {
Compiler *child = (Compiler*)VA_Fetch(self->children, i);
@@ -167,15 +158,14 @@ PolyCompiler_apply_norm_factor(PolyCompi
}
VArray*
-PolyCompiler_highlight_spans(PolyCompiler *self, Searcher *searcher,
- DocVector *doc_vec, const CharBuf *field)
-{
+PolyCompiler_highlight_spans(PolyCompiler *self, Searcher *searcher,
+ DocVector *doc_vec, const CharBuf *field) {
VArray *spans = VA_new(0);
uint32_t i, max;
for (i = 0, max = VA_Get_Size(self->children); i < max; i++) {
Compiler *child = (Compiler*)VA_Fetch(self->children, i);
VArray *child_spans = Compiler_Highlight_Spans(child, searcher,
- doc_vec, field);
+ doc_vec, field);
if (child_spans) {
VA_Push_VArray(spans, child_spans);
VA_Dec_RefCount(child_spans);
@@ -185,16 +175,14 @@ PolyCompiler_highlight_spans(PolyCompile
}
void
-PolyCompiler_serialize(PolyCompiler *self, OutStream *outstream)
-{
+PolyCompiler_serialize(PolyCompiler *self, OutStream *outstream) {
CB_Serialize(PolyCompiler_Get_Class_Name(self), outstream);
VA_Serialize(self->children, outstream);
Compiler_serialize((Compiler*)self, outstream);
}
PolyCompiler*
-PolyCompiler_deserialize(PolyCompiler *self, InStream *instream)
-{
+PolyCompiler_deserialize(PolyCompiler *self, InStream *instream) {
CharBuf *class_name = CB_deserialize(NULL, instream);
if (!self) {
VTable *vtable = VTable_singleton(class_name, NULL);
Modified: incubator/lucy/trunk/core/Lucy/Search/PolyQuery.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/PolyQuery.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/PolyQuery.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/PolyQuery.cfh Sun May 1 23:50:24 2011
@@ -82,7 +82,7 @@ class Lucy::Search::PolyCompiler inherit
Apply_Norm_Factor(PolyCompiler *self, float factor);
public incremented VArray*
- Highlight_Spans(PolyCompiler *self, Searcher *searcher,
+ Highlight_Spans(PolyCompiler *self, Searcher *searcher,
DocVector *doc_vec, const CharBuf *field);
public void
Modified: incubator/lucy/trunk/core/Lucy/Search/PolySearcher.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/PolySearcher.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/PolySearcher.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/PolySearcher.c Sun May 1 23:50:24 2011
@@ -34,19 +34,18 @@
#include "Lucy/Search/Compiler.h"
PolySearcher*
-PolySearcher_init(PolySearcher *self, Schema *schema, VArray *searchers)
-{
+PolySearcher_init(PolySearcher *self, Schema *schema, VArray *searchers) {
const uint32_t num_searchers = VA_Get_Size(searchers);
uint32_t i;
int32_t *starts_array = (int32_t*)MALLOCATE(num_searchers * sizeof(int32_t));
- int32_t doc_max = 0;
+ int32_t doc_max = 0;
Searcher_init((Searcher*)self, schema);
self->searchers = (VArray*)INCREF(searchers);
self->starts = NULL; // Safe cleanup.
for (i = 0; i < num_searchers; i++) {
- Searcher *searcher
+ Searcher *searcher
= (Searcher*)CERTIFY(VA_Fetch(searchers, i), SEARCHER);
Schema *candidate = Searcher_Get_Schema(searcher);
VTable *orig_vt = Schema_Get_VTable(schema);
@@ -55,8 +54,8 @@ PolySearcher_init(PolySearcher *self, Sc
// Confirm that searchers all use the same schema.
if (orig_vt != candidate_vt) {
THROW(ERR, "Conflicting schemas: '%o', '%o'",
- Schema_Get_Class_Name(schema),
- Schema_Get_Class_Name(candidate));
+ Schema_Get_Class_Name(schema),
+ Schema_Get_Class_Name(candidate));
}
// Derive doc_max and relative start offsets.
@@ -71,19 +70,17 @@ PolySearcher_init(PolySearcher *self, Sc
}
void
-PolySearcher_destroy(PolySearcher *self)
-{
+PolySearcher_destroy(PolySearcher *self) {
DECREF(self->searchers);
DECREF(self->starts);
SUPER_DESTROY(self, POLYSEARCHER);
}
HitDoc*
-PolySearcher_fetch_doc(PolySearcher *self, int32_t doc_id)
-{
- uint32_t tick = PolyReader_sub_tick(self->starts, doc_id);
- Searcher *searcher = (Searcher*)VA_Fetch(self->searchers, tick);
- int32_t offset = I32Arr_Get(self->starts, tick);
+PolySearcher_fetch_doc(PolySearcher *self, int32_t doc_id) {
+ uint32_t tick = PolyReader_sub_tick(self->starts, doc_id);
+ Searcher *searcher = (Searcher*)VA_Fetch(self->searchers, tick);
+ int32_t offset = I32Arr_Get(self->starts, tick);
if (!searcher) { THROW(ERR, "Invalid doc id: %i32", doc_id); }
HitDoc *hit_doc = Searcher_Fetch_Doc(searcher, doc_id - offset);
HitDoc_Set_Doc_ID(hit_doc, doc_id);
@@ -91,25 +88,22 @@ PolySearcher_fetch_doc(PolySearcher *sel
}
DocVector*
-PolySearcher_fetch_doc_vec(PolySearcher *self, int32_t doc_id)
-{
- uint32_t tick = PolyReader_sub_tick(self->starts, doc_id);
- Searcher *searcher = (Searcher*)VA_Fetch(self->searchers, tick);
- int32_t start = I32Arr_Get(self->starts, tick);
+PolySearcher_fetch_doc_vec(PolySearcher *self, int32_t doc_id) {
+ uint32_t tick = PolyReader_sub_tick(self->starts, doc_id);
+ Searcher *searcher = (Searcher*)VA_Fetch(self->searchers, tick);
+ int32_t start = I32Arr_Get(self->starts, tick);
if (!searcher) { THROW(ERR, "Invalid doc id: %i32", doc_id); }
return Searcher_Fetch_Doc_Vec(searcher, doc_id - start);
}
-int32_t
-PolySearcher_doc_max(PolySearcher *self)
-{
+int32_t
+PolySearcher_doc_max(PolySearcher *self) {
return self->doc_max;
}
uint32_t
-PolySearcher_doc_freq(PolySearcher *self, const CharBuf *field, Obj *term)
-{
- uint32_t i, max;
+PolySearcher_doc_freq(PolySearcher *self, const CharBuf *field, Obj *term) {
+ uint32_t i, max;
uint32_t doc_freq = 0;
for (i = 0, max = VA_Get_Size(self->searchers); i < max; i++) {
Searcher *searcher = (Searcher*)VA_Fetch(self->searchers, i);
@@ -119,38 +113,36 @@ PolySearcher_doc_freq(PolySearcher *self
}
static void
-S_modify_doc_ids(VArray *match_docs, int32_t base)
-{
+S_modify_doc_ids(VArray *match_docs, int32_t base) {
uint32_t i, max;
for (i = 0, max = VA_Get_Size(match_docs); i < max; i++) {
MatchDoc *match_doc = (MatchDoc*)VA_Fetch(match_docs, i);
- int32_t new_doc_id = MatchDoc_Get_Doc_ID(match_doc) + base;
+ int32_t new_doc_id = MatchDoc_Get_Doc_ID(match_doc) + base;
MatchDoc_Set_Doc_ID(match_doc, new_doc_id);
}
}
TopDocs*
PolySearcher_top_docs(PolySearcher *self, Query *query, uint32_t num_wanted,
- SortSpec *sort_spec)
-{
+ SortSpec *sort_spec) {
Schema *schema = PolySearcher_Get_Schema(self);
VArray *searchers = self->searchers;
I32Array *starts = self->starts;
- HitQueue *hit_q = sort_spec
- ? HitQ_new(schema, sort_spec, num_wanted)
- : HitQ_new(NULL, NULL, num_wanted);
+ HitQueue *hit_q = sort_spec
+ ? HitQ_new(schema, sort_spec, num_wanted)
+ : HitQ_new(NULL, NULL, num_wanted);
uint32_t total_hits = 0;
- Compiler *compiler = Query_Is_A(query, COMPILER)
- ? ((Compiler*)INCREF(query))
- : Query_Make_Compiler(query, (Searcher*)self,
- Query_Get_Boost(query));
+ Compiler *compiler = Query_Is_A(query, COMPILER)
+ ? ((Compiler*)INCREF(query))
+ : Query_Make_Compiler(query, (Searcher*)self,
+ Query_Get_Boost(query));
uint32_t i, max;
for (i = 0, max = VA_Get_Size(searchers); i < max; i++) {
Searcher *searcher = (Searcher*)VA_Fetch(searchers, i);
int32_t base = I32Arr_Get(starts, i);
- TopDocs *top_docs = Searcher_Top_Docs(searcher,
- (Query*)compiler, num_wanted, sort_spec);
+ TopDocs *top_docs = Searcher_Top_Docs(searcher, (Query*)compiler,
+ num_wanted, sort_spec);
VArray *sub_match_docs = TopDocs_Get_Match_Docs(top_docs);
uint32_t j, jmax;
@@ -178,13 +170,12 @@ PolySearcher_top_docs(PolySearcher *self
void
-PolySearcher_collect(PolySearcher *self, Query *query,
- Collector *collector)
-{
+PolySearcher_collect(PolySearcher *self, Query *query,
+ Collector *collector) {
uint32_t i, max;
VArray *const searchers = self->searchers;
I32Array *starts = self->starts;
-
+
for (i = 0, max = VA_Get_Size(searchers); i < max; i++) {
int32_t start = I32Arr_Get(starts, i);
Searcher *searcher = (Searcher*)VA_Fetch(searchers, i);
Modified: incubator/lucy/trunk/core/Lucy/Search/PolySearcher.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/PolySearcher.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/PolySearcher.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/PolySearcher.cfh Sun May 1 23:50:24 2011
@@ -25,9 +25,9 @@ parcel Lucy;
* from multiple Searchers on a single machine.
*/
-class Lucy::Search::PolySearcher
+class Lucy::Search::PolySearcher
inherits Lucy::Search::Searcher {
-
+
VArray *searchers;
I32Array *starts;
int32_t doc_max;
Modified: incubator/lucy/trunk/core/Lucy/Search/Query.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/Query.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/Query.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/Query.c Sun May 1 23:50:24 2011
@@ -24,27 +24,29 @@
#include "Lucy/Store/OutStream.h"
Query*
-Query_init(Query *self, float boost)
-{
+Query_init(Query *self, float boost) {
self->boost = boost;
ABSTRACT_CLASS_CHECK(self, QUERY);
return self;
}
void
-Query_set_boost(Query *self, float boost) { self->boost = boost; }
+Query_set_boost(Query *self, float boost) {
+ self->boost = boost;
+}
+
float
-Query_get_boost(Query *self) { return self->boost; }
+Query_get_boost(Query *self) {
+ return self->boost;
+}
void
-Query_serialize(Query *self, OutStream *outstream)
-{
+Query_serialize(Query *self, OutStream *outstream) {
OutStream_Write_F32(outstream, self->boost);
}
Query*
-Query_deserialize(Query *self, InStream *instream)
-{
+Query_deserialize(Query *self, InStream *instream) {
float boost = InStream_Read_F32(instream);
self = self ? self : (Query*)VTable_Make_Obj(QUERY);
Query_init(self, boost);