acts_as_solr 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/.gitignore +8 -0
  2. data/CHANGE_LOG +233 -0
  3. data/FORKED_CHANGES +3 -0
  4. data/LICENSE +19 -0
  5. data/README.markdown +94 -0
  6. data/README.rdoc +84 -0
  7. data/Rakefile +57 -0
  8. data/TESTING_THE_PLUGIN +25 -0
  9. data/VERSION +1 -0
  10. data/acts_as_solr.gemspec +237 -0
  11. data/config/solr.yml +15 -0
  12. data/config/solr_environment.rb +22 -0
  13. data/init.rb +21 -0
  14. data/install.rb +11 -0
  15. data/lib/acts_as_solr.rb +61 -0
  16. data/lib/acts_methods.rb +284 -0
  17. data/lib/class_methods.rb +239 -0
  18. data/lib/common_methods.rb +89 -0
  19. data/lib/deprecation.rb +61 -0
  20. data/lib/instance_methods.rb +181 -0
  21. data/lib/lazy_document.rb +18 -0
  22. data/lib/parser_methods.rb +230 -0
  23. data/lib/search_results.rb +69 -0
  24. data/lib/solr/connection.rb +191 -0
  25. data/lib/solr/document.rb +78 -0
  26. data/lib/solr/exception.rb +13 -0
  27. data/lib/solr/field.rb +39 -0
  28. data/lib/solr/importer/array_mapper.rb +26 -0
  29. data/lib/solr/importer/delimited_file_source.rb +38 -0
  30. data/lib/solr/importer/hpricot_mapper.rb +27 -0
  31. data/lib/solr/importer/mapper.rb +51 -0
  32. data/lib/solr/importer/solr_source.rb +43 -0
  33. data/lib/solr/importer/xpath_mapper.rb +35 -0
  34. data/lib/solr/importer.rb +19 -0
  35. data/lib/solr/indexer.rb +52 -0
  36. data/lib/solr/request/add_document.rb +63 -0
  37. data/lib/solr/request/base.rb +36 -0
  38. data/lib/solr/request/commit.rb +31 -0
  39. data/lib/solr/request/delete.rb +50 -0
  40. data/lib/solr/request/dismax.rb +46 -0
  41. data/lib/solr/request/index_info.rb +22 -0
  42. data/lib/solr/request/modify_document.rb +51 -0
  43. data/lib/solr/request/optimize.rb +21 -0
  44. data/lib/solr/request/ping.rb +36 -0
  45. data/lib/solr/request/select.rb +56 -0
  46. data/lib/solr/request/spellcheck.rb +30 -0
  47. data/lib/solr/request/standard.rb +402 -0
  48. data/lib/solr/request/update.rb +23 -0
  49. data/lib/solr/request.rb +26 -0
  50. data/lib/solr/response/add_document.rb +17 -0
  51. data/lib/solr/response/base.rb +42 -0
  52. data/lib/solr/response/commit.rb +17 -0
  53. data/lib/solr/response/delete.rb +13 -0
  54. data/lib/solr/response/dismax.rb +8 -0
  55. data/lib/solr/response/index_info.rb +26 -0
  56. data/lib/solr/response/modify_document.rb +17 -0
  57. data/lib/solr/response/optimize.rb +14 -0
  58. data/lib/solr/response/ping.rb +28 -0
  59. data/lib/solr/response/ruby.rb +42 -0
  60. data/lib/solr/response/select.rb +17 -0
  61. data/lib/solr/response/spellcheck.rb +20 -0
  62. data/lib/solr/response/standard.rb +64 -0
  63. data/lib/solr/response/xml.rb +42 -0
  64. data/lib/solr/response.rb +27 -0
  65. data/lib/solr/solrtasks.rb +27 -0
  66. data/lib/solr/util.rb +32 -0
  67. data/lib/solr/xml.rb +44 -0
  68. data/lib/solr.rb +21 -0
  69. data/lib/solr_fixtures.rb +13 -0
  70. data/lib/tasks/database.rake +18 -0
  71. data/lib/tasks/solr.rake +137 -0
  72. data/lib/tasks/test.rake +7 -0
  73. data/lib/will_paginate_support.rb +12 -0
  74. data/solr/CHANGES.txt +1207 -0
  75. data/solr/LICENSE.txt +712 -0
  76. data/solr/NOTICE.txt +90 -0
  77. data/solr/etc/jetty.xml +205 -0
  78. data/solr/etc/webdefault.xml +379 -0
  79. data/solr/lib/easymock.jar +0 -0
  80. data/solr/lib/jetty-6.1.3.jar +0 -0
  81. data/solr/lib/jetty-util-6.1.3.jar +0 -0
  82. data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  83. data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  84. data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
  85. data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  86. data/solr/lib/servlet-api-2.4.jar +0 -0
  87. data/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
  88. data/solr/lib/xpp3-1.1.3.4.O.jar +0 -0
  89. data/solr/logs/.empty-dir-for-git +0 -0
  90. data/solr/solr/README.txt +52 -0
  91. data/solr/solr/bin/abc +176 -0
  92. data/solr/solr/bin/abo +176 -0
  93. data/solr/solr/bin/backup +108 -0
  94. data/solr/solr/bin/backupcleaner +142 -0
  95. data/solr/solr/bin/commit +128 -0
  96. data/solr/solr/bin/optimize +129 -0
  97. data/solr/solr/bin/readercycle +129 -0
  98. data/solr/solr/bin/rsyncd-disable +77 -0
  99. data/solr/solr/bin/rsyncd-enable +76 -0
  100. data/solr/solr/bin/rsyncd-start +145 -0
  101. data/solr/solr/bin/rsyncd-stop +105 -0
  102. data/solr/solr/bin/scripts-util +83 -0
  103. data/solr/solr/bin/snapcleaner +148 -0
  104. data/solr/solr/bin/snapinstaller +168 -0
  105. data/solr/solr/bin/snappuller +248 -0
  106. data/solr/solr/bin/snappuller-disable +77 -0
  107. data/solr/solr/bin/snappuller-enable +77 -0
  108. data/solr/solr/bin/snapshooter +109 -0
  109. data/solr/solr/conf/admin-extra.html +31 -0
  110. data/solr/solr/conf/protwords.txt +21 -0
  111. data/solr/solr/conf/schema.xml +126 -0
  112. data/solr/solr/conf/scripts.conf +24 -0
  113. data/solr/solr/conf/solrconfig.xml +458 -0
  114. data/solr/solr/conf/stopwords.txt +57 -0
  115. data/solr/solr/conf/synonyms.txt +31 -0
  116. data/solr/solr/conf/xslt/example.xsl +132 -0
  117. data/solr/solr/conf/xslt/example_atom.xsl +63 -0
  118. data/solr/solr/conf/xslt/example_rss.xsl +62 -0
  119. data/solr/start.jar +0 -0
  120. data/solr/tmp/.empty-dir-for-git +0 -0
  121. data/solr/webapps/solr.war +0 -0
  122. data/test/config/solr.yml +2 -0
  123. data/test/db/connections/mysql/connection.rb +10 -0
  124. data/test/db/connections/sqlite/connection.rb +8 -0
  125. data/test/db/migrate/001_create_books.rb +15 -0
  126. data/test/db/migrate/002_create_movies.rb +12 -0
  127. data/test/db/migrate/003_create_categories.rb +11 -0
  128. data/test/db/migrate/004_create_electronics.rb +16 -0
  129. data/test/db/migrate/005_create_authors.rb +12 -0
  130. data/test/db/migrate/006_create_postings.rb +9 -0
  131. data/test/db/migrate/007_create_posts.rb +13 -0
  132. data/test/db/migrate/008_create_gadgets.rb +11 -0
  133. data/test/fixtures/authors.yml +9 -0
  134. data/test/fixtures/books.yml +13 -0
  135. data/test/fixtures/categories.yml +7 -0
  136. data/test/fixtures/db_definitions/mysql.sql +41 -0
  137. data/test/fixtures/electronics.yml +49 -0
  138. data/test/fixtures/movies.yml +9 -0
  139. data/test/fixtures/postings.yml +10 -0
  140. data/test/functional/acts_as_solr_test.rb +413 -0
  141. data/test/functional/association_indexing_test.rb +37 -0
  142. data/test/functional/faceted_search_test.rb +163 -0
  143. data/test/functional/multi_solr_search_test.rb +51 -0
  144. data/test/models/author.rb +10 -0
  145. data/test/models/book.rb +10 -0
  146. data/test/models/category.rb +8 -0
  147. data/test/models/electronic.rb +21 -0
  148. data/test/models/gadget.rb +9 -0
  149. data/test/models/movie.rb +17 -0
  150. data/test/models/novel.rb +2 -0
  151. data/test/models/post.rb +3 -0
  152. data/test/models/posting.rb +11 -0
  153. data/test/test_helper.rb +51 -0
  154. data/test/unit/acts_methods_shoulda.rb +70 -0
  155. data/test/unit/class_methods_shoulda.rb +90 -0
  156. data/test/unit/common_methods_shoulda.rb +112 -0
  157. data/test/unit/instance_methods_shoulda.rb +326 -0
  158. data/test/unit/lazy_document_shoulda.rb +35 -0
  159. data/test/unit/parser_instance.rb +19 -0
  160. data/test/unit/parser_methods_shoulda.rb +279 -0
  161. data/test/unit/solr_instance.rb +46 -0
  162. data/test/unit/test_helper.rb +26 -0
  163. metadata +259 -0
data/solr/NOTICE.txt ADDED
@@ -0,0 +1,90 @@
1
+ ==============================================================
2
+ Apache Solr
3
+ Copyright 2006-2008 The Apache Software Foundation
4
+ ==============================================================
5
+
6
+ This product includes software developed by
7
+ The Apache Software Foundation (http://www.apache.org/).
8
+
9
+ Includes software from other Apache Software Foundation projects,
10
+ including, but not limited to:
11
+ - Apache Lucene Java
12
+ - Apache Tomcat (lib/servlet-api-2.4.jar)
13
+ - Apache Commons
14
+ - Apache Geronimo (stax API jar)
15
+
16
+ This product includes tests written with EasyMock Copyright 2001-2007
17
+ Tammo Freese (http://www.easymock.org/)
18
+
19
+ This product includes the JQuery JavaScript library created by John Resig.
20
+ Copyright (c) 2008 John Resig, http://jquery.com/
21
+
22
+ This product includes the stax-utils jar: https://stax-utils.dev.java.net/
23
+ Copyright (c) 2004, Christian Niles, unit12.net
24
+ Copyright (c) 2004, Sun Microsystems, Inc.
25
+ Copyright (c) 2006, John Kristian
26
+ License: The BSD License (http://www.opensource.org/licenses/bsd-license.php)
27
+
28
+ This product includes a JUnit jar: http://junit.sourceforge.net/
29
+ License: Common Public License - v 1.0 (http://junit.sourceforge.net/cpl-v10.html)
30
+
31
+ =========================================================================
32
+ == Apache Lucene Notice ==
33
+ =========================================================================
34
+ The snowball stemmers in
35
+ contrib/snowball/src/java/net/sf/snowball
36
+ were developed by Martin Porter and Richard Boulton.
37
+ The full snowball package is available from
38
+ http://snowball.tartarus.org/
39
+ ---
40
+
41
+ This product includes/uses software, Woodstox (http://woodstox.codehaus.org),
42
+ developed by Codehaus (http://www.codehaus.org/)
43
+ License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
44
+ =========================================================================
45
+ == Woodstox Notice ==
46
+ =========================================================================
47
+ This product currently only contains code developed by authors
48
+ of specific components, as identified by the source code files.
49
+
50
+ Since product implements StAX API, it has dependencies to StAX API
51
+ classes.
52
+
53
+ For additional credits (generally to people who reported problems)
54
+ see CREDITS file.
55
+ ---
56
+
57
+ This product includes software developed by Mort Bay Consulting
58
+ (specifically, Jetty 6.1.3, the bundled servlet container in example)
59
+ The jboss integration module is not included.
60
+ =========================================================================
61
+ == Jetty Notice ==
62
+ =========================================================================
63
+ ==============================================================
64
+ Jetty Web Container
65
+ Copyright 1995-2006 Mort Bay Consulting Pty Ltd
66
+ ==============================================================
67
+
68
+ This product includes some software developed at The Apache Software
69
+ Foundation (http://www.apache.org/).
70
+
71
+ The javax.servlet package used by Jetty is copyright
72
+ Sun Microsystems, Inc and Apache Software Foundation. It is
73
+ distributed under the Common Development and Distribution License.
74
+ You can obtain a copy of the license at
75
+ https://glassfish.dev.java.net/public/CDDLv1.0.html.
76
+
77
+ The UnixCrypt.java code ~Implements the one way cryptography used by
78
+ Unix systems for simple password protection. Copyright 1996 Aki Yoshida,
79
+ modified April 2001 by Iris Van den Broeke, Daniel Deville.
80
+
81
+ The default JSP implementation is provided by the Glassfish JSP engine
82
+ from project Glassfish http://glassfish.dev.java.net. Copyright 2005
83
+ Sun Microsystems, Inc. and portions Copyright Apache Software Foundation.
84
+
85
+ Some portions of the code are Copyright:
86
+ 2006 Tim Vernum
87
+ 1999 Jason Gilbert.
88
+
89
+ The jboss integration module contains some LGPL code.
90
+ ---
@@ -0,0 +1,205 @@
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
3
+
4
+ <!-- =============================================================== -->
5
+ <!-- Configure the Jetty Server -->
6
+ <!-- -->
7
+ <!-- Documentation of this file format can be found at: -->
8
+ <!-- http://docs.codehaus.org/display/JETTY/jetty.xml -->
9
+ <!-- -->
10
+ <!-- =============================================================== -->
11
+
12
+
13
+ <Configure id="Server" class="org.mortbay.jetty.Server">
14
+
15
+ <!-- =========================================================== -->
16
+ <!-- Server Thread Pool -->
17
+ <!-- =========================================================== -->
18
+ <Set name="ThreadPool">
19
+ <!-- Default bounded blocking threadpool
20
+ -->
21
+ <New class="org.mortbay.thread.BoundedThreadPool">
22
+ <Set name="minThreads">10</Set>
23
+ <Set name="lowThreads">50</Set>
24
+ <Set name="maxThreads">250</Set>
25
+ </New>
26
+
27
+ <!-- Optional Java 5 bounded threadpool with job queue
28
+ <New class="org.mortbay.thread.concurrent.ThreadPool">
29
+ <Arg type="int">0</Arg>
30
+ <Set name="corePoolSize">10</Set>
31
+ <Set name="maximumPoolSize">250</Set>
32
+ </New>
33
+ -->
34
+ </Set>
35
+
36
+
37
+
38
+ <!-- =========================================================== -->
39
+ <!-- Set connectors -->
40
+ <!-- =========================================================== -->
41
+ <!-- One of each type! -->
42
+ <!-- =========================================================== -->
43
+
44
+ <!-- Use this connector for many frequently idle connections
45
+ and for threadless continuations. -->
46
+ <!-- <Call name="addConnector">
47
+ <Arg>
48
+ <New class="org.mortbay.jetty.nio.SelectChannelConnector">
49
+ <Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
50
+ <Set name="maxIdleTime">30000</Set>
51
+ <Set name="Acceptors">2</Set>
52
+ <Set name="confidentialPort">8443</Set>
53
+ </New>
54
+ </Arg>
55
+ </Call> -->
56
+
57
+
58
+ <!-- Use this connector if NIO is not available. -->
59
+ <!-- This connector is currently being used for Solr because the
60
+ nio.SelectChannelConnector showed poor performance under WindowsXP
61
+ from a single client with non-persistent connections (35s vs ~3min)
62
+ to complete 10,000 requests)
63
+ -->
64
+ <Call name="addConnector">
65
+ <Arg>
66
+ <New class="org.mortbay.jetty.bio.SocketConnector">
67
+ <Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
68
+ <Set name="maxIdleTime">50000</Set>
69
+ <Set name="lowResourceMaxIdleTime">1500</Set>
70
+ </New>
71
+ </Arg>
72
+ </Call>
73
+
74
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
75
+ <!-- To add a HTTPS SSL listener -->
76
+ <!-- see jetty-ssl.xml to add an ssl connector. use -->
77
+ <!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml -->
78
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
79
+
80
+ <!-- =========================================================== -->
81
+ <!-- Set up global session ID manager -->
82
+ <!-- =========================================================== -->
83
+ <!--
84
+ <Set name="sessionIdManager">
85
+ <New class="org.mortbay.jetty.servlet.HashSessionIdManager">
86
+ <Set name="workerName">node1</Set>
87
+ </New>
88
+ </Set>
89
+ -->
90
+
91
+ <!-- =========================================================== -->
92
+ <!-- Set handler Collection Structure -->
93
+ <!-- =========================================================== -->
94
+ <Set name="handler">
95
+ <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
96
+ <Set name="handlers">
97
+ <Array type="org.mortbay.jetty.Handler">
98
+ <Item>
99
+ <New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
100
+ </Item>
101
+ <Item>
102
+ <New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
103
+ </Item>
104
+ <Item>
105
+ <New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
106
+ </Item>
107
+ </Array>
108
+ </Set>
109
+ </New>
110
+ </Set>
111
+
112
+ <!-- =========================================================== -->
113
+ <!-- Configure the context deployer -->
114
+ <!-- A context deployer will deploy contexts described in -->
115
+ <!-- configuration files discovered in a directory. -->
116
+ <!-- The configuration directory can be scanned for hot -->
117
+ <!-- deployments at the configured scanInterval. -->
118
+ <!-- -->
119
+ <!-- This deployer is configured to deploy contexts configured -->
120
+ <!-- in the $JETTY_HOME/contexts directory -->
121
+ <!-- -->
122
+ <!-- =========================================================== -->
123
+ <Call name="addLifeCycle">
124
+ <Arg>
125
+ <New class="org.mortbay.jetty.deployer.ContextDeployer">
126
+ <Set name="contexts"><Ref id="Contexts"/></Set>
127
+ <Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
128
+ <Set name="scanInterval">1</Set>
129
+ </New>
130
+ </Arg>
131
+ </Call>
132
+
133
+ <!-- =========================================================== -->
134
+ <!-- Configure the webapp deployer. -->
135
+ <!-- A webapp deployer will deploy standard webapps discovered -->
136
+ <!-- in a directory at startup, without the need for additional -->
137
+ <!-- configuration files. It does not support hot deploy or -->
138
+ <!-- non standard contexts (see ContextDeployer above). -->
139
+ <!-- -->
140
+ <!-- This deployer is configured to deploy webapps from the -->
141
+ <!-- $JETTY_HOME/webapps directory -->
142
+ <!-- -->
143
+ <!-- Normally only one type of deployer need be used. -->
144
+ <!-- -->
145
+ <!-- =========================================================== -->
146
+ <Call name="addLifeCycle">
147
+ <Arg>
148
+ <New class="org.mortbay.jetty.deployer.WebAppDeployer">
149
+ <Set name="contexts"><Ref id="Contexts"/></Set>
150
+ <Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set>
151
+ <Set name="parentLoaderPriority">false</Set>
152
+ <Set name="extract">true</Set>
153
+ <Set name="allowDuplicates">false</Set>
154
+ <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
155
+ </New>
156
+ </Arg>
157
+ </Call>
158
+
159
+ <!-- =========================================================== -->
160
+ <!-- Configure Authentication Realms -->
161
+ <!-- Realms may be configured for the entire server here, or -->
162
+ <!-- they can be configured for a specific web app in a context -->
163
+ <!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
164
+ <!-- example). -->
165
+ <!-- =========================================================== -->
166
+ <Set name="UserRealms">
167
+ <Array type="org.mortbay.jetty.security.UserRealm">
168
+ <!--
169
+ <Item>
170
+ <New class="org.mortbay.jetty.security.HashUserRealm">
171
+ <Set name="name">Test Realm</Set>
172
+ <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
173
+ </New>
174
+ </Item>
175
+ -->
176
+ </Array>
177
+ </Set>
178
+
179
+ <!-- =========================================================== -->
180
+ <!-- Configure Request Log -->
181
+ <!-- Request logs may be configured for the entire server here, -->
182
+ <!-- or they can be configured for a specific web app in a -->
183
+ <!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
184
+ <!-- for an example). -->
185
+ <!-- =========================================================== -->
186
+ <Ref id="RequestLog">
187
+ <Set name="requestLog">
188
+ <New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
189
+ <Arg><SystemProperty name="jetty.logs" default="./logs"/>/jetty.request.log</Arg>
190
+ <Set name="append">true</Set>
191
+ <Set name="extended">false</Set>
192
+ <Set name="LogTimeZone">GMT</Set>
193
+ </New>
194
+ </Set>
195
+ </Ref>
196
+
197
+ <!-- =========================================================== -->
198
+ <!-- extra options -->
199
+ <!-- =========================================================== -->
200
+ <Set name="stopAtShutdown">true</Set>
201
+ <!-- ensure/prevent Server: header being sent to browsers -->
202
+ <Set name="sendServerVersion">true</Set>
203
+
204
+ </Configure>
205
+