lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [3/6] git commit: refs/heads/move-dumpable - Implement Dump/Load manually.
Date Fri, 26 Jul 2013 01:30:43 GMT
Implement Dump/Load manually.

For classes which have heretofore relied on CFCDumpable for
autogenerating Dump/Load, create manual implementations.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/163c43ed
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/163c43ed
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/163c43ed

Branch: refs/heads/move-dumpable
Commit: 163c43ed86b381971adfa25959fdcdc3b63a0f9a
Parents: f1585ac
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Thu Jul 25 16:07:02 2013 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Thu Jul 25 18:27:24 2013 -0700

----------------------------------------------------------------------
 core/Lucy/Analysis/Analyzer.c             | 20 ++++++++++
 core/Lucy/Analysis/Analyzer.cfh           |  6 +++
 core/Lucy/Analysis/PolyAnalyzer.c         | 13 +++++++
 core/Lucy/Analysis/PolyAnalyzer.cfh       |  3 ++
 core/Lucy/Analysis/SnowballStopFilter.c   | 28 ++++++++++++++
 core/Lucy/Analysis/SnowballStopFilter.cfh |  6 +++
 core/Lucy/Search/LeafQuery.c              | 32 ++++++++++++++++
 core/Lucy/Search/LeafQuery.cfh            |  6 +++
 core/Lucy/Search/PhraseQuery.c            | 29 ++++++++++++++
 core/Lucy/Search/PhraseQuery.cfh          |  6 +++
 core/Lucy/Search/PolyQuery.c              | 24 ++++++++++++
 core/Lucy/Search/PolyQuery.cfh            |  6 +++
 core/Lucy/Search/Query.c                  | 26 +++++++++++++
 core/Lucy/Search/Query.cfh                |  6 +++
 core/Lucy/Search/RangeQuery.c             | 52 ++++++++++++++++++++++++++
 core/Lucy/Search/RangeQuery.cfh           |  6 +++
 core/Lucy/Search/TermQuery.c              | 27 +++++++++++++
 core/Lucy/Search/TermQuery.cfh            |  6 +++
 core/LucyX/Search/ProximityQuery.c        | 31 +++++++++++++++
 core/LucyX/Search/ProximityQuery.cfh      |  6 +++
 20 files changed, 339 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Analysis/Analyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/Analyzer.c b/core/Lucy/Analysis/Analyzer.c
index ab23fdc..9a16c16 100644
--- a/core/Lucy/Analysis/Analyzer.c
+++ b/core/Lucy/Analysis/Analyzer.c
@@ -58,4 +58,24 @@ Analyzer_split(Analyzer *self, CharBuf *text) {
     return out;
 }
 
+Obj*
+Analyzer_dump(Analyzer *self)
+{
+    Hash *dump = Hash_new(0);
+    Hash_Store_Str(dump, "_class", 6,
+                   (Obj*)CB_Clone(Obj_Get_Class_Name((Obj*)self)));
+    return (Obj*)dump;
+}
+
+Obj*
+Analyzer_load(Analyzer *self, Obj *dump)
+{
+    CHY_UNUSED_VAR(self);
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    CharBuf *class_name
+        = (CharBuf*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), CHARBUF);
+    VTable *vtable = VTable_singleton(class_name, NULL);
+    Analyzer *loaded = (Analyzer*)VTable_Make_Obj(vtable);
+    return (Obj*)loaded;
+}
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Analysis/Analyzer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/Analyzer.cfh b/core/Lucy/Analysis/Analyzer.cfh
index 4071bdb..f435aa8 100644
--- a/core/Lucy/Analysis/Analyzer.cfh
+++ b/core/Lucy/Analysis/Analyzer.cfh
@@ -49,6 +49,12 @@ public abstract class Lucy::Analysis::Analyzer
      */
     public incremented VArray*
     Split(Analyzer *self, CharBuf *text);
+
+    public incremented Obj*
+    Dump(Analyzer *self);
+
+    public incremented Obj*
+    Load(Analyzer *self, Obj *dump);
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Analysis/PolyAnalyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/PolyAnalyzer.c b/core/Lucy/Analysis/PolyAnalyzer.c
index f755e4e..0f64d16 100644
--- a/core/Lucy/Analysis/PolyAnalyzer.c
+++ b/core/Lucy/Analysis/PolyAnalyzer.c
@@ -120,6 +120,19 @@ PolyAnalyzer_equals(PolyAnalyzer *self, Obj *other) {
     return true;
 }
 
+Obj*
+PolyAnalyzer_dump(PolyAnalyzer *self)
+{
+    PolyAnalyzerIVARS *const ivars = PolyAnalyzer_IVARS(self);
+    PolyAnalyzer_Dump_t super_dump
+        = SUPER_METHOD_PTR(POLYANALYZER, Lucy_PolyAnalyzer_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    if (ivars->analyzers) {
+        Hash_Store_Str(dump, "analyzers", 9, Obj_Dump((Obj*)ivars->analyzers));
+    }
+    return (Obj*)dump;
+}
+
 PolyAnalyzer*
 PolyAnalyzer_load(PolyAnalyzer *self, Obj *dump) {
     Hash *source = (Hash*)CERTIFY(dump, HASH);

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Analysis/PolyAnalyzer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/PolyAnalyzer.cfh b/core/Lucy/Analysis/PolyAnalyzer.cfh
index a7cdd93..1edffc0 100644
--- a/core/Lucy/Analysis/PolyAnalyzer.cfh
+++ b/core/Lucy/Analysis/PolyAnalyzer.cfh
@@ -83,6 +83,9 @@ public class Lucy::Analysis::PolyAnalyzer
     public bool
     Equals(PolyAnalyzer *self, Obj *other);
 
+    public incremented Obj*
+    Dump(PolyAnalyzer *self);
+
     public incremented PolyAnalyzer*
     Load(PolyAnalyzer *self, Obj *dump);
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Analysis/SnowballStopFilter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStopFilter.c b/core/Lucy/Analysis/SnowballStopFilter.c
index e0d1f63..576ab08 100644
--- a/core/Lucy/Analysis/SnowballStopFilter.c
+++ b/core/Lucy/Analysis/SnowballStopFilter.c
@@ -89,6 +89,34 @@ SnowStop_equals(SnowballStopFilter *self, Obj *other) {
     return true;
 }
 
+Obj*
+SnowStop_dump(SnowballStopFilter *self)
+{
+    SnowballStopFilterIVARS *ivars = SnowStop_IVARS(self);
+    SnowStop_Dump_t super_dump
+        = SUPER_METHOD_PTR(SNOWBALLSTOPFILTER, Lucy_SnowStop_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    if (ivars->stoplist) {
+        Hash_Store_Str(dump, "stoplist", 8, Obj_Dump((Obj*)ivars->stoplist));
+    }
+    return (Obj*)dump;
+}
+
+Obj*
+SnowStop_load(SnowballStopFilter *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    SnowStop_Load_t super_load
+        = SUPER_METHOD_PTR(SNOWBALLSTOPFILTER, Lucy_SnowStop_Load);
+    SnowballStopFilter *loaded = (SnowballStopFilter*)super_load(self, dump);
+    Obj *stoplist = Hash_Fetch_Str(source, "stoplist", 8);
+    if (stoplist) {
+        SnowStop_IVARS(loaded)->stoplist
+            = (Hash*)CERTIFY(Obj_Load(stoplist, stoplist), HASH);
+    }
+    return (Obj*)loaded;
+}
+
 Hash*
 SnowStop_gen_stoplist(const CharBuf *language) {
     CharBuf *lang = CB_new(3);

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Analysis/SnowballStopFilter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStopFilter.cfh b/core/Lucy/Analysis/SnowballStopFilter.cfh
index 3303a96..68e172a 100644
--- a/core/Lucy/Analysis/SnowballStopFilter.cfh
+++ b/core/Lucy/Analysis/SnowballStopFilter.cfh
@@ -95,6 +95,12 @@ public class Lucy::Analysis::SnowballStopFilter cnick SnowStop
     public bool
     Equals(SnowballStopFilter *self, Obj *other);
 
+    public incremented Obj*
+    Dump(SnowballStopFilter *self);
+
+    public incremented Obj*
+    Load(SnowballStopFilter *self, Obj *dump);
+
     public void
     Destroy(SnowballStopFilter *self);
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/LeafQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/LeafQuery.c b/core/Lucy/Search/LeafQuery.c
index f5fb944..e248504 100644
--- a/core/Lucy/Search/LeafQuery.c
+++ b/core/Lucy/Search/LeafQuery.c
@@ -111,6 +111,38 @@ LeafQuery_deserialize(LeafQuery *self, InStream *instream) {
     return self;
 }
 
+Obj*
+LeafQuery_dump(LeafQuery *self)
+{
+    LeafQueryIVARS *ivars = LeafQuery_IVARS(self);
+    LeafQuery_Dump_t super_dump
+        = SUPER_METHOD_PTR(LEAFQUERY, Lucy_LeafQuery_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    if (ivars->field) {
+        Hash_Store_Str(dump, "field", 5, Obj_Dump((Obj*)ivars->field));
+    }
+    Hash_Store_Str(dump, "text", 4, Obj_Dump((Obj*)ivars->text));
+    return (Obj*)dump;
+}
+
+Obj*
+LeafQuery_load(LeafQuery *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    LeafQuery_Load_t super_load
+        = SUPER_METHOD_PTR(LEAFQUERY, Lucy_LeafQuery_Load);
+    LeafQuery *loaded = (LeafQuery*)super_load(self, dump);
+    LeafQueryIVARS *loaded_ivars = LeafQuery_IVARS(loaded);
+    Obj *field = Hash_Fetch_Str(source, "field", 5);
+    if (field) {
+        loaded_ivars->field
+            = (CharBuf*)CERTIFY(Obj_Load(field, field), CHARBUF);
+    }
+    Obj *text = CERTIFY(Hash_Fetch_Str(source, "text", 4), OBJ);
+    loaded_ivars->text = (CharBuf*)CERTIFY(Obj_Load(text, text), CHARBUF);
+    return (Obj*)loaded;
+}
+
 Compiler*
 LeafQuery_make_compiler(LeafQuery *self, Searcher *searcher, float boost,
                         bool subordinate) {

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/LeafQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/LeafQuery.cfh b/core/Lucy/Search/LeafQuery.cfh
index d6c7bb6..568898e 100644
--- a/core/Lucy/Search/LeafQuery.cfh
+++ b/core/Lucy/Search/LeafQuery.cfh
@@ -63,6 +63,12 @@ public class Lucy::Search::LeafQuery inherits Lucy::Search::Query
     public incremented LeafQuery*
     Deserialize(decremented LeafQuery *self, InStream *instream);
 
+    public incremented Obj*
+    Dump(LeafQuery *self);
+
+    public incremented Obj*
+    Load(LeafQuery *self, Obj *dump);
+
     /** Throws an error.
      */
     public incremented Compiler*

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/PhraseQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.c b/core/Lucy/Search/PhraseQuery.c
index 2c62e2f..7bcca36 100644
--- a/core/Lucy/Search/PhraseQuery.c
+++ b/core/Lucy/Search/PhraseQuery.c
@@ -90,6 +90,35 @@ PhraseQuery_deserialize(PhraseQuery *self, InStream *instream) {
     return S_do_init(self, field, terms, boost);
 }
 
+Obj*
+PhraseQuery_dump(PhraseQuery *self)
+{
+    PhraseQueryIVARS *ivars = PhraseQuery_IVARS(self);
+    PhraseQuery_Dump_t super_dump
+        = SUPER_METHOD_PTR(PHRASEQUERY, Lucy_PhraseQuery_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    Hash_Store_Str(dump, "field", 5, Obj_Dump((Obj*)ivars->field));
+    Hash_Store_Str(dump, "terms", 5, Obj_Dump((Obj*)ivars->terms));
+    return (Obj*)dump;
+}
+
+Obj*
+PhraseQuery_load(PhraseQuery *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    PhraseQuery_Load_t super_load
+        = SUPER_METHOD_PTR(PHRASEQUERY, Lucy_PhraseQuery_Load);
+    PhraseQuery *loaded = (PhraseQuery*)super_load(self, dump);
+    PhraseQueryIVARS *loaded_ivars = PhraseQuery_IVARS(loaded);
+    Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
+    loaded_ivars->field
+        = (CharBuf*)CERTIFY(Obj_Load(field, field), CHARBUF);
+    Obj *terms = CERTIFY(Hash_Fetch_Str(source, "terms", 5), OBJ);
+    loaded_ivars->terms
+        = (VArray*)CERTIFY(Obj_Load(terms, terms), VARRAY);
+    return (Obj*)loaded;
+}
+
 bool
 PhraseQuery_equals(PhraseQuery *self, Obj *other) {
     if ((PhraseQuery*)other == self)   { return true; }

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/PhraseQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.cfh b/core/Lucy/Search/PhraseQuery.cfh
index 6991430..34e4936 100644
--- a/core/Lucy/Search/PhraseQuery.cfh
+++ b/core/Lucy/Search/PhraseQuery.cfh
@@ -64,6 +64,12 @@ public class Lucy::Search::PhraseQuery inherits Lucy::Search::Query
     public incremented PhraseQuery*
     Deserialize(decremented PhraseQuery *self, InStream *instream);
 
+    public incremented Obj*
+    Dump(PhraseQuery *self);
+
+    public incremented Obj*
+    Load(PhraseQuery *self, Obj *dump);
+
     public void
     Destroy(PhraseQuery *self);
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/PolyQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.c b/core/Lucy/Search/PolyQuery.c
index da87dc1..74222a6 100644
--- a/core/Lucy/Search/PolyQuery.c
+++ b/core/Lucy/Search/PolyQuery.c
@@ -92,6 +92,30 @@ PolyQuery_deserialize(PolyQuery *self, InStream *instream) {
     return self;
 }
 
+Obj*
+PolyQuery_dump(PolyQuery *self)
+{
+    PolyQueryIVARS *ivars = PolyQuery_IVARS(self);
+    PolyQuery_Dump_t super_dump
+        = SUPER_METHOD_PTR(POLYQUERY, Lucy_PolyQuery_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    Hash_Store_Str(dump, "children", 8, Obj_Dump((Obj*)ivars->children));
+    return (Obj*)dump;
+}
+
+Obj*
+PolyQuery_load(PolyQuery *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    PolyQuery_Load_t super_load
+        = SUPER_METHOD_PTR(POLYQUERY, Lucy_PolyQuery_Load);
+    PolyQuery *loaded = (PolyQuery*)super_load(self, dump);
+    Obj *children = CERTIFY(Hash_Fetch_Str(source, "children", 8), OBJ);
+    PolyQuery_IVARS(loaded)->children
+        = (VArray*)CERTIFY(Obj_Load(children, children), VARRAY);
+    return (Obj*)loaded;
+}
+
 bool
 PolyQuery_equals(PolyQuery *self, Obj *other) {
     if ((PolyQuery*)other == self)                          { return true; }

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/PolyQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.cfh b/core/Lucy/Search/PolyQuery.cfh
index e4fc450..9b70142 100644
--- a/core/Lucy/Search/PolyQuery.cfh
+++ b/core/Lucy/Search/PolyQuery.cfh
@@ -54,6 +54,12 @@ public abstract class Lucy::Search::PolyQuery
     public incremented PolyQuery*
     Deserialize(decremented PolyQuery *self, InStream *instream);
 
+    public incremented Obj*
+    Dump(PolyQuery *self);
+
+    public incremented Obj*
+    Load(PolyQuery *self, Obj *dump);
+
     public bool
     Equals(PolyQuery *self, Obj *other);
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/Query.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Query.c b/core/Lucy/Search/Query.c
index 20243ed..50a5bc0 100644
--- a/core/Lucy/Search/Query.c
+++ b/core/Lucy/Search/Query.c
@@ -51,3 +51,29 @@ Query_deserialize(Query *self, InStream *instream) {
     return Query_init(self, boost);
 }
 
+Obj*
+Query_dump(Query *self)
+{
+    QueryIVARS *ivars = Query_IVARS(self);
+    Hash *dump = Hash_new(0);
+    Hash_Store_Str(dump, "_class", 6,
+                   (Obj*)CB_Clone(Obj_Get_Class_Name((Obj*)self)));
+    Hash_Store_Str(dump, "boost", 5,
+                   (Obj*)CB_newf("%f64", (double)ivars->boost));
+    return (Obj*)dump;
+}
+
+Obj*
+Query_load(Query *self, Obj *dump)
+{
+    CHY_UNUSED_VAR(self);
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    CharBuf *class_name
+        = (CharBuf*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), CHARBUF);
+    VTable *vtable = VTable_singleton(class_name, NULL);
+    Query *loaded = (Query*)VTable_Make_Obj(vtable);
+    Obj *boost = CERTIFY(Hash_Fetch_Str(source, "boost", 5), OBJ);
+    Query_IVARS(loaded)->boost = (float)Obj_To_F64(boost);
+    return (Obj*)loaded;
+}
+

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/Query.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Query.cfh b/core/Lucy/Search/Query.cfh
index 0b48b15..92653bb 100644
--- a/core/Lucy/Search/Query.cfh
+++ b/core/Lucy/Search/Query.cfh
@@ -76,6 +76,12 @@ public class Lucy::Search::Query inherits Clownfish::Obj : dumpable {
 
     public incremented Query*
     Deserialize(decremented Query *self, InStream *instream);
+
+    public incremented Obj*
+    Dump(Query *self);
+
+    public incremented Obj*
+    Load(Query *self, Obj *dump);
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/RangeQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.c b/core/Lucy/Search/RangeQuery.c
index 3f7ff15..3047e8a 100644
--- a/core/Lucy/Search/RangeQuery.c
+++ b/core/Lucy/Search/RangeQuery.c
@@ -160,6 +160,58 @@ RangeQuery_deserialize(RangeQuery *self, InStream *instream) {
     return self;
 }
 
+Obj*
+RangeQuery_dump(RangeQuery *self)
+{
+    RangeQueryIVARS *ivars = RangeQuery_IVARS(self);
+    RangeQuery_Dump_t super_dump
+        = SUPER_METHOD_PTR(RANGEQUERY, Lucy_RangeQuery_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    Hash_Store_Str(dump, "field", 5, Obj_Dump((Obj*)ivars->field));
+    if (ivars->lower_term) {
+        Hash_Store_Str(dump, "lower_term", 10,
+                       Obj_Dump((Obj*)ivars->lower_term));
+    }
+    if (ivars->upper_term) {
+        Hash_Store_Str(dump, "upper_term", 10,
+                       Obj_Dump((Obj*)ivars->upper_term));
+    }
+    Hash_Store_Str(dump, "include_lower", 13,
+                   (Obj*)Bool_singleton(ivars->include_lower));
+    Hash_Store_Str(dump, "include_upper", 13,
+                   (Obj*)Bool_singleton(ivars->include_upper));
+    return (Obj*)dump;
+}
+
+Obj*
+RangeQuery_load(RangeQuery *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    RangeQuery_Load_t super_load
+        = SUPER_METHOD_PTR(RANGEQUERY, Lucy_RangeQuery_Load);
+    RangeQuery *loaded = (RangeQuery*)super_load(self, dump);
+    RangeQueryIVARS *loaded_ivars = RangeQuery_IVARS(loaded);
+    Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
+    loaded_ivars->field = (CharBuf*)CERTIFY(Obj_Load(field, field), CHARBUF);
+    Obj *lower_term = Hash_Fetch_Str(source, "lower_term", 10);
+    if (lower_term) {
+        loaded_ivars->lower_term
+            = (Obj*)CERTIFY(Obj_Load(lower_term, lower_term), OBJ);
+    }
+    Obj *upper_term = Hash_Fetch_Str(source, "upper_term", 10);
+    if (upper_term) {
+        loaded_ivars->upper_term
+            = (Obj*)CERTIFY(Obj_Load(upper_term, upper_term), OBJ);
+    }
+    Obj *include_lower
+        = CERTIFY(Hash_Fetch_Str(source, "include_lower", 13), OBJ);
+    loaded_ivars->include_lower = Obj_To_Bool(include_lower);
+    Obj *include_upper
+        = CERTIFY(Hash_Fetch_Str(source, "include_upper", 13), OBJ);
+    loaded_ivars->include_upper = Obj_To_Bool(include_upper);
+    return (Obj*)loaded;
+}
+
 RangeCompiler*
 RangeQuery_make_compiler(RangeQuery *self, Searcher *searcher,
                          float boost, bool subordinate) {

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/RangeQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.cfh b/core/Lucy/Search/RangeQuery.cfh
index 1ad4ff4..01d9a9e 100644
--- a/core/Lucy/Search/RangeQuery.cfh
+++ b/core/Lucy/Search/RangeQuery.cfh
@@ -70,6 +70,12 @@ public class Lucy::Search::RangeQuery inherits Lucy::Search::Query
     public incremented RangeQuery*
     Deserialize(decremented RangeQuery *self, InStream *instream);
 
+    public incremented Obj*
+    Dump(RangeQuery *self);
+
+    public incremented Obj*
+    Load(RangeQuery *self, Obj *dump);
+
     public void
     Destroy(RangeQuery *self);
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/TermQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.c b/core/Lucy/Search/TermQuery.c
index 924e13f..18f36f5 100644
--- a/core/Lucy/Search/TermQuery.c
+++ b/core/Lucy/Search/TermQuery.c
@@ -74,6 +74,33 @@ TermQuery_deserialize(TermQuery *self, InStream *instream) {
     return self;
 }
 
+Obj*
+TermQuery_dump(TermQuery *self)
+{
+    TermQueryIVARS *ivars = TermQuery_IVARS(self);
+    TermQuery_Dump_t super_dump
+        = SUPER_METHOD_PTR(TERMQUERY, Lucy_TermQuery_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    Hash_Store_Str(dump, "field", 5, Obj_Dump((Obj*)ivars->field));
+    Hash_Store_Str(dump, "term", 4, Obj_Dump(ivars->term));
+    return (Obj*)dump;
+}
+
+Obj*
+TermQuery_load(TermQuery *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    TermQuery_Load_t super_load
+        = SUPER_METHOD_PTR(TERMQUERY, Lucy_TermQuery_Load);
+    TermQuery *loaded = (TermQuery*)super_load(self, dump);
+    TermQueryIVARS *loaded_ivars = TermQuery_IVARS(loaded);
+    Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
+    loaded_ivars->field = (CharBuf*)CERTIFY(Obj_Load(field, field), CHARBUF);
+    Obj *term = CERTIFY(Hash_Fetch_Str(source, "term", 4), OBJ);
+    loaded_ivars->term = (Obj*)CERTIFY(Obj_Load(term, term), OBJ);
+    return (Obj*)loaded;
+}
+
 CharBuf*
 TermQuery_get_field(TermQuery *self) {
     return TermQuery_IVARS(self)->field;

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/TermQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.cfh b/core/Lucy/Search/TermQuery.cfh
index 70b01a6..3960497 100644
--- a/core/Lucy/Search/TermQuery.cfh
+++ b/core/Lucy/Search/TermQuery.cfh
@@ -62,6 +62,12 @@ public class Lucy::Search::TermQuery inherits Lucy::Search::Query
     public incremented TermQuery*
     Deserialize(decremented TermQuery *self, InStream *instream);
 
+    public incremented Obj*
+    Dump(TermQuery *self);
+
+    public incremented Obj*
+    Load(TermQuery *self, Obj *dump);
+
     public bool
     Equals(TermQuery *self, Obj *other);
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/LucyX/Search/ProximityQuery.c
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.c b/core/LucyX/Search/ProximityQuery.c
index 3e8a435..37f7f70 100644
--- a/core/LucyX/Search/ProximityQuery.c
+++ b/core/LucyX/Search/ProximityQuery.c
@@ -96,6 +96,37 @@ ProximityQuery_deserialize(ProximityQuery *self, InStream *instream) {
     return S_do_init(self, field, terms, boost, within);
 }
 
+Obj*
+ProximityQuery_dump(ProximityQuery *self)
+{
+    ProximityQueryIVARS *ivars = ProximityQuery_IVARS(self);
+    ProximityQuery_Dump_t super_dump
+        = SUPER_METHOD_PTR(PROXIMITYQUERY, Lucy_ProximityQuery_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    Hash_Store_Str(dump, "field", 5, Obj_Dump((Obj*)ivars->field));
+    Hash_Store_Str(dump, "terms", 5, Obj_Dump((Obj*)ivars->terms));
+    Hash_Store_Str(dump, "within", 6,
+                   (Obj*)CB_newf("%i64", (int64_t)ivars->within));
+    return (Obj*)dump;
+}
+
+Obj*
+ProximityQuery_load(ProximityQuery *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    ProximityQuery_Load_t super_load
+        = SUPER_METHOD_PTR(PROXIMITYQUERY, Lucy_ProximityQuery_Load);
+    ProximityQuery *loaded = (ProximityQuery*)super_load(self, dump);
+    ProximityQueryIVARS *loaded_ivars = ProximityQuery_IVARS(loaded);
+    Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
+    loaded_ivars->field = (CharBuf*)CERTIFY(Obj_Load(field, field), CHARBUF);
+    Obj *terms = CERTIFY(Hash_Fetch_Str(source, "terms", 5), OBJ);
+    loaded_ivars->terms = (VArray*)CERTIFY(Obj_Load(terms, terms), VARRAY);
+    Obj *within = CERTIFY(Hash_Fetch_Str(source, "within", 6), OBJ);
+    loaded_ivars->within = (uint32_t)Obj_To_I64(within);
+    return (Obj*)loaded;
+}
+
 bool
 ProximityQuery_equals(ProximityQuery *self, Obj *other) {
     if ((ProximityQuery*)other == self)   { return true; }

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/LucyX/Search/ProximityQuery.cfh
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.cfh b/core/LucyX/Search/ProximityQuery.cfh
index 2506961..d55eb54 100644
--- a/core/LucyX/Search/ProximityQuery.cfh
+++ b/core/LucyX/Search/ProximityQuery.cfh
@@ -70,6 +70,12 @@ public class LucyX::Search::ProximityQuery inherits Lucy::Search::Query
     public incremented ProximityQuery*
     Deserialize(decremented ProximityQuery *self, InStream *instream);
 
+    public incremented Obj*
+    Dump(ProximityQuery *self);
+
+    public incremented Obj*
+    Load(ProximityQuery *self, Obj *dump);
+
     public void
     Destroy(ProximityQuery *self);
 }


Mime
View raw message