quest_search 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +41 -0
- data/doc/AddQuestSearchIndexTo.html +139 -0
- data/doc/Gemfile.html +101 -0
- data/doc/QuestSearch.html +149 -0
- data/doc/QuestSearch/Generators.html +133 -0
- data/doc/QuestSearch/Generators/MigrationGenerator.html +235 -0
- data/doc/QuestSearch/QuestSearchOn.html +217 -0
- data/doc/QuestSearch/QuestSearchOn/ClassMethods.html +252 -0
- data/doc/README.html +147 -0
- data/doc/Rakefile.html +104 -0
- data/doc/created.rid +9 -0
- data/doc/images/add.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +92 -0
- data/doc/js/darkfish.js +153 -0
- data/doc/js/jquery.js +18 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +94 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/lib/generators/quest_search/migration/migration_generator_rb.html +95 -0
- data/doc/lib/generators/templates/add_quest_search_index_rb.html +95 -0
- data/doc/lib/quest_search/quest_search_on_rb.html +95 -0
- data/doc/lib/quest_search/version_rb.html +95 -0
- data/doc/lib/quest_search_rb.html +95 -0
- data/doc/rdoc.css +543 -0
- data/doc/table_of_contents.html +92 -0
- data/lib/quest_search/version.rb +1 -1
- data/rdoc/AddQuestSearchIndexTo.html +149 -0
- data/rdoc/QuestSearch.html +175 -0
- data/rdoc/QuestSearch/Generators.html +151 -0
- data/rdoc/QuestSearch/Generators/MigrationGenerator.html +251 -0
- data/rdoc/QuestSearch/QuestSearchOn.html +238 -0
- data/rdoc/QuestSearch/QuestSearchOn/ClassMethods.html +266 -0
- data/rdoc/README_rdoc.html +144 -0
- data/rdoc/created.rid +7 -0
- data/rdoc/images/brick.png +0 -0
- data/rdoc/images/brick_link.png +0 -0
- data/rdoc/images/bug.png +0 -0
- data/rdoc/images/bullet_black.png +0 -0
- data/rdoc/images/bullet_toggle_minus.png +0 -0
- data/rdoc/images/bullet_toggle_plus.png +0 -0
- data/rdoc/images/date.png +0 -0
- data/rdoc/images/find.png +0 -0
- data/rdoc/images/loadingAnimation.gif +0 -0
- data/rdoc/images/macFFBgHack.png +0 -0
- data/rdoc/images/package.png +0 -0
- data/rdoc/images/page_green.png +0 -0
- data/rdoc/images/page_white_text.png +0 -0
- data/rdoc/images/page_white_width.png +0 -0
- data/rdoc/images/plugin.png +0 -0
- data/rdoc/images/ruby.png +0 -0
- data/rdoc/images/tag_green.png +0 -0
- data/rdoc/images/wrench.png +0 -0
- data/rdoc/images/wrench_orange.png +0 -0
- data/rdoc/images/zoom.png +0 -0
- data/rdoc/index.html +76 -0
- data/rdoc/js/darkfish.js +116 -0
- data/rdoc/js/jquery.js +32 -0
- data/rdoc/js/quicksearch.js +114 -0
- data/rdoc/js/thickbox-compressed.js +10 -0
- data/rdoc/lib/generators/quest_search/migration/migration_generator_rb.html +56 -0
- data/rdoc/lib/generators/templates/add_quest_search_index_rb.html +52 -0
- data/rdoc/lib/quest_search/quest_search_on_rb.html +54 -0
- data/rdoc/lib/quest_search/version_rb.html +52 -0
- data/rdoc/lib/quest_search_rb.html +54 -0
- data/rdoc/rdoc.css +763 -0
- metadata +90 -2
- data/README +0 -33
@@ -0,0 +1,266 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Module: QuestSearch::QuestSearchOn::ClassMethods</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../../js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
<script src="../../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="../../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="../../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body id="top" class="module">
|
19
|
+
|
20
|
+
<div id="metadata">
|
21
|
+
<div id="home-metadata">
|
22
|
+
<div id="home-section" class="section">
|
23
|
+
<h3 class="section-header">
|
24
|
+
<a href="../../index.html">Home</a>
|
25
|
+
<a href="../../index.html#classes">Classes</a>
|
26
|
+
<a href="../../index.html#methods">Methods</a>
|
27
|
+
</h3>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="file-metadata">
|
32
|
+
<div id="file-list-section" class="section">
|
33
|
+
<h3 class="section-header">In Files</h3>
|
34
|
+
<div class="section-body">
|
35
|
+
<ul>
|
36
|
+
|
37
|
+
<li><a href="../../lib/quest_search/quest_search_on_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="lib/quest_search/quest_search_on.rb">lib/quest_search/quest_search_on.rb</a></li>
|
39
|
+
|
40
|
+
</ul>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div id="class-metadata">
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
<!-- Method Quickref -->
|
56
|
+
<div id="method-list-section" class="section">
|
57
|
+
<h3 class="section-header">Methods</h3>
|
58
|
+
<ul class="link-list">
|
59
|
+
|
60
|
+
<li><a href="#method-i-quest_search_for">#quest_search_for</a></li>
|
61
|
+
|
62
|
+
<li><a href="#method-i-quest_search_on">#quest_search_on</a></li>
|
63
|
+
|
64
|
+
</ul>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
</div>
|
70
|
+
|
71
|
+
<div id="project-metadata">
|
72
|
+
|
73
|
+
|
74
|
+
<div id="fileindex-section" class="section project-section">
|
75
|
+
<h3 class="section-header">Files</h3>
|
76
|
+
<ul>
|
77
|
+
|
78
|
+
<li class="file"><a href="../../README_rdoc.html">README.rdoc</a></li>
|
79
|
+
|
80
|
+
</ul>
|
81
|
+
</div>
|
82
|
+
|
83
|
+
|
84
|
+
<div id="classindex-section" class="section project-section">
|
85
|
+
<h3 class="section-header">Class/Module Index
|
86
|
+
<span class="search-toggle"><img src="../../images/find.png"
|
87
|
+
height="16" width="16" alt="[+]"
|
88
|
+
title="show/hide quicksearch" /></span></h3>
|
89
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
90
|
+
<fieldset>
|
91
|
+
<legend>Quicksearch</legend>
|
92
|
+
<input type="text" name="quicksearch" value=""
|
93
|
+
class="quicksearch-field" />
|
94
|
+
</fieldset>
|
95
|
+
</form>
|
96
|
+
|
97
|
+
<ul class="link-list">
|
98
|
+
|
99
|
+
<li><a href="../../QuestSearch.html">QuestSearch</a></li>
|
100
|
+
|
101
|
+
<li><a href="../../QuestSearch/Generators.html">QuestSearch::Generators</a></li>
|
102
|
+
|
103
|
+
<li><a href="../../QuestSearch/Generators/MigrationGenerator.html">QuestSearch::Generators::MigrationGenerator</a></li>
|
104
|
+
|
105
|
+
<li><a href="../../QuestSearch/QuestSearchOn.html">QuestSearch::QuestSearchOn</a></li>
|
106
|
+
|
107
|
+
<li><a href="../../QuestSearch/QuestSearchOn/ClassMethods.html">QuestSearch::QuestSearchOn::ClassMethods</a></li>
|
108
|
+
|
109
|
+
<li><a href="../../AddQuestSearchIndexTo.html">AddQuestSearchIndexTo</a></li>
|
110
|
+
|
111
|
+
</ul>
|
112
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<div id="documentation">
|
120
|
+
<h1 class="module">QuestSearch::QuestSearchOn::ClassMethods</h1>
|
121
|
+
|
122
|
+
<div id="description" class="description">
|
123
|
+
|
124
|
+
</div><!-- description -->
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
<!-- Methods -->
|
139
|
+
|
140
|
+
<div id="public-instance-method-details" class="method-section section">
|
141
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
142
|
+
|
143
|
+
|
144
|
+
<div id="quest_search_for-method" class="method-detail ">
|
145
|
+
<a name="method-i-quest_search_for"></a>
|
146
|
+
|
147
|
+
|
148
|
+
<div class="method-heading">
|
149
|
+
<span class="method-name">quest_search_for</span><span
|
150
|
+
class="method-args">(query, page_no = 1, page_size = 2**32, sort = nil)</span>
|
151
|
+
<span class="method-click-advice">click to toggle source</span>
|
152
|
+
</div>
|
153
|
+
|
154
|
+
|
155
|
+
<div class="method-description">
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<div class="method-source-code" id="quest_search_for-source">
|
162
|
+
<pre>
|
163
|
+
<span class="ruby-comment"># File lib/quest_search/quest_search_on.rb, line 23</span>
|
164
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">quest_search_for</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">page_no</span> = <span class="ruby-value">1</span>, <span class="ruby-identifier">page_size</span> = <span class="ruby-value">2</span><span class="ruby-operator">**</span><span class="ruby-value">32</span>, <span class="ruby-identifier">sort</span> = <span class="ruby-keyword">nil</span>)
|
165
|
+
<span class="ruby-identifier">words</span> = <span class="ruby-operator">::</span><span class="ruby-constant">UnicodeUtils</span>.<span class="ruby-identifier">downcase</span>(<span class="ruby-identifier">query</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">split</span> <span class="ruby-string">" "</span>
|
166
|
+
<span class="ruby-identifier">conditions</span> = <span class="ruby-identifier">words</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">w</span><span class="ruby-operator">|</span>
|
167
|
+
<span class="ruby-identifier">replace_bind_variables</span>(<span class="ruby-node">"#{self.quest_search_index_field} like ?"</span>, [<span class="ruby-node">"%#{w}%"</span>])
|
168
|
+
<span class="ruby-keyword">end</span>.<span class="ruby-identifier">join</span> <span class="ruby-string">" OR "</span>
|
169
|
+
|
170
|
+
<span class="ruby-identifier">offset</span> = (<span class="ruby-identifier">page_no</span> * <span class="ruby-identifier">page_size</span>) <span class="ruby-operator">-</span> <span class="ruby-identifier">page_size</span>
|
171
|
+
<span class="ruby-identifier">offset_ends</span> = <span class="ruby-identifier">offset</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">page_size</span>
|
172
|
+
|
173
|
+
<span class="ruby-ivar">@order</span> = <span class="ruby-identifier">sort</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@order</span>
|
174
|
+
|
175
|
+
<span class="ruby-identifier">results</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">where</span>(<span class="ruby-identifier">conditions</span>).<span class="ruby-identifier">order</span>(<span class="ruby-ivar">@order</span>)
|
176
|
+
|
177
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">sort</span>
|
178
|
+
<span class="ruby-identifier">results</span> = <span class="ruby-identifier">results</span>.<span class="ruby-identifier">sort</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
|
179
|
+
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">points_for</span>(<span class="ruby-identifier">query</span>) <span class="ruby-operator"><=></span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">points_for</span>(<span class="ruby-identifier">query</span>)
|
180
|
+
<span class="ruby-keyword">end</span>
|
181
|
+
<span class="ruby-keyword">else</span>
|
182
|
+
<span class="ruby-identifier">results</span> = <span class="ruby-identifier">results</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
|
183
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">points_for</span>(<span class="ruby-identifier">query</span>)
|
184
|
+
<span class="ruby-keyword">end</span>
|
185
|
+
<span class="ruby-keyword">end</span>
|
186
|
+
|
187
|
+
<span class="ruby-identifier">paginated_results</span> = []
|
188
|
+
|
189
|
+
<span class="ruby-identifier">results</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">r</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
190
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">>=</span> <span class="ruby-identifier">offset</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">index</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">offset_ends</span>
|
191
|
+
<span class="ruby-identifier">paginated_results</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">r</span>
|
192
|
+
<span class="ruby-keyword">end</span>
|
193
|
+
<span class="ruby-keyword">end</span>
|
194
|
+
|
195
|
+
<span class="ruby-identifier">paginated_results</span>
|
196
|
+
<span class="ruby-keyword">end</span></pre>
|
197
|
+
</div><!-- quest_search_for-source -->
|
198
|
+
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
</div><!-- quest_search_for-method -->
|
205
|
+
|
206
|
+
|
207
|
+
<div id="quest_search_on-method" class="method-detail ">
|
208
|
+
<a name="method-i-quest_search_on"></a>
|
209
|
+
|
210
|
+
|
211
|
+
<div class="method-heading">
|
212
|
+
<span class="method-name">quest_search_on</span><span
|
213
|
+
class="method-args">(*fields)</span>
|
214
|
+
<span class="method-click-advice">click to toggle source</span>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
|
218
|
+
<div class="method-description">
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
<div class="method-source-code" id="quest_search_on-source">
|
225
|
+
<pre>
|
226
|
+
<span class="ruby-comment"># File lib/quest_search/quest_search_on.rb, line 8</span>
|
227
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">quest_search_on</span>(*<span class="ruby-identifier">fields</span>)
|
228
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">fields</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">zero?</span>
|
229
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"No arguments given, please specify which fields should be indexed and searched."</span>
|
230
|
+
<span class="ruby-keyword">end</span>
|
231
|
+
|
232
|
+
<span class="ruby-identifier">options</span> = <span class="ruby-identifier">fields</span>.<span class="ruby-identifier">extract_options!</span>
|
233
|
+
<span class="ruby-ivar">@order</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:order</span>] <span class="ruby-operator">||</span> <span class="ruby-string">"id desc"</span>
|
234
|
+
|
235
|
+
<span class="ruby-identifier">cattr_accessor</span> <span class="ruby-value">:quest_search_fields</span>, <span class="ruby-value">:quest_search_index_field</span>
|
236
|
+
|
237
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">quest_search_fields</span> = <span class="ruby-identifier">fields</span>
|
238
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">quest_search_index_field</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:quest_search_index_field</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:quest_search_index</span>
|
239
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">before_save</span> <span class="ruby-value">:update_quest_search_index</span>
|
240
|
+
<span class="ruby-keyword">end</span></pre>
|
241
|
+
</div><!-- quest_search_on-source -->
|
242
|
+
|
243
|
+
</div>
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
</div><!-- quest_search_on-method -->
|
249
|
+
|
250
|
+
|
251
|
+
</div><!-- public-instance-method-details -->
|
252
|
+
|
253
|
+
</div><!-- 5Buntitled-5D -->
|
254
|
+
|
255
|
+
|
256
|
+
</div><!-- documentation -->
|
257
|
+
|
258
|
+
<div id="validator-badges">
|
259
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
260
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
261
|
+
Rdoc Generator</a> 2</small>.</p>
|
262
|
+
</div>
|
263
|
+
|
264
|
+
</body>
|
265
|
+
</html>
|
266
|
+
|
@@ -0,0 +1,144 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
+
<head>
|
7
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
8
|
+
|
9
|
+
<title>File: README.rdoc [QuestSearch]</title>
|
10
|
+
|
11
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
|
12
|
+
|
13
|
+
<script src="./js/jquery.js" type="text/javascript"
|
14
|
+
charset="utf-8"></script>
|
15
|
+
<script src="./js/thickbox-compressed.js" type="text/javascript"
|
16
|
+
charset="utf-8"></script>
|
17
|
+
<script src="./js/quicksearch.js" type="text/javascript"
|
18
|
+
charset="utf-8"></script>
|
19
|
+
<script src="./js/darkfish.js" type="text/javascript"
|
20
|
+
charset="utf-8"></script>
|
21
|
+
</head>
|
22
|
+
|
23
|
+
<body class="file">
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="home-metadata">
|
26
|
+
<div id="home-section" class="section">
|
27
|
+
<h3 class="section-header">
|
28
|
+
<a href="./index.html">Home</a>
|
29
|
+
<a href="./index.html#classes">Classes</a>
|
30
|
+
<a href="./index.html#methods">Methods</a>
|
31
|
+
</h3>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="project-metadata">
|
36
|
+
|
37
|
+
|
38
|
+
<div id="fileindex-section" class="section project-section">
|
39
|
+
<h3 class="section-header">Files</h3>
|
40
|
+
<ul>
|
41
|
+
|
42
|
+
<li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
|
43
|
+
|
44
|
+
</ul>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
|
48
|
+
<div id="classindex-section" class="section project-section">
|
49
|
+
<h3 class="section-header">Class Index
|
50
|
+
<span class="search-toggle"><img src="./images/find.png"
|
51
|
+
height="16" width="16" alt="[+]"
|
52
|
+
title="show/hide quicksearch" /></span></h3>
|
53
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
54
|
+
<fieldset>
|
55
|
+
<legend>Quicksearch</legend>
|
56
|
+
<input type="text" name="quicksearch" value=""
|
57
|
+
class="quicksearch-field" />
|
58
|
+
</fieldset>
|
59
|
+
</form>
|
60
|
+
|
61
|
+
<ul class="link-list">
|
62
|
+
|
63
|
+
<li><a href="./QuestSearch.html">QuestSearch</a></li>
|
64
|
+
|
65
|
+
<li><a href="./QuestSearch/Generators.html">QuestSearch::Generators</a></li>
|
66
|
+
|
67
|
+
<li><a href="./QuestSearch/Generators/MigrationGenerator.html">QuestSearch::Generators::MigrationGenerator</a></li>
|
68
|
+
|
69
|
+
<li><a href="./QuestSearch/QuestSearchOn.html">QuestSearch::QuestSearchOn</a></li>
|
70
|
+
|
71
|
+
<li><a href="./QuestSearch/QuestSearchOn/ClassMethods.html">QuestSearch::QuestSearchOn::ClassMethods</a></li>
|
72
|
+
|
73
|
+
<li><a href="./AddQuestSearchIndexTo.html">AddQuestSearchIndexTo</a></li>
|
74
|
+
|
75
|
+
</ul>
|
76
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
|
80
|
+
</div>
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<div id="documentation">
|
84
|
+
|
85
|
+
<h1>Quest</h1>
|
86
|
+
|
87
|
+
<p>Extremely naive full text search implementation for ActiveRecord based on
|
88
|
+
naive-search by Tomas Jogin (<a
|
89
|
+
href="http://github.com/tjogin/naive-search">github.com/tjogin/naive-search</a>).
|
90
|
+
Orders results by relevance and gives you detailed info on the search
|
91
|
+
results. Works like this:</p>
|
92
|
+
<ul><li>
|
93
|
+
<p>Every word in a search query is matched against each text field in your
|
94
|
+
database using <tt>like</tt>.</p>
|
95
|
+
</li><li>
|
96
|
+
<p>The returned results are then re-ordered based on how well they match the
|
97
|
+
query and the words the query is made up of.</p>
|
98
|
+
</li><li>
|
99
|
+
<p>As opposed to naive-search quest doesn’t re-organize your fields into an
|
100
|
+
index column in your database. Instead it searches after each word in each
|
101
|
+
field that you specify. This may result in huge overhead when searching big
|
102
|
+
databases.</p>
|
103
|
+
</li></ul>
|
104
|
+
|
105
|
+
<h2>Installation</h2>
|
106
|
+
|
107
|
+
<pre>gem install quest</pre>
|
108
|
+
|
109
|
+
<h2>Usage</h2>
|
110
|
+
|
111
|
+
<pre>class Person < ActiveRecord::Base
|
112
|
+
quest_on :name, :surname, :description
|
113
|
+
end</pre>
|
114
|
+
|
115
|
+
<p>This makes the specified fields searchable like so:</p>
|
116
|
+
|
117
|
+
<pre>Person.quest_for 'my query'</pre>
|
118
|
+
|
119
|
+
<p>Optionally, you can specify the order and limit of results to return from
|
120
|
+
the database:</p>
|
121
|
+
|
122
|
+
<pre>class Person < ActiveRecord::Base
|
123
|
+
quest_on :name, :surname, :description, :order => "id desc", :limit => 20
|
124
|
+
end</pre>
|
125
|
+
|
126
|
+
<p>Note that the search results will still be re-ordered based on fuzzy
|
127
|
+
“relevance”, this simply specifies how many results to retrieve from the
|
128
|
+
database, and in which order. Also note that small limits combined with
|
129
|
+
broad searches yields terrible results. The default limit is 1 000.</p>
|
130
|
+
|
131
|
+
<h2>License</h2>
|
132
|
+
|
133
|
+
<p>This project uses MIT-LICENSE.</p>
|
134
|
+
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<div id="validator-badges">
|
138
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
139
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
140
|
+
Rdoc Generator</a> 2</small>.</p>
|
141
|
+
</div>
|
142
|
+
</body>
|
143
|
+
</html>
|
144
|
+
|
data/rdoc/created.rid
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Wed, 07 Dec 2011 14:43:42 +0100
|
2
|
+
README.rdoc Wed, 07 Dec 2011 11:09:30 +0100
|
3
|
+
lib/quest_search/quest_search_on.rb Wed, 07 Dec 2011 14:18:33 +0100
|
4
|
+
lib/quest_search/version.rb Wed, 07 Dec 2011 14:18:53 +0100
|
5
|
+
lib/quest_search.rb Mon, 28 Nov 2011 16:27:54 +0100
|
6
|
+
lib/generators/quest_search/migration/migration_generator.rb Wed, 07 Dec 2011 11:12:19 +0100
|
7
|
+
lib/generators/templates/add_quest_search_index.rb Wed, 07 Dec 2011 11:10:57 +0100
|
Binary file
|
Binary file
|
data/rdoc/images/bug.png
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|