vinova_sunspot_autocomplete 1.0.1

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.
Files changed (37) hide show
  1. data/LICENSE +7 -0
  2. data/README +91 -0
  3. data/README.rdoc +91 -0
  4. data/Rakefile +37 -0
  5. data/VERSION +1 -0
  6. data/assets/javascripts/jquery.js +6240 -0
  7. data/assets/javascripts/solr-autocomplete/ajax-solr/core/AbstractManager.js +182 -0
  8. data/assets/javascripts/solr-autocomplete/ajax-solr/core/Core.js +226 -0
  9. data/assets/javascripts/solr-autocomplete/ajax-solr/core/Parameter.js +161 -0
  10. data/assets/javascripts/solr-autocomplete/ajax-solr/core/ParameterStore.js +354 -0
  11. data/assets/javascripts/solr-autocomplete/ajax-solr/managers/Manager.jquery.js +20 -0
  12. data/assets/javascripts/solr-autocomplete/jquery-autocomplete/indicator.gif +0 -0
  13. data/assets/javascripts/solr-autocomplete/jquery-autocomplete/jquery.autocomplete.css +49 -0
  14. data/assets/javascripts/solr-autocomplete/jquery-autocomplete/jquery.autocomplete.js +867 -0
  15. data/lib/autocomplete_view_helpers.rb +126 -0
  16. data/lib/sunspot_autocomplete.rb +38 -0
  17. data/rails/init.rb +3 -0
  18. data/rdoc/classes/AutocompleteViewHelpers.html +322 -0
  19. data/rdoc/classes/Sunspot.html +111 -0
  20. data/rdoc/classes/Sunspot/Type.html +112 -0
  21. data/rdoc/classes/Sunspot/Type/AutocompleteType.html +117 -0
  22. data/rdoc/classes/Sunspot/Type/AutosuggestType.html +117 -0
  23. data/rdoc/created.rid +1 -0
  24. data/rdoc/files/README.html +238 -0
  25. data/rdoc/files/README_rdoc.html +238 -0
  26. data/rdoc/files/lib/autocomplete_view_helpers_rb.html +236 -0
  27. data/rdoc/files/lib/sunspot_autocomplete_rb.html +101 -0
  28. data/rdoc/fr_class_index.html +31 -0
  29. data/rdoc/fr_file_index.html +29 -0
  30. data/rdoc/fr_method_index.html +28 -0
  31. data/rdoc/index.html +24 -0
  32. data/rdoc/rdoc-style.css +208 -0
  33. data/tasks/tasks.rake +10 -0
  34. data/test/sunspot_autocomplete_test.rb +21 -0
  35. data/test/test_helper.rb +3 -0
  36. data/vinova_sunspot_autocomplete.gemspec +80 -0
  37. metadata +118 -0
@@ -0,0 +1,126 @@
1
+ #= Sunspot Autocomplete
2
+ #
3
+ #Sunspot Autocomplete is a Rails plugin that lets you use Solr and Sunspot for handy autocompletion of your html text inputs.
4
+ #
5
+ #=== Features:
6
+ #
7
+ #* Autocomplete: Typing "clo" will yield results that start with "clo", like "cloudy with a chance of meatballs".
8
+ #* Autosuggest: Typing "clo" will yield results that contain (or start with) "clo", like "cloudy with a chance of meatballs" and "Jumping like Clowns".
9
+ #* Both features are case insenitive.
10
+ #* A CSS based view. You can override some style rules to force your look and feel.
11
+ #
12
+ #== Prerequisites
13
+ #
14
+ #You should have solr, sunspot and sunspot_rails ON and running.
15
+ #
16
+ #http://outoftime.github.com/sunspot
17
+ #
18
+ #== Installation
19
+ #
20
+ #Download the plugin and place it under vendor/plugins.
21
+ #
22
+ #Run the following rake task to copy the plugin's assets to your public directory. This will copy jquery.js and solr-autocompleter to your public/javascripts.
23
+ #
24
+ # rake sunspot_autocomplete:copy_assets
25
+ #
26
+ #== Usage
27
+ #
28
+ # In your solr schema.xml, in addition to field types added by sunspot, add the following field types inside the <types> tag:
29
+ #
30
+ # <fieldType name="autocomplete" class="solr.TextField" positionIncrementGap="100">
31
+ # <analyzer type="index">
32
+ # <tokenizer class="solr.KeywordTokenizerFactory"/>
33
+ # <filter class="solr.LowerCaseFilterFactory"/>
34
+ # <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="25" />
35
+ # </analyzer>
36
+ # <analyzer type="query">
37
+ # <tokenizer class="solr.KeywordTokenizerFactory"/>
38
+ # <filter class="solr.LowerCaseFilterFactory"/>
39
+ # </analyzer>
40
+ # </fieldType>
41
+ # <fieldType name="autosuggest" class="solr.TextField" positionIncrementGap="100">
42
+ # <analyzer type="index">
43
+ # <tokenizer class="solr.LetterTokenizerFactory"/>
44
+ # <filter class="solr.LowerCaseFilterFactory"/>
45
+ # <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="25" />
46
+ # </analyzer>
47
+ # <analyzer type="query">
48
+ # <tokenizer class="solr.LetterTokenizerFactory"/>
49
+ # <filter class="solr.LowerCaseFilterFactory"/>
50
+ # </analyzer>
51
+ # </fieldType>
52
+ #
53
+ #Also in your solr schema.xml, in addition to fields added by sunspot, add the following fields inside thw <fields> tag.
54
+ #
55
+ # <dynamicField name="*_ac" type="autocomplete" indexed="true" stored="true"/>
56
+ # <dynamicField name="*_as" type="autosuggest" indexed="true" stored="true"/>
57
+ #
58
+ #To be able to autocomplete/autosuggest a model's attribute, call 'autocomplete'/'autosuggest' on it in its 'searchable' block. the field_name used (post_title and post_author in the following example) must be unique across all your autocomplete fields of the application.
59
+ #
60
+ # class Post < ActiveRecord::Base
61
+ # searchable do
62
+ # autocomplete :post_title, :using => :title
63
+ # autosuggest :post_author, :using => :author
64
+ # end
65
+ # end
66
+ #
67
+ #In your view, Add the following script tags (in the given order) to be able to use the view helpers.
68
+ #
69
+ # <script type="text/javascript" src="/javascripts/jquery.js"></script>
70
+ # <script type="text/javascript" src="/javascripts/solr-autocomplete/ajax-solr/core/Core.js"></script>
71
+ # <script type="text/javascript" src="/javascripts/solr-autocomplete/ajax-solr/core/AbstractManager.js"></script>
72
+ # <script type="text/javascript" src="/javascripts/solr-autocomplete/ajax-solr/managers/Manager.jquery.js"></script>
73
+ # <script type="text/javascript" src="/javascripts/solr-autocomplete/ajax-solr/core/Parameter.js"></script>
74
+ # <script type="text/javascript" src="/javascripts/solr-autocomplete/ajax-solr/core/ParameterStore.js"></script>
75
+ # <script type="text/javascript" src="/javascripts/solr-autocomplete/jquery-autocomplete/jquery.autocomplete.js"></script>
76
+ #
77
+ #Also, add the following stylesheet to use the basic style included. Alternatively, you can override those style rules to force your design's look and feel.
78
+ #
79
+ # <link type="text/css" rel="stylesheet" href="/javascripts/solr-autocomplete/jquery-autocomplete/jquery.autocomplete.css" />
80
+ #
81
+ #In your view, to create a text field with autocomplete:
82
+ #
83
+ # <%=autocomplete_text_field "post", "title", "http://127.0.0.1:8983/solr/", "post_title"%>
84
+ #
85
+ #And to create a text field with autosuggest:
86
+ #
87
+ # <%=autosuggest_text_field "post", "author", "http://127.0.0.1:8983/solr/", "post_author"%>
88
+ #
89
+ #You can view documentation for more advanced features of the helpers.
90
+ #
91
+ #
92
+ module AutocompleteViewHelpers
93
+
94
+ # Generates a text input using the given <code>object_name</code> and <code>method</code>.
95
+ # The generated text field autocompletes given <code>solr_url</code>: the url to your solr instance (e.g. http://127.0.0.1:8983/solr/)
96
+ # Autocompletion is fetching results that only begins with the given part of word.
97
+ # <code>autocomplete_field_name</code> is the unique field_name assigned in your model's searchable block
98
+ # <code>html_options</code> are regular HTML options like :class and :id
99
+ # <code>autocomplete_options</code> are advanced options for autocompletion http://docs.jquery.com/Plugins/Autocomplete/autocomplete#toptions
100
+ def autocomplete_text_field(object_name, method, solr_url, autocomplete_field_name, html_options={}, autocomplete_options={})
101
+ autocomplete_stub object_name, method, solr_url, autocomplete_field_name, false, html_options, autocomplete_options
102
+ end
103
+
104
+ # Generates a text input using the given <code>object_name</code> and <code>method</code>.
105
+ # The generated text field autosuggests given <code>solr_url</code>: the url to your solr instance (e.g. http://127.0.0.1:8983/solr/)
106
+ # Autosuggestion is fetching results that begins with/ends with/contains the given part of word.
107
+ # <code>autocomplete_field_name</code> is the unique field_name assigned in your model's searchable block
108
+ # <code>html_options</code> are regular HTML options like :class and :id
109
+ # <code>autocomplete_options</code> are advanced options for autocompletion http://docs.jquery.com/Plugins/Autocomplete/autocomplete#toptions
110
+ def autosuggest_text_field(object_name, method, solr_url, autocomplete_field_name, html_options={}, autocomplete_options={})
111
+ autocomplete_stub object_name, method, solr_url, autocomplete_field_name, true, html_options, autocomplete_options
112
+ end
113
+
114
+ private
115
+
116
+ def autocomplete_stub(object_name, method, url, field_name, suggest=false, html_options={}, autocomplete_options={})
117
+ ac_js_options = "{" + autocomplete_options.collect{|k,v| "#{k.to_s}: #{ v.kind_of?(Numeric) ? v : "'" + v + "'" }"}.join(" , ") + "}"
118
+ result = []
119
+ result << text_field(object_name, method, html_options)
120
+ result << "<script>$('##{object_name}_#{method}').#{suggest ? 'autosuggest' : 'autocomplete'}('#{url.ends_with?('/') ? url : url + '/'}', '#{field_name}', #{ac_js_options});</script>"
121
+ result.join " "
122
+ end
123
+
124
+ end
125
+
126
+ ActiveSupport.on_load(:action_view) { include AutocompleteViewHelpers }
@@ -0,0 +1,38 @@
1
+ require "sunspot"
2
+
3
+ module Sunspot
4
+ module Type
5
+
6
+ #Auto Completion
7
+ class AutocompleteType < AbstractType
8
+ def indexed_name(name) #:nodoc:
9
+ "#{name}_ac"
10
+ end
11
+
12
+ def to_indexed(value) #:nodoc:
13
+ value.to_s if value
14
+ end
15
+
16
+ def cast(string) #:nodoc:
17
+ string
18
+ end
19
+ end
20
+
21
+ #Auto Suggestion
22
+ class AutosuggestType < AbstractType
23
+ def indexed_name(name) #:nodoc:
24
+ "#{name}_as"
25
+ end
26
+
27
+ def to_indexed(value) #:nodoc:
28
+ value.to_s if value
29
+ end
30
+
31
+ def cast(string) #:nodoc:
32
+ string
33
+ end
34
+ end
35
+
36
+
37
+ end
38
+ end
data/rails/init.rb ADDED
@@ -0,0 +1,3 @@
1
+ require "sunspot"
2
+ require File.join(File.dirname(__FILE__), *%w{.. lib sunspot_autocomplete})
3
+ require File.join(File.dirname(__FILE__), *%w{.. lib autocomplete_view_helpers})
@@ -0,0 +1,322 @@
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: AutocompleteViewHelpers</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">AutocompleteViewHelpers</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/autocomplete_view_helpers_rb.html">
59
+ lib/autocomplete_view_helpers.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
+ <h1><a href="Sunspot.html">Sunspot</a> Autocomplete</h1>
77
+ <p>
78
+ <a href="Sunspot.html">Sunspot</a> Autocomplete is a Rails plugin that lets
79
+ you use Solr and <a href="Sunspot.html">Sunspot</a> for handy
80
+ autocompletion of your html text inputs.
81
+ </p>
82
+ <h3>Features:</h3>
83
+ <ul>
84
+ <li>Autocomplete: Typing &quot;clo&quot; will yield results that start with
85
+ &quot;clo&quot;, like &quot;cloudy with a chance of meatballs&quot;.
86
+
87
+ </li>
88
+ <li>Autosuggest: Typing &quot;clo&quot; will yield results that contain (or
89
+ start with) &quot;clo&quot;, like &quot;cloudy with a chance of
90
+ meatballs&quot; and &quot;Jumping like Clowns&quot;.
91
+
92
+ </li>
93
+ <li>Both features are case insenitive.
94
+
95
+ </li>
96
+ <li>A CSS based view. You can override some style rules to force your look and
97
+ feel.
98
+
99
+ </li>
100
+ </ul>
101
+ <h2>Prerequisites</h2>
102
+ <p>
103
+ You should have solr, sunspot and sunspot_rails ON and running.
104
+ </p>
105
+ <p>
106
+ <a
107
+ href="http://outoftime.github.com/sunspot">outoftime.github.com/sunspot</a>
108
+ </p>
109
+ <h2>Installation</h2>
110
+ <p>
111
+ Download the plugin and place it under vendor/plugins.
112
+ </p>
113
+ <p>
114
+ Run the following rake task to copy the plugin&#8216;s assets to your
115
+ public directory. This will copy jquery.js and solr-autocompleter to your
116
+ public/javascripts.
117
+ </p>
118
+ <pre>
119
+ rake sunspot_autocomplete:copy_assets
120
+ </pre>
121
+ <h2>Usage</h2>
122
+ <pre>
123
+ In your solr schema.xml, in addition to field types added by sunspot, add the following field types inside the &lt;types&gt; tag:
124
+
125
+ &lt;fieldType name=&quot;autocomplete&quot; class=&quot;solr.TextField&quot; positionIncrementGap=&quot;100&quot;&gt;
126
+ &lt;analyzer type=&quot;index&quot;&gt;
127
+ &lt;tokenizer class=&quot;solr.KeywordTokenizerFactory&quot;/&gt;
128
+ &lt;filter class=&quot;solr.LowerCaseFilterFactory&quot;/&gt;
129
+ &lt;filter class=&quot;solr.EdgeNGramFilterFactory&quot; minGramSize=&quot;1&quot; maxGramSize=&quot;25&quot; /&gt;
130
+ &lt;/analyzer&gt;
131
+ &lt;analyzer type=&quot;query&quot;&gt;
132
+ &lt;tokenizer class=&quot;solr.KeywordTokenizerFactory&quot;/&gt;
133
+ &lt;filter class=&quot;solr.LowerCaseFilterFactory&quot;/&gt;
134
+ &lt;/analyzer&gt;
135
+ &lt;/fieldType&gt;
136
+ &lt;fieldType name=&quot;autosuggest&quot; class=&quot;solr.TextField&quot; positionIncrementGap=&quot;100&quot;&gt;
137
+ &lt;analyzer type=&quot;index&quot;&gt;
138
+ &lt;tokenizer class=&quot;solr.LetterTokenizerFactory&quot;/&gt;
139
+ &lt;filter class=&quot;solr.LowerCaseFilterFactory&quot;/&gt;
140
+ &lt;filter class=&quot;solr.EdgeNGramFilterFactory&quot; minGramSize=&quot;1&quot; maxGramSize=&quot;25&quot; /&gt;
141
+ &lt;/analyzer&gt;
142
+ &lt;analyzer type=&quot;query&quot;&gt;
143
+ &lt;tokenizer class=&quot;solr.LetterTokenizerFactory&quot;/&gt;
144
+ &lt;filter class=&quot;solr.LowerCaseFilterFactory&quot;/&gt;
145
+ &lt;/analyzer&gt;
146
+ &lt;/fieldType&gt;
147
+ </pre>
148
+ <p>
149
+ Also in your solr schema.xml, in addition to fields added by sunspot, add
150
+ the following fields inside thw &lt;fields&gt; tag.
151
+ </p>
152
+ <pre>
153
+ &lt;dynamicField name=&quot;*_ac&quot; type=&quot;autocomplete&quot; indexed=&quot;true&quot; stored=&quot;true&quot;/&gt;
154
+ &lt;dynamicField name=&quot;*_as&quot; type=&quot;autosuggest&quot; indexed=&quot;true&quot; stored=&quot;true&quot;/&gt;
155
+ </pre>
156
+ <p>
157
+ To be able to autocomplete/autosuggest a model&#8216;s attribute, call
158
+ &#8216;autocomplete&#8217;/&#8217;autosuggest&#8217; on it in its
159
+ &#8216;searchable&#8217; block. the field_name used (post_title and
160
+ post_author in the following example) must be unique across all your
161
+ autocomplete fields of the application.
162
+ </p>
163
+ <pre>
164
+ class Post &lt; ActiveRecord::Base
165
+ searchable do
166
+ autocomplete :post_title, :using =&gt; :title
167
+ autosuggest :post_author, :using =&gt; :author
168
+ end
169
+ end
170
+ </pre>
171
+ <p>
172
+ In your view, Add the following script tags (in the given order) to be able
173
+ to use the view helpers.
174
+ </p>
175
+ <pre>
176
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/jquery.js&quot;&gt;&lt;/script&gt;
177
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/solr-autocomplete/ajax-solr/core/Core.js&quot;&gt;&lt;/script&gt;
178
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/solr-autocomplete/ajax-solr/core/AbstractManager.js&quot;&gt;&lt;/script&gt;
179
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/solr-autocomplete/ajax-solr/managers/Manager.jquery.js&quot;&gt;&lt;/script&gt;
180
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/solr-autocomplete/ajax-solr/core/Parameter.js&quot;&gt;&lt;/script&gt;
181
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/solr-autocomplete/ajax-solr/core/ParameterStore.js&quot;&gt;&lt;/script&gt;
182
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/solr-autocomplete/jquery-autocomplete/jquery.autocomplete.js&quot;&gt;&lt;/script&gt;
183
+ </pre>
184
+ <p>
185
+ Also, add the following stylesheet to use the basic style included.
186
+ Alternatively, you can override those style rules to force your
187
+ design&#8216;s look and feel.
188
+ </p>
189
+ <pre>
190
+ &lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;/javascripts/solr-autocomplete/jquery-autocomplete/jquery.autocomplete.css&quot; /&gt;
191
+ </pre>
192
+ <p>
193
+ In your view, to create a text field with autocomplete:
194
+ </p>
195
+ <pre>
196
+ &lt;%=autocomplete_text_field &quot;post&quot;, &quot;title&quot;, &quot;http://127.0.0.1:8983/solr/&quot;, &quot;post_title&quot;%&gt;
197
+ </pre>
198
+ <p>
199
+ And to create a text field with autosuggest:
200
+ </p>
201
+ <pre>
202
+ &lt;%=autosuggest_text_field &quot;post&quot;, &quot;author&quot;, &quot;http://127.0.0.1:8983/solr/&quot;, &quot;post_author&quot;%&gt;
203
+ </pre>
204
+ <p>
205
+ You can view documentation for more advanced features of the helpers.
206
+ </p>
207
+
208
+ </div>
209
+
210
+
211
+ </div>
212
+
213
+ <div id="method-list">
214
+ <h3 class="section-bar">Methods</h3>
215
+
216
+ <div class="name-list">
217
+ <a href="#M000001">autocomplete_text_field</a>&nbsp;&nbsp;
218
+ <a href="#M000002">autosuggest_text_field</a>&nbsp;&nbsp;
219
+ </div>
220
+ </div>
221
+
222
+ </div>
223
+
224
+
225
+ <!-- if includes -->
226
+
227
+ <div id="section">
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+ <!-- if method_list -->
237
+ <div id="methods">
238
+ <h3 class="section-bar">Public Instance methods</h3>
239
+
240
+ <div id="method-M000001" class="method-detail">
241
+ <a name="M000001"></a>
242
+
243
+ <div class="method-heading">
244
+ <a href="#M000001" class="method-signature">
245
+ <span class="method-name">autocomplete_text_field</span><span class="method-args">(object_name, method, solr_url, autocomplete_field_name, html_options={}, autocomplete_options={})</span>
246
+ </a>
247
+ </div>
248
+
249
+ <div class="method-description">
250
+ <p>
251
+ Generates a text input using the given <tt>object_name</tt> and
252
+ <tt>method</tt>. The generated text field autocompletes given
253
+ <tt>solr_url</tt>: the url to your solr instance (e.g. <a
254
+ href="http://127.0.0.1:8983/solr">127.0.0.1:8983/solr</a>/) Autocompletion
255
+ is fetching results that only begins with the given part of word.
256
+ <tt>autocomplete_field_name</tt> is the unique field_name assigned in your
257
+ model&#8216;s searchable block <tt>html_options</tt> are regular HTML
258
+ options like :class and :id <tt>autocomplete_options</tt> are advanced
259
+ options for autocompletion <a
260
+ href="http://docs.jquery.com/Plugins/Autocomplete/autocomplete#toptions">docs.jquery.com/Plugins/Autocomplete/autocomplete#toptions</a>
261
+ </p>
262
+ <p><a class="source-toggle" href="#"
263
+ onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
264
+ <div class="method-source-code" id="M000001-source">
265
+ <pre>
266
+ <span class="ruby-comment cmt"># File lib/autocomplete_view_helpers.rb, line 100</span>
267
+ 100: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">autocomplete_text_field</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">solr_url</span>, <span class="ruby-identifier">autocomplete_field_name</span>, <span class="ruby-identifier">html_options</span>={}, <span class="ruby-identifier">autocomplete_options</span>={})
268
+ 101: <span class="ruby-identifier">autocomplete_stub</span> <span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">solr_url</span>, <span class="ruby-identifier">autocomplete_field_name</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">html_options</span>, <span class="ruby-identifier">autocomplete_options</span>
269
+ 102: <span class="ruby-keyword kw">end</span>
270
+ </pre>
271
+ </div>
272
+ </div>
273
+ </div>
274
+
275
+ <div id="method-M000002" class="method-detail">
276
+ <a name="M000002"></a>
277
+
278
+ <div class="method-heading">
279
+ <a href="#M000002" class="method-signature">
280
+ <span class="method-name">autosuggest_text_field</span><span class="method-args">(object_name, method, solr_url, autocomplete_field_name, html_options={}, autocomplete_options={})</span>
281
+ </a>
282
+ </div>
283
+
284
+ <div class="method-description">
285
+ <p>
286
+ Generates a text input using the given <tt>object_name</tt> and
287
+ <tt>method</tt>. The generated text field autosuggests given
288
+ <tt>solr_url</tt>: the url to your solr instance (e.g. <a
289
+ href="http://127.0.0.1:8983/solr">127.0.0.1:8983/solr</a>/) Autosuggestion
290
+ is fetching results that begins with/ends with/contains the given part of
291
+ word. <tt>autocomplete_field_name</tt> is the unique field_name assigned in
292
+ your model&#8216;s searchable block <tt>html_options</tt> are regular HTML
293
+ options like :class and :id <tt>autocomplete_options</tt> are advanced
294
+ options for autocompletion <a
295
+ href="http://docs.jquery.com/Plugins/Autocomplete/autocomplete#toptions">docs.jquery.com/Plugins/Autocomplete/autocomplete#toptions</a>
296
+ </p>
297
+ <p><a class="source-toggle" href="#"
298
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
299
+ <div class="method-source-code" id="M000002-source">
300
+ <pre>
301
+ <span class="ruby-comment cmt"># File lib/autocomplete_view_helpers.rb, line 110</span>
302
+ 110: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">autosuggest_text_field</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">solr_url</span>, <span class="ruby-identifier">autocomplete_field_name</span>, <span class="ruby-identifier">html_options</span>={}, <span class="ruby-identifier">autocomplete_options</span>={})
303
+ 111: <span class="ruby-identifier">autocomplete_stub</span> <span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">solr_url</span>, <span class="ruby-identifier">autocomplete_field_name</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">html_options</span>, <span class="ruby-identifier">autocomplete_options</span>
304
+ 112: <span class="ruby-keyword kw">end</span>
305
+ </pre>
306
+ </div>
307
+ </div>
308
+ </div>
309
+
310
+
311
+ </div>
312
+
313
+
314
+ </div>
315
+
316
+
317
+ <div id="validator-badges">
318
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
319
+ </div>
320
+
321
+ </body>
322
+ </html>