whistlepig 0.2 → 0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +8 -0
- data/ext/whistlepig/extconf.h +3 -0
- data/ext/whistlepig/whistlepigc.c +17 -0
- metadata +4 -6
data/README
CHANGED
@@ -75,6 +75,14 @@ Features that Whistlepig does provide:
|
|
75
75
|
q3 = Query.new "body", "bob ~funny"
|
76
76
|
results3 = index.search q3 # => [2]
|
77
77
|
|
78
|
+
entry3 = Entry.new
|
79
|
+
entry3.add_string "body", "hello joe"
|
80
|
+
entry3.add_string "subject", "what do you know?"
|
81
|
+
docid3 = index.add_entry entry3 # => 3
|
82
|
+
|
83
|
+
q4 = Query.new "body", "subject:know hello"
|
84
|
+
results4 = index.search q4 # => [3]
|
85
|
+
|
78
86
|
== A note on concurrency:
|
79
87
|
|
80
88
|
Whistlepig is currently single-process and single-thread only. However, it is
|
@@ -351,6 +351,22 @@ static VALUE query_to_s(VALUE self) {
|
|
351
351
|
return rb_str_new2(buf);
|
352
352
|
}
|
353
353
|
|
354
|
+
/*
|
355
|
+
* Returns a deep copy of the query, with any in-progress search state
|
356
|
+
* discarded. Useful for rerunning a query without interrupting any pagination
|
357
|
+
* state.
|
358
|
+
*
|
359
|
+
*/
|
360
|
+
static VALUE query_clone(VALUE self) {
|
361
|
+
char buf[1024];
|
362
|
+
|
363
|
+
wp_query* query; Data_Get_Struct(self, wp_query, query);
|
364
|
+
wp_query* clone = wp_query_clone(query);
|
365
|
+
|
366
|
+
VALUE o_query = Data_Wrap_Struct(c_query, NULL, wp_query_free, clone);
|
367
|
+
return o_query;
|
368
|
+
}
|
369
|
+
|
354
370
|
/*
|
355
371
|
* call-seq: and(other)
|
356
372
|
*
|
@@ -524,6 +540,7 @@ void Init_whistlepigc() {
|
|
524
540
|
rb_define_method(c_query, "and", query_and, 1);
|
525
541
|
rb_define_method(c_query, "or", query_or, 1);
|
526
542
|
rb_define_method(c_query, "to_s", query_to_s, 0);
|
543
|
+
rb_define_method(c_query, "clone", query_clone, 0);
|
527
544
|
rb_define_attr(c_query, "query", 1, 0);
|
528
545
|
|
529
546
|
c_error = rb_define_class_under(m_whistlepig, "Error", rb_eStandardError);
|
metadata
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whistlepig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 15
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
7
|
+
- 3
|
8
|
+
version: "0.3"
|
10
9
|
platform: ruby
|
11
10
|
authors:
|
12
11
|
- William Morgan
|
@@ -14,7 +13,7 @@ autorequire:
|
|
14
13
|
bindir: bin
|
15
14
|
cert_chain: []
|
16
15
|
|
17
|
-
date: 2011-02-
|
16
|
+
date: 2011-02-20 13:43:54 -08:00
|
18
17
|
default_executable:
|
19
18
|
dependencies: []
|
20
19
|
|
@@ -38,6 +37,7 @@ files:
|
|
38
37
|
- ext/whistlepig/tokenizer.lex.h
|
39
38
|
- ext/whistlepig/whistlepig.h
|
40
39
|
- ext/whistlepig/error.c
|
40
|
+
- ext/whistlepig/extconf.h
|
41
41
|
- ext/whistlepig/stringmap.h
|
42
42
|
- ext/whistlepig/query-parser.lex.c
|
43
43
|
- ext/whistlepig/defaults.h
|
@@ -82,7 +82,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
82
|
requirements:
|
83
83
|
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
hash: 3
|
86
85
|
segments:
|
87
86
|
- 0
|
88
87
|
version: "0"
|
@@ -91,7 +90,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
90
|
requirements:
|
92
91
|
- - ">="
|
93
92
|
- !ruby/object:Gem::Version
|
94
|
-
hash: 3
|
95
93
|
segments:
|
96
94
|
- 0
|
97
95
|
version: "0"
|