acts_as_searchable 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/MIT-LICENSE +20 -0
- data/README +32 -0
- data/Rakefile +186 -0
- data/TODO +0 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/acts_as_searchable.rb +360 -0
- data/lib/vendor/estraierpure.rb +1025 -0
- data/lib/vendor/overview +100 -0
- data/rdoc/classes/ActiveRecord/Acts/Searchable.html +182 -0
- data/rdoc/classes/ActiveRecord/Acts/Searchable/ActMethods.html +233 -0
- data/rdoc/classes/ActiveRecord/Acts/Searchable/ClassMethods.html +387 -0
- data/rdoc/classes/EstraierPure/Condition.html +619 -0
- data/rdoc/classes/EstraierPure/Document.html +551 -0
- data/rdoc/classes/EstraierPure/Node.html +1172 -0
- data/rdoc/classes/EstraierPure/NodeResult.html +248 -0
- data/rdoc/classes/EstraierPure/ResultDocument.html +307 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/README.html +165 -0
- data/rdoc/files/lib/acts_as_searchable_rb.html +140 -0
- data/rdoc/files/lib/vendor/estraierpure_rb.html +253 -0
- data/rdoc/fr_class_index.html +34 -0
- data/rdoc/fr_file_index.html +29 -0
- data/rdoc/fr_method_index.html +97 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/tasks/acts_as_searchable_tasks.rake +21 -0
- data/test/abstract_unit.rb +34 -0
- data/test/acts_as_searchable_test.rb +153 -0
- data/test/database.yml +3 -0
- data/test/fixtures/article.rb +5 -0
- data/test/fixtures/articles.yml +23 -0
- data/test/fixtures/comment.rb +4 -0
- data/test/fixtures/comments.yml +4 -0
- data/test/schema.rb +14 -0
- metadata +96 -0
data/lib/vendor/overview
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
= Pure Ruby Interface of Hyper Estraier
|
2
|
+
|
3
|
+
Hyper Estraier is a full-text search system for communities.
|
4
|
+
|
5
|
+
== Introduction
|
6
|
+
|
7
|
+
This is a package implementing the node API of {Hyper Estraier}[http://hyperestraier.sourceforge.net/]. This is a pure ruby package. So, it works on Linux, Mac OS X, Windows, and so on. It does not depend on the core library of Hyper Estraier. Applications are implemented as clients of node servers running on local or remote machines.
|
8
|
+
|
9
|
+
Though Hyper Estraier itself is released under the terms of the GNU LGPL, this package is released under the terms of a BSD-style license.
|
10
|
+
|
11
|
+
== Setting
|
12
|
+
|
13
|
+
Get the package of the latest version of Hyper Estraier.
|
14
|
+
|
15
|
+
Extract the package and enter the sub directory `rubypure' and perform installation.
|
16
|
+
|
17
|
+
cd rubypure
|
18
|
+
./configure
|
19
|
+
make
|
20
|
+
su
|
21
|
+
make install
|
22
|
+
|
23
|
+
The package `estraierpure' should be required in each source file of application programs and include the module `EstraierPure' at pleasure.
|
24
|
+
|
25
|
+
== Example of Gatherer
|
26
|
+
|
27
|
+
The following is the simplest implementation of a gatherer.
|
28
|
+
|
29
|
+
require "estraierpure"
|
30
|
+
include EstraierPure
|
31
|
+
|
32
|
+
# create and configure the node connecton object
|
33
|
+
node = Node::new
|
34
|
+
node.set_url("http://localhost:1978/node/test1")
|
35
|
+
node.set_auth("admin", "admin")
|
36
|
+
|
37
|
+
# create a document object
|
38
|
+
doc = Document::new
|
39
|
+
|
40
|
+
# add attributes to the document object
|
41
|
+
doc.add_attr("@uri", "http://estraier.gov/example.txt")
|
42
|
+
doc.add_attr("@title", "Over the Rainbow")
|
43
|
+
|
44
|
+
# add the body text to the document object
|
45
|
+
doc.add_text("Somewhere over the rainbow. Way up high.")
|
46
|
+
doc.add_text("There's a land that I heard of once in a lullaby.")
|
47
|
+
|
48
|
+
# register the document object to the node
|
49
|
+
unless node.put_doc(doc)
|
50
|
+
STDERR.printf("error: %d\n", node.status)
|
51
|
+
end
|
52
|
+
|
53
|
+
==Example of Searcher
|
54
|
+
|
55
|
+
The following is the simplest implementation of a searcher.
|
56
|
+
|
57
|
+
require "estraierpure"
|
58
|
+
include EstraierPure
|
59
|
+
|
60
|
+
# create and configure the node connecton object
|
61
|
+
node = Node::new
|
62
|
+
node.set_url("http://localhost:1978/node/test1")
|
63
|
+
|
64
|
+
# create a search condition object
|
65
|
+
cond = Condition::new
|
66
|
+
|
67
|
+
# set the search phrase to the search condition object
|
68
|
+
cond.set_phrase("rainbow AND lullaby")
|
69
|
+
|
70
|
+
# get the result of search
|
71
|
+
nres = node.search(cond, 0);
|
72
|
+
if nres
|
73
|
+
# for each document in the result
|
74
|
+
for i in 0...nres.doc_num
|
75
|
+
# get a result document object
|
76
|
+
rdoc = nres.get_doc(i)
|
77
|
+
# display attributes
|
78
|
+
value = rdoc.attr("@uri")
|
79
|
+
printf("URI: %s\n", value) if value
|
80
|
+
value = rdoc.attr("@title")
|
81
|
+
printf("Title: %s\n", value) if value
|
82
|
+
# display the snippet text */
|
83
|
+
printf("%s", rdoc.snippet)
|
84
|
+
end
|
85
|
+
else
|
86
|
+
STDERR.printf("error: %d\n", node.status)
|
87
|
+
end
|
88
|
+
|
89
|
+
== License
|
90
|
+
|
91
|
+
Copyright (C) 2004-2006 Mikio Hirabayashi
|
92
|
+
All rights reserved.
|
93
|
+
|
94
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
95
|
+
|
96
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
97
|
+
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
98
|
+
- Neither the name of Mikio Hirabayashi nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
99
|
+
|
100
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,182 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: ActiveRecord::Acts::Searchable</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">ActiveRecord::Acts::Searchable</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/acts_as_searchable_rb.html">
|
59
|
+
lib/acts_as_searchable.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
Specify this act if you want to provide fulltext search capabilities to
|
78
|
+
your model via Hyper Estraier. This assumes a setup and running Hyper
|
79
|
+
Estraier node accessible through the HTTP API provided by the EstraierPure
|
80
|
+
Ruby module (which is bundled with this plugin).
|
81
|
+
</p>
|
82
|
+
<p>
|
83
|
+
The act supplies appropriate hooks to insert, update and remove documents
|
84
|
+
from the index when you update your model data, create new objects or
|
85
|
+
remove them from your database. For the initial indexing a convenience
|
86
|
+
class method <tt>reindex!</tt> is provided.
|
87
|
+
</p>
|
88
|
+
<p>
|
89
|
+
Example:
|
90
|
+
</p>
|
91
|
+
<pre>
|
92
|
+
class Article < ActiveRecord::Base
|
93
|
+
acts_as_searchable
|
94
|
+
end
|
95
|
+
|
96
|
+
Article.reindex!
|
97
|
+
</pre>
|
98
|
+
<p>
|
99
|
+
As soon as your model data has been indexed you can make use of the
|
100
|
+
<tt>fulltext_search</tt> class method to search the index and get back
|
101
|
+
instantiated matches.
|
102
|
+
</p>
|
103
|
+
<pre>
|
104
|
+
results = Article.fulltext_search('rails')
|
105
|
+
results.size # => 3
|
106
|
+
|
107
|
+
results.first.class # => Article
|
108
|
+
results.first.body # => "Ruby on Rails is an open-source web framework"
|
109
|
+
</pre>
|
110
|
+
<p>
|
111
|
+
Connectivity configuration can be either inherited from conventions or
|
112
|
+
setup globally in the Rails database configuration file
|
113
|
+
<tt>config/database.yml</tt>.
|
114
|
+
</p>
|
115
|
+
<p>
|
116
|
+
Example:
|
117
|
+
</p>
|
118
|
+
<pre>
|
119
|
+
development:
|
120
|
+
adapter: mysql
|
121
|
+
database: rails_development
|
122
|
+
host: localhost
|
123
|
+
user: root
|
124
|
+
password:
|
125
|
+
estraier:
|
126
|
+
host: localhost
|
127
|
+
user: admin
|
128
|
+
password: admin
|
129
|
+
port: 1978
|
130
|
+
node: development
|
131
|
+
</pre>
|
132
|
+
<p>
|
133
|
+
That way you can configure separate connections for each environment. The
|
134
|
+
values shown above represent the defaults. If you don’t need to
|
135
|
+
change any of these it is safe to not specify the <tt>estraier</tt> hash at
|
136
|
+
all.
|
137
|
+
</p>
|
138
|
+
<p>
|
139
|
+
See <a
|
140
|
+
href="Searchable/ClassMethods.html#M000068">ActiveRecord::Acts::Searchable::ClassMethods#acts_as_searchable</a>
|
141
|
+
for per-model configuration options
|
142
|
+
</p>
|
143
|
+
|
144
|
+
</div>
|
145
|
+
|
146
|
+
|
147
|
+
</div>
|
148
|
+
|
149
|
+
|
150
|
+
</div>
|
151
|
+
|
152
|
+
|
153
|
+
<!-- if includes -->
|
154
|
+
|
155
|
+
<div id="section">
|
156
|
+
|
157
|
+
<div id="class-list">
|
158
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
159
|
+
|
160
|
+
Module <a href="Searchable/ActMethods.html" class="link">ActiveRecord::Acts::Searchable::ActMethods</a><br />
|
161
|
+
Module <a href="Searchable/ClassMethods.html" class="link">ActiveRecord::Acts::Searchable::ClassMethods</a><br />
|
162
|
+
|
163
|
+
</div>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<!-- if method_list -->
|
172
|
+
|
173
|
+
|
174
|
+
</div>
|
175
|
+
|
176
|
+
|
177
|
+
<div id="validator-badges">
|
178
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
</body>
|
182
|
+
</html>
|
@@ -0,0 +1,233 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: ActiveRecord::Acts::Searchable::ActMethods</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">ActiveRecord::Acts::Searchable::ActMethods</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../../files/lib/acts_as_searchable_rb.html">
|
59
|
+
lib/acts_as_searchable.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000067">attribute_name</a>
|
84
|
+
<a href="#M000066">changed?</a>
|
85
|
+
<a href="#M000065">estraier_doc</a>
|
86
|
+
<a href="#M000064">update_index</a>
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
|
93
|
+
<!-- if includes -->
|
94
|
+
|
95
|
+
<div id="section">
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
<!-- if method_list -->
|
105
|
+
<div id="methods">
|
106
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
107
|
+
|
108
|
+
<div id="method-M000066" class="method-detail">
|
109
|
+
<a name="M000066"></a>
|
110
|
+
|
111
|
+
<div class="method-heading">
|
112
|
+
<a href="#M000066" class="method-signature">
|
113
|
+
<span class="method-name">changed?</span><span class="method-args">(attr_name = nil)</span>
|
114
|
+
</a>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
<div class="method-description">
|
118
|
+
<p>
|
119
|
+
If called with no parameters, gets whether the current model has changed
|
120
|
+
and needs to updated in the index. If called with a single parameter, gets
|
121
|
+
whether the parameter has changed.
|
122
|
+
</p>
|
123
|
+
<p><a class="source-toggle" href="#"
|
124
|
+
onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
|
125
|
+
<div class="method-source-code" id="M000066-source">
|
126
|
+
<pre>
|
127
|
+
<span class="ruby-comment cmt"># File lib/acts_as_searchable.rb, line 271</span>
|
128
|
+
271: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">changed?</span>(<span class="ruby-identifier">attr_name</span> = <span class="ruby-keyword kw">nil</span>)
|
129
|
+
272: <span class="ruby-identifier">changed_attributes</span> <span class="ruby-keyword kw">and</span> (<span class="ruby-identifier">attr_name</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">?
|
130
|
+
273: </span> (<span class="ruby-keyword kw">not</span> <span class="ruby-identifier">changed_attributes</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">zero?</span>) <span class="ruby-operator">:</span> (<span class="ruby-identifier">changed_attributes</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">attr_name</span>.<span class="ruby-identifier">to_s</span>)) )
|
131
|
+
274: <span class="ruby-keyword kw">end</span>
|
132
|
+
</pre>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<div id="method-M000065" class="method-detail">
|
138
|
+
<a name="M000065"></a>
|
139
|
+
|
140
|
+
<div class="method-heading">
|
141
|
+
<a href="#M000065" class="method-signature">
|
142
|
+
<span class="method-name">estraier_doc</span><span class="method-args">()</span>
|
143
|
+
</a>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="method-description">
|
147
|
+
<p>
|
148
|
+
Retrieve index record for current model object
|
149
|
+
</p>
|
150
|
+
<p><a class="source-toggle" href="#"
|
151
|
+
onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
|
152
|
+
<div class="method-source-code" id="M000065-source">
|
153
|
+
<pre>
|
154
|
+
<span class="ruby-comment cmt"># File lib/acts_as_searchable.rb, line 260</span>
|
155
|
+
260: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">estraier_doc</span>
|
156
|
+
261: <span class="ruby-identifier">cond</span> = <span class="ruby-constant">EstraierPure</span><span class="ruby-operator">::</span><span class="ruby-constant">Condition</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>
|
157
|
+
262: <span class="ruby-identifier">cond</span>.<span class="ruby-identifier">add_attr</span>(<span class="ruby-node">"db_id STREQ #{self.id}"</span>)
|
158
|
+
263: <span class="ruby-identifier">cond</span>.<span class="ruby-identifier">add_attr</span>(<span class="ruby-node">"type STREQ #{self.class.to_s}"</span>)
|
159
|
+
264: <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">estraier_connection</span>.<span class="ruby-identifier">search</span>(<span class="ruby-identifier">cond</span>, <span class="ruby-value">1</span>)
|
160
|
+
265: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">result</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">doc_num</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
161
|
+
266: <span class="ruby-identifier">get_doc_from</span>(<span class="ruby-identifier">result</span>)
|
162
|
+
267: <span class="ruby-keyword kw">end</span>
|
163
|
+
</pre>
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div id="method-M000064" class="method-detail">
|
169
|
+
<a name="M000064"></a>
|
170
|
+
|
171
|
+
<div class="method-heading">
|
172
|
+
<a href="#M000064" class="method-signature">
|
173
|
+
<span class="method-name">update_index</span><span class="method-args">(force = false)</span>
|
174
|
+
</a>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
<div class="method-description">
|
178
|
+
<p>
|
179
|
+
Update index for current instance
|
180
|
+
</p>
|
181
|
+
<p><a class="source-toggle" href="#"
|
182
|
+
onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
|
183
|
+
<div class="method-source-code" id="M000064-source">
|
184
|
+
<pre>
|
185
|
+
<span class="ruby-comment cmt"># File lib/acts_as_searchable.rb, line 253</span>
|
186
|
+
253: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_index</span>(<span class="ruby-identifier">force</span> = <span class="ruby-keyword kw">false</span>)
|
187
|
+
254: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">changed?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">force</span>
|
188
|
+
255: <span class="ruby-identifier">remove_from_index</span>
|
189
|
+
256: <span class="ruby-identifier">add_to_index</span>
|
190
|
+
257: <span class="ruby-keyword kw">end</span>
|
191
|
+
</pre>
|
192
|
+
</div>
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
197
|
+
|
198
|
+
<div id="method-M000067" class="method-detail">
|
199
|
+
<a name="M000067"></a>
|
200
|
+
|
201
|
+
<div class="method-heading">
|
202
|
+
<a href="#M000067" class="method-signature">
|
203
|
+
<span class="method-name">attribute_name</span><span class="method-args">(attribute)</span>
|
204
|
+
</a>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div class="method-description">
|
208
|
+
<p><a class="source-toggle" href="#"
|
209
|
+
onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
|
210
|
+
<div class="method-source-code" id="M000067-source">
|
211
|
+
<pre>
|
212
|
+
<span class="ruby-comment cmt"># File lib/acts_as_searchable.rb, line 324</span>
|
213
|
+
324: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attribute_name</span>(<span class="ruby-identifier">attribute</span>)
|
214
|
+
325: <span class="ruby-constant">EstraierPure</span><span class="ruby-operator">::</span><span class="ruby-constant">SYSTEM_ATTRIBUTES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">attribute</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-operator">?</span> <span class="ruby-node">"@#{attribute}"</span> <span class="ruby-operator">:</span> <span class="ruby-node">"#{attribute}"</span>
|
215
|
+
326: <span class="ruby-keyword kw">end</span>
|
216
|
+
</pre>
|
217
|
+
</div>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
</div>
|
223
|
+
|
224
|
+
|
225
|
+
</div>
|
226
|
+
|
227
|
+
|
228
|
+
<div id="validator-badges">
|
229
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
230
|
+
</div>
|
231
|
+
|
232
|
+
</body>
|
233
|
+
</html>
|