notch8_sunspot_autocomplete 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/LICENSE +7 -0
  2. data/README.rdoc +95 -0
  3. data/Rakefile +37 -0
  4. data/VERSION +1 -0
  5. data/lib/autocomplete_view_helpers.rb +126 -0
  6. data/lib/notch8_sunspot_autocomplete.rb +3 -0
  7. data/lib/sunspot_autocomplete.rb +38 -0
  8. data/notch8_sunspot_autocomplete.gemspec +78 -0
  9. data/rdoc/classes/AutocompleteViewHelpers.html +322 -0
  10. data/rdoc/classes/Sunspot.html +111 -0
  11. data/rdoc/classes/Sunspot/Type.html +112 -0
  12. data/rdoc/classes/Sunspot/Type/AutocompleteType.html +117 -0
  13. data/rdoc/classes/Sunspot/Type/AutosuggestType.html +117 -0
  14. data/rdoc/created.rid +1 -0
  15. data/rdoc/files/README.html +238 -0
  16. data/rdoc/files/README_rdoc.html +238 -0
  17. data/rdoc/files/lib/autocomplete_view_helpers_rb.html +236 -0
  18. data/rdoc/files/lib/sunspot_autocomplete_rb.html +101 -0
  19. data/rdoc/fr_class_index.html +31 -0
  20. data/rdoc/fr_file_index.html +29 -0
  21. data/rdoc/fr_method_index.html +28 -0
  22. data/rdoc/index.html +24 -0
  23. data/rdoc/rdoc-style.css +208 -0
  24. data/tasks/tasks.rake +10 -0
  25. data/test/sunspot_autocomplete_test.rb +21 -0
  26. data/test/test_helper.rb +3 -0
  27. data/vendor/assets/javascripts/jquery.js +6240 -0
  28. data/vendor/assets/javascripts/solr-autocomplete/ajax-solr/core/AbstractManager.js +182 -0
  29. data/vendor/assets/javascripts/solr-autocomplete/ajax-solr/core/Core.js +226 -0
  30. data/vendor/assets/javascripts/solr-autocomplete/ajax-solr/core/Parameter.js +161 -0
  31. data/vendor/assets/javascripts/solr-autocomplete/ajax-solr/core/ParameterStore.js +354 -0
  32. data/vendor/assets/javascripts/solr-autocomplete/ajax-solr/managers/Manager.jquery.js +20 -0
  33. data/vendor/assets/javascripts/solr-autocomplete/jquery-autocomplete/indicator.gif +0 -0
  34. data/vendor/assets/javascripts/solr-autocomplete/jquery-autocomplete/jquery.autocomplete.css +49 -0
  35. data/vendor/assets/javascripts/solr-autocomplete/jquery-autocomplete/jquery.autocomplete.js +867 -0
  36. metadata +114 -0
@@ -0,0 +1,236 @@
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>File: autocomplete_view_helpers.rb</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="fileHeader">
50
+ <h1>autocomplete_view_helpers.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/autocomplete_view_helpers.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Sun Mar 28 16:22:19 +0200 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <h1><a href="../../classes/Sunspot.html">Sunspot</a> Autocomplete</h1>
73
+ <p>
74
+ <a href="../../classes/Sunspot.html">Sunspot</a> Autocomplete is a Rails
75
+ plugin that lets you use Solr and <a
76
+ href="../../classes/Sunspot.html">Sunspot</a> for handy autocompletion of
77
+ your html text inputs.
78
+ </p>
79
+ <h3>Features:</h3>
80
+ <ul>
81
+ <li>Autocomplete: Typing &quot;clo&quot; will yield results that start with
82
+ &quot;clo&quot;, like &quot;cloudy with a chance of meatballs&quot;.
83
+
84
+ </li>
85
+ <li>Autosuggest: Typing &quot;clo&quot; will yield results that contain (or
86
+ start with) &quot;clo&quot;, like &quot;cloudy with a chance of
87
+ meatballs&quot; and &quot;Jumping like Clowns&quot;.
88
+
89
+ </li>
90
+ <li>Both features are case insenitive.
91
+
92
+ </li>
93
+ <li>A CSS based view. You can override some style rules to force your look and
94
+ feel.
95
+
96
+ </li>
97
+ </ul>
98
+ <h2>Prerequisites</h2>
99
+ <p>
100
+ You should have solr, sunspot and sunspot_rails ON and running.
101
+ </p>
102
+ <p>
103
+ <a
104
+ href="http://outoftime.github.com/sunspot">outoftime.github.com/sunspot</a>
105
+ </p>
106
+ <h2>Installation</h2>
107
+ <p>
108
+ Download the plugin and place it under vendor/plugins.
109
+ </p>
110
+ <p>
111
+ Run the following rake task to copy the plugin&#8216;s assets to your
112
+ public directory. This will copy jquery.js and solr-autocompleter to your
113
+ public/javascripts.
114
+ </p>
115
+ <pre>
116
+ rake sunspot_autocomplete:copy_assets
117
+ </pre>
118
+ <h2>Usage</h2>
119
+ <pre>
120
+ In your solr schema.xml, in addition to field types added by sunspot, add the following field types inside the &lt;types&gt; tag:
121
+
122
+ &lt;fieldType name=&quot;autocomplete&quot; class=&quot;solr.TextField&quot; positionIncrementGap=&quot;100&quot;&gt;
123
+ &lt;analyzer type=&quot;index&quot;&gt;
124
+ &lt;tokenizer class=&quot;solr.KeywordTokenizerFactory&quot;/&gt;
125
+ &lt;filter class=&quot;solr.LowerCaseFilterFactory&quot;/&gt;
126
+ &lt;filter class=&quot;solr.EdgeNGramFilterFactory&quot; minGramSize=&quot;1&quot; maxGramSize=&quot;25&quot; /&gt;
127
+ &lt;/analyzer&gt;
128
+ &lt;analyzer type=&quot;query&quot;&gt;
129
+ &lt;tokenizer class=&quot;solr.KeywordTokenizerFactory&quot;/&gt;
130
+ &lt;filter class=&quot;solr.LowerCaseFilterFactory&quot;/&gt;
131
+ &lt;/analyzer&gt;
132
+ &lt;/fieldType&gt;
133
+ &lt;fieldType name=&quot;autosuggest&quot; class=&quot;solr.TextField&quot; positionIncrementGap=&quot;100&quot;&gt;
134
+ &lt;analyzer type=&quot;index&quot;&gt;
135
+ &lt;tokenizer class=&quot;solr.LetterTokenizerFactory&quot;/&gt;
136
+ &lt;filter class=&quot;solr.LowerCaseFilterFactory&quot;/&gt;
137
+ &lt;filter class=&quot;solr.EdgeNGramFilterFactory&quot; minGramSize=&quot;1&quot; maxGramSize=&quot;25&quot; /&gt;
138
+ &lt;/analyzer&gt;
139
+ &lt;analyzer type=&quot;query&quot;&gt;
140
+ &lt;tokenizer class=&quot;solr.LetterTokenizerFactory&quot;/&gt;
141
+ &lt;filter class=&quot;solr.LowerCaseFilterFactory&quot;/&gt;
142
+ &lt;/analyzer&gt;
143
+ &lt;/fieldType&gt;
144
+ </pre>
145
+ <p>
146
+ Also in your solr schema.xml, in addition to fields added by sunspot, add
147
+ the following fields inside thw &lt;fields&gt; tag.
148
+ </p>
149
+ <pre>
150
+ &lt;dynamicField name=&quot;*_ac&quot; type=&quot;autocomplete&quot; indexed=&quot;true&quot; stored=&quot;true&quot;/&gt;
151
+ &lt;dynamicField name=&quot;*_as&quot; type=&quot;autosuggest&quot; indexed=&quot;true&quot; stored=&quot;true&quot;/&gt;
152
+ </pre>
153
+ <p>
154
+ To be able to autocomplete/autosuggest a model&#8216;s attribute, call
155
+ &#8216;autocomplete&#8217;/&#8217;autosuggest&#8217; on it in its
156
+ &#8216;searchable&#8217; block. the field_name used (post_title and
157
+ post_author in the following example) must be unique across all your
158
+ autocomplete fields of the application.
159
+ </p>
160
+ <pre>
161
+ class Post &lt; ActiveRecord::Base
162
+ searchable do
163
+ autocomplete :post_title, :using =&gt; :title
164
+ autosuggest :post_author, :using =&gt; :author
165
+ end
166
+ end
167
+ </pre>
168
+ <p>
169
+ In your view, Add the following script tags (in the given order) to be able
170
+ to use the view helpers.
171
+ </p>
172
+ <pre>
173
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/jquery.js&quot;&gt;&lt;/script&gt;
174
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/solr-autocomplete/ajax-solr/core/Core.js&quot;&gt;&lt;/script&gt;
175
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/solr-autocomplete/ajax-solr/core/AbstractManager.js&quot;&gt;&lt;/script&gt;
176
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/solr-autocomplete/ajax-solr/managers/Manager.jquery.js&quot;&gt;&lt;/script&gt;
177
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/solr-autocomplete/ajax-solr/core/Parameter.js&quot;&gt;&lt;/script&gt;
178
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/solr-autocomplete/ajax-solr/core/ParameterStore.js&quot;&gt;&lt;/script&gt;
179
+ &lt;script type=&quot;text/javascript&quot; src=&quot;/javascripts/solr-autocomplete/jquery-autocomplete/jquery.autocomplete.js&quot;&gt;&lt;/script&gt;
180
+ </pre>
181
+ <p>
182
+ Also, add the following stylesheet to use the basic style included.
183
+ Alternatively, you can override those style rules to force your
184
+ design&#8216;s look and feel.
185
+ </p>
186
+ <pre>
187
+ &lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;/javascripts/solr-autocomplete/jquery-autocomplete/jquery.autocomplete.css&quot; /&gt;
188
+ </pre>
189
+ <p>
190
+ In your view, to create a text field with autocomplete:
191
+ </p>
192
+ <pre>
193
+ &lt;%=autocomplete_text_field &quot;post&quot;, &quot;title&quot;, &quot;http://127.0.0.1:8983/solr/&quot;, &quot;post_title&quot;%&gt;
194
+ </pre>
195
+ <p>
196
+ And to create a text field with autosuggest:
197
+ </p>
198
+ <pre>
199
+ &lt;%=autosuggest_text_field &quot;post&quot;, &quot;author&quot;, &quot;http://127.0.0.1:8983/solr/&quot;, &quot;post_author&quot;%&gt;
200
+ </pre>
201
+ <p>
202
+ You can view documentation for more advanced features of the helpers.
203
+ </p>
204
+
205
+ </div>
206
+
207
+
208
+ </div>
209
+
210
+
211
+ </div>
212
+
213
+
214
+ <!-- if includes -->
215
+
216
+ <div id="section">
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+ <!-- if method_list -->
226
+
227
+
228
+ </div>
229
+
230
+
231
+ <div id="validator-badges">
232
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
233
+ </div>
234
+
235
+ </body>
236
+ </html>
@@ -0,0 +1,101 @@
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>File: sunspot_autocomplete.rb</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="fileHeader">
50
+ <h1>sunspot_autocomplete.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/sunspot_autocomplete.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Thu Mar 25 14:11:52 +0200 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+
73
+ </div>
74
+
75
+
76
+ </div>
77
+
78
+
79
+ <!-- if includes -->
80
+
81
+ <div id="section">
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <!-- if method_list -->
91
+
92
+
93
+ </div>
94
+
95
+
96
+ <div id="validator-badges">
97
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
98
+ </div>
99
+
100
+ </body>
101
+ </html>
@@ -0,0 +1,31 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Classes
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Classes</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Classes</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/AutocompleteViewHelpers.html">AutocompleteViewHelpers</a><br />
24
+ <a href="classes/Sunspot.html">Sunspot</a><br />
25
+ <a href="classes/Sunspot/Type.html">Sunspot::Type</a><br />
26
+ <a href="classes/Sunspot/Type/AutocompleteType.html">Sunspot::Type::AutocompleteType</a><br />
27
+ <a href="classes/Sunspot/Type/AutosuggestType.html">Sunspot::Type::AutosuggestType</a><br />
28
+ </div>
29
+ </div>
30
+ </body>
31
+ </html>
@@ -0,0 +1,29 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Files
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Files</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Files</h1>
22
+ <div id="index-entries">
23
+ <a href="files/README_rdoc.html">README.rdoc</a><br />
24
+ <a href="files/lib/autocomplete_view_helpers_rb.html">lib/autocomplete_view_helpers.rb</a><br />
25
+ <a href="files/lib/sunspot_autocomplete_rb.html">lib/sunspot_autocomplete.rb</a><br />
26
+ </div>
27
+ </div>
28
+ </body>
29
+ </html>
@@ -0,0 +1,28 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Methods
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Methods</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Methods</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/AutocompleteViewHelpers.html#M000001">autocomplete_text_field (AutocompleteViewHelpers)</a><br />
24
+ <a href="classes/AutocompleteViewHelpers.html#M000002">autosuggest_text_field (AutocompleteViewHelpers)</a><br />
25
+ </div>
26
+ </div>
27
+ </body>
28
+ </html>
data/rdoc/index.html ADDED
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
5
+
6
+ <!--
7
+
8
+ Sunspot Autocomplete
9
+
10
+ -->
11
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
+ <head>
13
+ <title>Sunspot Autocomplete</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ </head>
16
+ <frameset rows="20%, 80%">
17
+ <frameset cols="25%,35%,45%">
18
+ <frame src="fr_file_index.html" title="Files" name="Files" />
19
+ <frame src="fr_class_index.html" name="Classes" />
20
+ <frame src="fr_method_index.html" name="Methods" />
21
+ </frameset>
22
+ <frame src="files/README_rdoc.html" name="docwin" />
23
+ </frameset>
24
+ </html>