Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated gitignore

  • Loading branch information...
commit ca9c8fe5d8875c6e7743b87726053fe00d7850b5 1 parent dcded25
@jbasdf authored
Showing with 6 additions and 5,290 deletions.
  1. +6 −1 .gitignore
  2. +0 −527 rdoc/classes/ActsAsSolr/ActsMethods.html
  3. +0 −604 rdoc/classes/ActsAsSolr/ClassMethods.html
  4. +0 −355 rdoc/classes/ActsAsSolr/CommonMethods.html
  5. +0 −223 rdoc/classes/ActsAsSolr/Deprecation.html
  6. +0 −300 rdoc/classes/ActsAsSolr/InstanceMethods.html
  7. +0 −195 rdoc/classes/ActsAsSolr/LazyDocument.html
  8. +0 −503 rdoc/classes/ActsAsSolr/ParserMethods.html
  9. +0 −218 rdoc/classes/ActsAsSolr/Post.html
  10. +0 −413 rdoc/classes/ActsAsSolr/SearchResults.html
  11. +0 −150 rdoc/classes/ActsAsSolr/SolrFixtures.html
  12. +0 −1  rdoc/created.rid
  13. +0 −252 rdoc/files/README_rdoc.html
  14. +0 −101 rdoc/files/lib/acts_as_solr/acts_methods_rb.html
  15. +0 −101 rdoc/files/lib/acts_as_solr/class_methods_rb.html
  16. +0 −101 rdoc/files/lib/acts_as_solr/common_methods_rb.html
  17. +0 −101 rdoc/files/lib/acts_as_solr/deprecation_rb.html
  18. +0 −101 rdoc/files/lib/acts_as_solr/instance_methods_rb.html
  19. +0 −101 rdoc/files/lib/acts_as_solr/lazy_document_rb.html
  20. +0 −101 rdoc/files/lib/acts_as_solr/parser_methods_rb.html
  21. +0 −101 rdoc/files/lib/acts_as_solr/search_results_rb.html
  22. +0 −101 rdoc/files/lib/acts_as_solr/solr_fixtures_rb.html
  23. +0 −111 rdoc/files/lib/acts_as_solr/tasks_rb.html
  24. +0 −142 rdoc/files/lib/acts_as_solr_rb.html
  25. +0 −36 rdoc/fr_class_index.html
  26. +0 −38 rdoc/fr_file_index.html
  27. +0 −80 rdoc/fr_method_index.html
  28. +0 −24 rdoc/index.html
  29. +0 −208 rdoc/rdoc-style.css
View
7 .gitignore
@@ -7,4 +7,9 @@ solr/solr/data/*
.svn
test/db/*.db
test/log/*.log
-pkg/*
+pkg/*
+*.sw?
+.DS_Store
+coverage
+rdoc
+pkg
View
527 rdoc/classes/ActsAsSolr/ActsMethods.html
@@ -1,527 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Module: ActsAsSolr::ActsMethods</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
- <script type="text/javascript">
- // <![CDATA[
-
- function popupCode( url ) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode( id ) {
- if ( document.getElementById )
- elem = document.getElementById( id );
- else if ( document.all )
- elem = eval( "document.all." + id );
- else
- return false;
-
- elemStyle = elem.style;
-
- if ( elemStyle.display != "block" ) {
- elemStyle.display = "block"
- } else {
- elemStyle.display = "none"
- }
-
- return true;
- }
-
- // Make codeblocks hidden by default
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
-
- // ]]>
- </script>
-
-</head>
-<body>
-
-
-
- <div id="classHeader">
- <table class="header-table">
- <tr class="top-aligned-row">
- <td><strong>Module</strong></td>
- <td class="class-name-in-header">ActsAsSolr::ActsMethods</td>
- </tr>
- <tr class="top-aligned-row">
- <td><strong>In:</strong></td>
- <td>
- <a href="../../files/lib/acts_as_solr/acts_methods_rb.html">
- lib/acts_as_solr/acts_methods.rb
- </a>
- <br />
- </td>
- </tr>
-
- </table>
- </div>
- <!-- banner header -->
-
- <div id="bodyContent">
-
-
-
- <div id="contextContent">
-
-
-
- </div>
-
- <div id="method-list">
- <h3 class="section-bar">Methods</h3>
-
- <div class="name-list">
- <a href="#M000030">acts_as_solr</a>&nbsp;&nbsp;
- <a href="#M000032">define_solr_configuration_methods</a>&nbsp;&nbsp;
- <a href="#M000031">process_acts_as_solr</a>&nbsp;&nbsp;
- <a href="#M000033">process_deferred_solr_configuration</a>&nbsp;&nbsp;
- <a href="#M000034">process_solr_options</a>&nbsp;&nbsp;
- </div>
- </div>
-
- </div>
-
-
- <!-- if includes -->
- <div id="includes">
- <h3 class="section-bar">Included Modules</h3>
-
- <div id="includes-list">
- <span class="include-name"><a href="InstanceMethods.html">InstanceMethods</a></span>
- <span class="include-name"><a href="CommonMethods.html">CommonMethods</a></span>
- <span class="include-name"><a href="ParserMethods.html">ParserMethods</a></span>
- </div>
- </div>
-
- <div id="section">
-
-
-
-
-
-
-
-
- <!-- if method_list -->
- <div id="methods">
- <h3 class="section-bar">Public Instance methods</h3>
-
- <div id="method-M000030" class="method-detail">
- <a name="M000030"></a>
-
- <div class="method-heading">
- <a href="#M000030" class="method-signature">
- <span class="method-name">acts_as_solr</span><span class="method-args">(options={}, solr_options={}, &amp;deferred_solr_configuration)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-declares a class as solr-searchable
-</p>
-<h4>options:</h4>
-<table>
-<tr><td valign="top">fields:</td><td>This option can be used to specify only the fields you&#8216;d like to
-index. If not given, all the attributes from the class will be indexed. You
-can also use this option to include methods that should be indexed as
-fields
-
-<pre>
- class Movie &lt; ActiveRecord::Base
- acts_as_solr :fields =&gt; [:name, :description, :current_time]
- def current_time
- Time.now.to_s
- end
- end
-</pre>
-<p>
-Each field passed can also be a hash with the value being a field type
-</p>
-<pre>
- class Electronic &lt; ActiveRecord::Base
- acts_as_solr :fields =&gt; [{:price =&gt; :range_float}]
- def current_time
- Time.now
- end
- end
-</pre>
-<p>
-The field types accepted are:
-</p>
-<table>
-<tr><td valign="top">:float:</td><td>Index the field value as a float (ie.: 12.87)
-
-</td></tr>
-<tr><td valign="top">:integer:</td><td>Index the field value as an integer (ie.: 31)
-
-</td></tr>
-<tr><td valign="top">:boolean:</td><td>Index the field value as a boolean (ie.: true/false)
-
-</td></tr>
-<tr><td valign="top">:date:</td><td>Index the field value as a date (ie.: Wed Nov 15 23:13:03 PST 2006)
-
-</td></tr>
-<tr><td valign="top">:string:</td><td>Index the field value as a text string, not applying the same indexing
-filters as a regular text field
-
-</td></tr>
-<tr><td valign="top">:range_integer:</td><td>Index the field value for integer range queries (ie.:[5 TO 20])
-
-</td></tr>
-<tr><td valign="top">:range_float:</td><td>Index the field value for float range queries (ie.:[14.56 TO 19.99])
-
-</td></tr>
-</table>
-<p>
-Setting the field type preserves its original type when indexed
-</p>
-<p>
-The field may also be passed with a hash value containing options
-</p>
-<p>
-class Author &lt; ActiveRecord::Base
-</p>
-<pre>
- acts_as_solr :fields =&gt; [{:full_name =&gt; {:type =&gt; :text, :as =&gt; :name}}]
- def full_name
- self.first_name + ' ' + self.last_name
- end
-</pre>
-<p>
-end
-</p>
-<p>
-The options accepted are:
-</p>
-<table>
-<tr><td valign="top">:type:</td><td>Index the field using the specified type
-
-</td></tr>
-<tr><td valign="top">:as:</td><td>Index the field using the specified field name
-
-</td></tr>
-</table>
-</td></tr>
-<tr><td valign="top">additional_fields:</td><td>This option takes fields to be include in the index in addition to those
-derived from the database. You can also use this option to include custom
-fields derived from methods you define. This option will be ignored if the
-:fields option is given. It also accepts the same field types as the option
-above
-
-<pre>
- class Movie &lt; ActiveRecord::Base
- acts_as_solr :additional_fields =&gt; [:current_time]
- def current_time
- Time.now.to_s
- end
- end
-</pre>
-</td></tr>
-<tr><td valign="top">exclude_fields:</td><td>This option taks an array of fields that should be ignored from indexing:
-
-<pre>
- class User &lt; ActiveRecord::Base
- acts_as_solr :exclude_fields =&gt; [:password, :login, :credit_card_number]
- end
-</pre>
-</td></tr>
-<tr><td valign="top">include:</td><td>This option can be used for association indexing, which means you can
-include any :has_one, :has_many, :belongs_to and :has_and_belongs_to_many
-association to be indexed:
-
-<pre>
- class Category &lt; ActiveRecord::Base
- has_many :books
- acts_as_solr :include =&gt; [:books]
- end
-</pre>
-<p>
-Each association may also be specified as a hash with an option hash as a
-value
-</p>
-<p>
-class Book &lt; ActiveRecord::Base
-</p>
-<pre>
- belongs_to :author
- has_many :distribution_companies
- has_many :copyright_dates
- has_many :media_types
- acts_as_solr(
- :fields =&gt; [:name, :description],
- :include =&gt; [
- {:author =&gt; {:using =&gt; :fullname, :as =&gt; :name}},
- {:media_types =&gt; {:using =&gt; lambda{|media| type_lookup(media.id)}}}
- {:distribution_companies =&gt; {:as =&gt; :distributor, :multivalued =&gt; true}},
- {:copyright_dates =&gt; {:as =&gt; :copyright, :type =&gt; :date}}
- ]
- ]
-</pre>
-<p>
-The options accepted are:
-</p>
-<table>
-<tr><td valign="top">:type:</td><td>Index the associated objects using the specified type
-
-</td></tr>
-<tr><td valign="top">:as:</td><td>Index the associated objects using the specified field name
-
-</td></tr>
-<tr><td valign="top">:using:</td><td>Index the associated objects using the value returned by the specified
-method or proc. If a method symbol is supplied, it will be sent to each
-object to look up the value to index; if a proc is supplied, it will be
-called once for each object with the object as the only argument
-
-</td></tr>
-<tr><td valign="top">:multivalued:</td><td>Index the associated objects using one field for each object rather than
-joining them all into a single field
-
-</td></tr>
-</table>
-</td></tr>
-<tr><td valign="top">facets:</td><td>This option can be used to specify the fields you&#8216;d like to index as
-facet fields
-
-<pre>
- class Electronic &lt; ActiveRecord::Base
- acts_as_solr :facets =&gt; [:category, :manufacturer]
- end
-</pre>
-</td></tr>
-<tr><td valign="top">boost:</td><td>You can pass a boost (float) value that will be used to boost the document
-and/or a field. To specify a more boost for the document, you can either
-pass a block or a symbol. The block will be called with the record as an
-argument, a symbol will result in the according method being called:
-
-<pre>
- class Electronic &lt; ActiveRecord::Base
- acts_as_solr :fields =&gt; [{:price =&gt; {:boost =&gt; 5.0}}], :boost =&gt; 10.0
- end
-
- class Electronic &lt; ActiveRecord::Base
- acts_as_solr :fields =&gt; [{:price =&gt; {:boost =&gt; 5.0}}], :boost =&gt; proc {|record| record.id + 120*37}
- end
-
- class Electronic &lt; ActiveRecord::Base
- acts_as_solr :fields =&gt; [{:price =&gt; {:boost =&gt; :price_rating}}], :boost =&gt; 10.0
- end
-</pre>
-</td></tr>
-<tr><td valign="top">if:</td><td>Only indexes the record if the condition evaluated is true. The argument
-has to be either a symbol, string (to be eval&#8216;ed), proc/method, or
-class implementing a static validation method. It behaves the same way as
-ActiveRecord&#8216;s :if option.
-
-<pre>
- class Electronic &lt; ActiveRecord::Base
- acts_as_solr :if =&gt; proc{|record| record.is_active?}
- end
-</pre>
-</td></tr>
-<tr><td valign="top">offline:</td><td>Assumes that your using an outside mechanism to explicitly trigger indexing
-records, e.g. you only want to update your index through some asynchronous
-mechanism. Will accept either a boolean or a block that will be evaluated
-before actually contacting the index for saving or destroying a document.
-Defaults to false. It doesn&#8216;t refer to the mechanism of an offline
-index in general, but just to get a centralized point where you can control
-indexing. Note: This is only enabled for saving records. <a
-href="ActsMethods.html#M000030">acts_as_solr</a> doesn&#8216;t always like
-it, if you have a different number of results coming from the database and
-the index. This might be rectified in another patch to support lazy
-loading.
-
-<pre>
- class Electronic &lt; ActiveRecord::Base
- acts_as_solr :offline =&gt; proc {|record| record.automatic_indexing_disabled?}
- end
-</pre>
-</td></tr>
-<tr><td valign="top">auto_commit:</td><td>The commit command will be sent to Solr only if its value is set to true:
-
-<pre>
- class Author &lt; ActiveRecord::Base
- acts_as_solr :auto_commit =&gt; false
- end
-</pre>
-</td></tr>
-</table>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000030-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/acts_methods.rb, line 161</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">acts_as_solr</span>(<span class="ruby-identifier">options</span>={}, <span class="ruby-identifier">solr_options</span>={}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">deferred_solr_configuration</span>)
-
- <span class="ruby-identifier">extend</span> <span class="ruby-constant">ClassMethods</span>
- <span class="ruby-identifier">include</span> <span class="ruby-constant">InstanceMethods</span>
- <span class="ruby-identifier">include</span> <span class="ruby-constant">CommonMethods</span>
- <span class="ruby-identifier">include</span> <span class="ruby-constant">ParserMethods</span>
-
- <span class="ruby-identifier">define_solr_configuration_methods</span>
-
- <span class="ruby-identifier">after_save</span> <span class="ruby-identifier">:solr_save</span>
- <span class="ruby-identifier">after_destroy</span> <span class="ruby-identifier">:solr_destroy</span>
-
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">deferred_solr_configuration</span>
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">deferred_solr_configuration</span> = <span class="ruby-identifier">deferred_solr_configuration</span>
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-identifier">process_acts_as_solr</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">solr_options</span>)
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000032" class="method-detail">
- <a name="M000032"></a>
-
- <div class="method-heading">
- <a href="#M000032" class="method-signature">
- <span class="method-name">define_solr_configuration_methods</span><span class="method-args">()</span>
- </a>
- </div>
-
- <div class="method-description">
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000032-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/acts_methods.rb, line 184</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">define_solr_configuration_methods</span>
- <span class="ruby-comment cmt"># I'd like to use cattr_accessor, but it does not support lazy loaders and delegation to the class in the instance methods.</span>
- <span class="ruby-comment cmt"># TODO: Reconcile with cattr_accessor, or a more appropriate method.</span>
- <span class="ruby-identifier">class_eval</span>(<span class="ruby-value str">&quot;@@configuration = nil unless defined?(@@configuration)\n@@solr_configuration = nil unless defined?(@@solr_configuration)\n@@deferred_solr_configuration = nil unless defined?(@@deferred_solr_configuration)\n\ndef self.configuration\nreturn @@configuration if @@configuration\nprocess_deferred_solr_configuration\n@@configuration\nend\ndef configuration\nself.class.configuration\nend\ndef self.configuration=(value)\n@@configuration = value\nend\ndef configuration=(value)\nself.class.configuration = value\nend\n\ndef self.solr_configuration\nreturn @@solr_configuration if @@solr_configuration\nprocess_deferred_solr_configuration\n@@solr_configuration\nend\ndef solr_configuration\nself.class.solr_configuration\nend\ndef self.solr_configuration=(value)\n@@solr_configuration = value\nend\ndef solr_configuration=(value)\nself.class.solr_configuration = value\nend\n\ndef self.deferred_solr_configuration\nreturn @@deferred_solr_configuration if @@deferred_solr_configuration\n@@deferred_solr_configuration\nend\ndef deferred_solr_configuration\nself.class.deferred_solr_configuration\nend\ndef self.deferred_solr_configuration=(value)\n@@deferred_solr_configuration = value\nend\ndef deferred_solr_configuration=(value)\nself.class.deferred_solr_configuration = value\nend\n&quot;</span>, <span class="ruby-keyword kw">__FILE__</span>, <span class="ruby-keyword kw">__LINE__</span>)
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000031" class="method-detail">
- <a name="M000031"></a>
-
- <div class="method-heading">
- <a href="#M000031" class="method-signature">
- <span class="method-name">process_acts_as_solr</span><span class="method-args">(options, solr_options)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000031-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/acts_methods.rb, line 180</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_acts_as_solr</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">solr_options</span>)
- <span class="ruby-identifier">process_solr_options</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">solr_options</span>)
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000033" class="method-detail">
- <a name="M000033"></a>
-
- <div class="method-heading">
- <a href="#M000033" class="method-signature">
- <span class="method-name">process_deferred_solr_configuration</span><span class="method-args">()</span>
- </a>
- </div>
-
- <div class="method-description">
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000033-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/acts_methods.rb, line 239</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_deferred_solr_configuration</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">deferred_solr_configuration</span>
- <span class="ruby-identifier">options</span>, <span class="ruby-identifier">solr_options</span> = <span class="ruby-identifier">deferred_solr_configuration</span>.<span class="ruby-identifier">call</span>
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">deferred_solr_configuration</span> = <span class="ruby-keyword kw">nil</span>
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">process_solr_options</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">solr_options</span>)
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000034" class="method-detail">
- <a name="M000034"></a>
-
- <div class="method-heading">
- <a href="#M000034" class="method-signature">
- <span class="method-name">process_solr_options</span><span class="method-args">(options={}, solr_options={})</span>
- </a>
- </div>
-
- <div class="method-description">
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000034-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/acts_methods.rb, line 246</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_solr_options</span>(<span class="ruby-identifier">options</span>={}, <span class="ruby-identifier">solr_options</span>={})
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">configuration</span> = {
- <span class="ruby-identifier">:fields</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
- <span class="ruby-identifier">:additional_fields</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
- <span class="ruby-identifier">:exclude_fields</span> =<span class="ruby-operator">&gt;</span> [],
- <span class="ruby-identifier">:auto_commit</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
- <span class="ruby-identifier">:include</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
- <span class="ruby-identifier">:facets</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
- <span class="ruby-identifier">:boost</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
- <span class="ruby-identifier">:if</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;true&quot;</span>,
- <span class="ruby-identifier">:offline</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>
- }
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">solr_configuration</span> = {
- <span class="ruby-identifier">:type_field</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;type_s&quot;</span>,
- <span class="ruby-identifier">:primary_key_field</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;pk_i&quot;</span>,
- <span class="ruby-identifier">:default_boost</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1.0</span>
- }
-
- <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">options</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
- <span class="ruby-identifier">solr_configuration</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">solr_options</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">solr_options</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
- <span class="ruby-constant">Deprecation</span>.<span class="ruby-identifier">validate_index</span>(<span class="ruby-identifier">configuration</span>)
-
- <span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:solr_fields</span>] = {}
- <span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:solr_includes</span>] = {}
-
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:fields</span>].<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:each</span>)
- <span class="ruby-identifier">process_fields</span>(<span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:fields</span>])
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-identifier">process_fields</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_sym</span> })
- <span class="ruby-identifier">process_fields</span>(<span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:additional_fields</span>])
- <span class="ruby-keyword kw">end</span>
-
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:include</span>].<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:each</span>)
- <span class="ruby-identifier">process_includes</span>(<span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:include</span>])
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
-
- </div>
-
-
- </div>
-
-
-<div id="validator-badges">
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
-</div>
-
-</body>
-</html>
View
604 rdoc/classes/ActsAsSolr/ClassMethods.html
@@ -1,604 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Module: ActsAsSolr::ClassMethods</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
- <script type="text/javascript">
- // <![CDATA[
-
- function popupCode( url ) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode( id ) {
- if ( document.getElementById )
- elem = document.getElementById( id );
- else if ( document.all )
- elem = eval( "document.all." + id );
- else
- return false;
-
- elemStyle = elem.style;
-
- if ( elemStyle.display != "block" ) {
- elemStyle.display = "block"
- } else {
- elemStyle.display = "none"
- }
-
- return true;
- }
-
- // Make codeblocks hidden by default
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
-
- // ]]>
- </script>
-
-</head>
-<body>
-
-
-
- <div id="classHeader">
- <table class="header-table">
- <tr class="top-aligned-row">
- <td><strong>Module</strong></td>
- <td class="class-name-in-header">ActsAsSolr::ClassMethods</td>
- </tr>
- <tr class="top-aligned-row">
- <td><strong>In:</strong></td>
- <td>
- <a href="../../files/lib/acts_as_solr/class_methods_rb.html">
- lib/acts_as_solr/class_methods.rb
- </a>
- <br />
- <a href="../../files/lib/acts_as_solr/deprecation_rb.html">
- lib/acts_as_solr/deprecation.rb
- </a>
- <br />
- </td>
- </tr>
-
- </table>
- </div>
- <!-- banner header -->
-
- <div id="bodyContent">
-
-
-
- <div id="contextContent">
-
-
-
- </div>
-
- <div id="method-list">
- <h3 class="section-bar">Methods</h3>
-
- <div class="name-list">
- <a href="#M000006">count_by_solr</a>&nbsp;&nbsp;
- <a href="#M000001">find_by_solr</a>&nbsp;&nbsp;
- <a href="#M000002">find_id_by_solr</a>&nbsp;&nbsp;
- <a href="#M000004">find_multi_search_objects</a>&nbsp;&nbsp;
- <a href="#M000008">find_with_facet</a>&nbsp;&nbsp;
- <a href="#M000005">multi_model_suffix</a>&nbsp;&nbsp;
- <a href="#M000003">multi_solr_search</a>&nbsp;&nbsp;
- <a href="#M000007">rebuild_solr_index</a>&nbsp;&nbsp;
- </div>
- </div>
-
- </div>
-
-
- <!-- if includes -->
- <div id="includes">
- <h3 class="section-bar">Included Modules</h3>
-
- <div id="includes-list">
- <span class="include-name"><a href="CommonMethods.html">CommonMethods</a></span>
- <span class="include-name"><a href="ParserMethods.html">ParserMethods</a></span>
- </div>
- </div>
-
- <div id="section">
-
-
-
-
-
-
-
-
- <!-- if method_list -->
- <div id="methods">
- <h3 class="section-bar">Public Instance methods</h3>
-
- <div id="method-M000006" class="method-detail">
- <a name="M000006"></a>
-
- <div class="method-heading">
- <a href="#M000006" class="method-signature">
- <span class="method-name">count_by_solr</span><span class="method-args">(query, options = {})</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-returns the total number of documents found in the query specified:
-</p>
-<pre>
- Book.count_by_solr 'rails' =&gt; 3
-</pre>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000006-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/class_methods.rb, line 185</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">count_by_solr</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">options</span> = {})
- <span class="ruby-identifier">data</span> = <span class="ruby-identifier">parse_query</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">options</span>)
- <span class="ruby-identifier">data</span>.<span class="ruby-identifier">total_hits</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000001" class="method-detail">
- <a name="M000001"></a>
-
- <div class="method-heading">
- <a href="#M000001" class="method-signature">
- <span class="method-name">find_by_solr</span><span class="method-args">(query, options={})</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Finds instances of a model. Terms are ANDed by default, can be overwritten
-by using OR between terms
-</p>
-<p>
-Here&#8216;s a sample (untested) code for your controller:
-</p>
-<pre>
- def search
- results = Book.find_by_solr params[:query]
- end
-</pre>
-<p>
-You can also search for specific fields by searching for
-&#8216;field:value&#8216;
-</p>
-<h4>options:</h4>
-<table>
-<tr><td valign="top">offset:</td><td>- The first document to be retrieved (offset)
-
-</td></tr>
-<tr><td valign="top">limit:</td><td>- The number of rows per page
-
-</td></tr>
-<tr><td valign="top">order:</td><td>- Orders (sort by) the result set using a given criteria:
-
-<pre>
- Book.find_by_solr 'ruby', :order =&gt; 'description asc'
-</pre>
-</td></tr>
-<tr><td valign="top">field_types:</td><td>This option is deprecated and will be obsolete by version 1.0.
-There&#8216;s no need to specify the :field_types anymore when doing a
-search in a model that specifies a field type for a field. The field types
-are automatically traced back when they&#8216;re included.
-
-<pre>
- class Electronic &lt; ActiveRecord::Base
- acts_as_solr :fields =&gt; [{:price =&gt; :range_float}]
- end
-</pre>
-</td></tr>
-<tr><td valign="top">facets:</td><td>This option argument accepts the following arguments:
-
-<table>
-<tr><td valign="top">fields:</td><td>The fields to be included in the faceted search (Solr&#8216;s facet.field)
-
-</td></tr>
-<tr><td valign="top">query:</td><td>The queries to be included in the faceted search (Solr&#8216;s facet.query)
-
-</td></tr>
-<tr><td valign="top">zeros:</td><td>Display facets with count of zero. (true|false)
-
-</td></tr>
-<tr><td valign="top">sort:</td><td>Sorts the faceted resuls by highest to lowest count. (true|false)
-
-</td></tr>
-<tr><td valign="top">browse:</td><td>This is where the &#8216;drill-down&#8217; of the facets work. Accepts an
-array of fields in the format &quot;facet_field:term&quot;
-
-</td></tr>
-<tr><td valign="top">mincount:</td><td>Replacement for zeros (it has been deprecated in Solr). Specifies the
-minimum count necessary for a facet field to be returned. (Solr&#8216;s
-facet.mincount) Overrides :zeros if it is specified. Default is 0.
-
-</td></tr>
-<tr><td valign="top">dates:</td><td>Run date faceted queries using the following arguments:
-
-</td></tr>
-</table>
-<pre>
- fields:: The fields to be included in the faceted date search (Solr's facet.date).
- It may be either a String/Symbol or Hash. If it's a hash the options are the
- same as date_facets minus the fields option (i.e., :start:, :end, :gap, :other,
- :between). These options if provided will override the base options.
- (Solr's f.&lt;field_name&gt;.date.&lt;key&gt;=&lt;value&gt;).
- start:: The lower bound for the first date range for all Date Faceting. Required if
- :fields is present
- end:: The upper bound for the last date range for all Date Faceting. Required if
- :fields is prsent
- gap:: The size of each date range expressed as an interval to be added to the lower
- bound using the DateMathParser syntax. Required if :fields is prsent
- hardend:: A Boolean parameter instructing Solr what do do in the event that
- facet.date.gap does not divide evenly between facet.date.start and facet.date.end.
- other:: This param indicates that in addition to the counts for each date range
- constraint between facet.date.start and facet.date.end, other counds should be
- calculated. May specify more then one in an Array. The possible options are:
- before:: - all records with lower bound less than start
- after:: - all records with upper bound greater than end
- between:: - all records with field values between start and end
- none:: - compute no other bounds (useful in per field assignment)
- all:: - shortcut for before, after, and between
- filter:: Similar to :query option provided by :facets, in that accepts an array of
- of date queries to limit results. Can not be used as a part of a :field hash.
- This is the only option that can be used if :fields is not present.
-</pre>
-</td></tr>
-</table>
-<p>
-Example:
-</p>
-<pre>
- Electronic.find_by_solr &quot;memory&quot;, :facets =&gt; {:zeros =&gt; false, :sort =&gt; true,
- :query =&gt; [&quot;price:[* TO 200]&quot;,
- &quot;price:[200 TO 500]&quot;,
- &quot;price:[500 TO *]&quot;],
- :fields =&gt; [:category, :manufacturer],
- :browse =&gt; [&quot;category:Memory&quot;,&quot;manufacturer:Someone&quot;]}
-</pre>
-<p>
-Examples of date faceting:
-</p>
-<pre>
- basic:
- Electronic.find_by_solr &quot;memory&quot;, :facets =&gt; {:dates =&gt; {:fields =&gt; [:updated_at, :created_at],
- :start =&gt; 'NOW-10YEARS/DAY', :end =&gt; 'NOW/DAY', :gap =&gt; '+2YEARS', :other =&gt; :before}}
-
- advanced:
- Electronic.find_by_solr &quot;memory&quot;, :facets =&gt; {:dates =&gt; {:fields =&gt; [:updated_at,
- {:created_at =&gt; {:start =&gt; 'NOW-20YEARS/DAY', :end =&gt; 'NOW-10YEARS/DAY', :other =&gt; [:before, :after]}
- }], :start =&gt; 'NOW-10YEARS/DAY', :end =&gt; 'NOW/DAY', :other =&gt; :before, :filter =&gt;
- [&quot;created_at:[NOW-10YEARS/DAY TO NOW/DAY]&quot;, &quot;updated_at:[NOW-1YEAR/DAY TO NOW/DAY]&quot;]}}
-
- filter only:
- Electronic.find_by_solr &quot;memory&quot;, :facets =&gt; {:dates =&gt; {:filter =&gt; &quot;updated_at:[NOW-1YEAR/DAY TO NOW/DAY]&quot;}}
-</pre>
-<table>
-<tr><td valign="top">scores:</td><td>If set to true this will return the score as a &#8216;solr_score&#8217;
-attribute for each one of the instances found. Does not currently work with
-<a href="ClassMethods.html#M000002">find_id_by_solr</a>
-
-<pre>
- books = Book.find_by_solr 'ruby OR splinter', :scores =&gt; true
- books.records.first.solr_score
- =&gt; 1.21321397
- books.records.last.solr_score
- =&gt; 0.12321548
-</pre>
-</td></tr>
-<tr><td valign="top">lazy:</td><td>If set to true the search will return objects that will touch the database
-when you ask for one of their attributes for the first time. Useful when
-you&#8216;re using fragment caching based solely on types and ids.
-
-</td></tr>
-</table>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000001-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/class_methods.rb, line 111</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_by_solr</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">options</span>={})
- <span class="ruby-identifier">data</span> = <span class="ruby-identifier">parse_query</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">options</span>)
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parse_results</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">options</span>)
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000002" class="method-detail">
- <a name="M000002"></a>
-
- <div class="method-heading">
- <a href="#M000002" class="method-signature">
- <span class="method-name">find_id_by_solr</span><span class="method-args">(query, options={})</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Finds instances of a model and returns an array with the ids:
-</p>
-<pre>
- Book.find_id_by_solr &quot;rails&quot; =&gt; [1,4,7]
-</pre>
-<p>
-The options accepted are the same as <a
-href="ClassMethods.html#M000001">find_by_solr</a>
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000002-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/class_methods.rb, line 120</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_id_by_solr</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">options</span>={})
- <span class="ruby-identifier">data</span> = <span class="ruby-identifier">parse_query</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">options</span>)
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parse_results</span>(<span class="ruby-identifier">data</span>, {<span class="ruby-identifier">:format</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:ids</span>})
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000004" class="method-detail">
- <a name="M000004"></a>
-
- <div class="method-heading">
- <a href="#M000004" class="method-signature">
- <span class="method-name">find_multi_search_objects</span><span class="method-args">(data, options)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000004-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/class_methods.rb, line 163</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_multi_search_objects</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">options</span>)
- <span class="ruby-identifier">result</span> = []
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:results_format</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">:objects</span>
- <span class="ruby-identifier">data</span>.<span class="ruby-identifier">hits</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">doc</span><span class="ruby-operator">|</span>
- <span class="ruby-identifier">k</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'id'</span>).<span class="ruby-identifier">first</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">':'</span>)
- <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">k</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">find_by_id</span>(<span class="ruby-identifier">k</span>[<span class="ruby-value">1</span>])
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:results_format</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">:ids</span>
- <span class="ruby-identifier">data</span>.<span class="ruby-identifier">hits</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">doc</span><span class="ruby-operator">|</span> <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> {<span class="ruby-value str">&quot;id&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">doc</span>[<span class="ruby-value str">&quot;id&quot;</span>].<span class="ruby-identifier">to_s</span>}}
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-identifier">result</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000008" class="method-detail">
- <a name="M000008"></a>
-
- <div class="method-heading">
- <a href="#M000008" class="method-signature">
- <span class="method-name">find_with_facet</span><span class="method-args">(query, options={})</span>
- </a>
- </div>
-
- <div class="method-description">
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000008-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/deprecation.rb, line 17</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_with_facet</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">options</span>={})
- <span class="ruby-constant">Deprecation</span>.<span class="ruby-identifier">plog</span> <span class="ruby-value str">&quot;The method find_with_facet is deprecated. Use find_by_solr instead, passing the &quot;</span> <span class="ruby-operator">+</span>
- <span class="ruby-value str">&quot;arguments the same way you used to do with find_with_facet.&quot;</span>
- <span class="ruby-identifier">find_by_solr</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">options</span>)
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000005" class="method-detail">
- <a name="M000005"></a>
-
- <div class="method-heading">
- <a href="#M000005" class="method-signature">
- <span class="method-name">multi_model_suffix</span><span class="method-args">(options)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000005-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/class_methods.rb, line 176</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">multi_model_suffix</span>(<span class="ruby-identifier">options</span>)
- <span class="ruby-identifier">models</span> = <span class="ruby-node">&quot;AND (#{solr_configuration[:type_field]}:#{self.name}&quot;</span>
- <span class="ruby-identifier">models</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; OR &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:models</span>].<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;#{solr_configuration[:type_field]}:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">to_s</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot; OR &quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:models</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
- <span class="ruby-identifier">models</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;)&quot;</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000003" class="method-detail">
- <a name="M000003"></a>
-
- <div class="method-heading">
- <a href="#M000003" class="method-signature">
- <span class="method-name">multi_solr_search</span><span class="method-args">(query, options = {})</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-This method can be used to execute a search across multiple models:
-</p>
-<pre>
- Book.multi_solr_search &quot;Napoleon OR Tom&quot;, :models =&gt; [Movie]
-</pre>
-<h4>options:</h4>
-<p>
-Accepts the same options as <a
-href="ClassMethods.html#M000001">find_by_solr</a> plus:
-</p>
-<table>
-<tr><td valign="top">models:</td><td>The additional models you&#8216;d like to include in the search
-
-</td></tr>
-<tr><td valign="top">results_format:</td><td>Specify the format of the results found
-
-<table>
-<tr><td valign="top">:objects :</td><td>Will return an array with the results being objects (default). Example:
-
-<pre>
- Book.multi_solr_search &quot;Napoleon OR Tom&quot;, :models =&gt; [Movie], :results_format =&gt; :objects
-</pre>
-</td></tr>
-<tr><td valign="top">:ids :</td><td>Will return an array with the ids of each entry found. Example:
-
-<pre>
- Book.multi_solr_search &quot;Napoleon OR Tom&quot;, :models =&gt; [Movie], :results_format =&gt; :ids
- =&gt; [{&quot;id&quot; =&gt; &quot;Movie:1&quot;},{&quot;id&quot; =&gt; Book:1}]
-</pre>
-<p>
-Where the value of each array is as Model:instance_id
-</p>
-</td></tr>
-</table>
-</td></tr>
-<tr><td valign="top">scores:</td><td>If set to true this will return the score as a &#8216;solr_score&#8217;
-attribute for each one of the instances found. Does not currently work with
-<a href="ClassMethods.html#M000002">find_id_by_solr</a>
-
-<pre>
- books = Book.multi_solr_search 'ruby OR splinter', :scores =&gt; true
- books.records.first.solr_score
- =&gt; 1.21321397
- books.records.last.solr_score
- =&gt; 0.12321548
-</pre>
-</td></tr>
-</table>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000003-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/class_methods.rb, line 147</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">multi_solr_search</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">options</span> = {})
- <span class="ruby-identifier">models</span> = <span class="ruby-identifier">multi_model_suffix</span>(<span class="ruby-identifier">options</span>)
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">:results_format</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:objects</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:results_format</span>]
- <span class="ruby-identifier">data</span> = <span class="ruby-identifier">parse_query</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">models</span>)
-
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">total_hits</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-constant">SearchResults</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:docs</span> =<span class="ruby-operator">&gt;</span> [], <span class="ruby-identifier">:total</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>)
- <span class="ruby-keyword kw">end</span>
-
- <span class="ruby-identifier">result</span> = <span class="ruby-identifier">find_multi_search_objects</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">options</span>)
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:scores</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:results_format</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">:objects</span>
- <span class="ruby-identifier">add_scores</span>(<span class="ruby-identifier">result</span>, <span class="ruby-identifier">data</span>)
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-constant">SearchResults</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">:docs</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">result</span>, <span class="ruby-identifier">:total</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">total_hits</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000007" class="method-detail">
- <a name="M000007"></a>
-
- <div class="method-heading">
- <a href="#M000007" class="method-signature">
- <span class="method-name">rebuild_solr_index</span><span class="method-args">(batch_size=0, &amp;finder)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-It&#8216;s used to rebuild the Solr index for a specific model.
-</p>
-<pre>
- Book.rebuild_solr_index
-</pre>
-<p>
-If batch_size is greater than 0, adds will be done in batches. NOTE: If
-using sqlserver, be sure to use a finder with an explicit order. Non-edge
-versions of rails do not handle pagination correctly for sqlserver without
-an order clause.
-</p>
-<p>
-If a finder block is given, it will be called to retrieve the items to
-index. This can be very useful for things such as updating based on
-conditions or using eager loading for indexed associations.
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000007-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/class_methods.rb, line 201</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rebuild_solr_index</span>(<span class="ruby-identifier">batch_size</span>=<span class="ruby-value">0</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">finder</span>)
- <span class="ruby-identifier">finder</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">ar</span>, <span class="ruby-identifier">options</span><span class="ruby-operator">|</span> <span class="ruby-identifier">ar</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>({<span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">primary_key</span>})) }
- <span class="ruby-identifier">start_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
-
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">batch_size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
- <span class="ruby-identifier">items_processed</span> = <span class="ruby-value">0</span>
- <span class="ruby-identifier">limit</span> = <span class="ruby-identifier">batch_size</span>
- <span class="ruby-identifier">offset</span> = <span class="ruby-value">0</span>
- <span class="ruby-keyword kw">begin</span>
- <span class="ruby-identifier">iteration_start</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
- <span class="ruby-identifier">items</span> = <span class="ruby-identifier">finder</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</span>, {<span class="ruby-identifier">:limit</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">limit</span>, <span class="ruby-identifier">:offset</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">offset</span>})
- <span class="ruby-identifier">add_batch</span> = <span class="ruby-identifier">items</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">content</span><span class="ruby-operator">|</span> <span class="ruby-identifier">content</span>.<span class="ruby-identifier">to_solr_doc</span> }
-
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">items</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
- <span class="ruby-identifier">solr_add</span> <span class="ruby-identifier">add_batch</span>
- <span class="ruby-identifier">solr_commit</span>
- <span class="ruby-keyword kw">end</span>
-
- <span class="ruby-identifier">items_processed</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">items</span>.<span class="ruby-identifier">size</span>
- <span class="ruby-identifier">last_id</span> = <span class="ruby-identifier">items</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">id</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">items</span>.<span class="ruby-identifier">last</span>
- <span class="ruby-identifier">time_so_far</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">start_time</span>
- <span class="ruby-identifier">iteration_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">iteration_start</span>
- <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">&quot;#{Process.pid}: #{items_processed} items for #{self.name} have been batch added to index in #{'%.3f' % time_so_far}s at #{'%.3f' % (items_processed / time_so_far)} items/sec (#{'%.3f' % (items.size / iteration_time)} items/sec for the last batch). Last id: #{last_id}&quot;</span>
- <span class="ruby-identifier">offset</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">items</span>.<span class="ruby-identifier">size</span>
- <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">items</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">items</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-identifier">items</span> = <span class="ruby-identifier">finder</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</span>, {})
- <span class="ruby-identifier">items</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">content</span><span class="ruby-operator">|</span> <span class="ruby-identifier">content</span>.<span class="ruby-identifier">solr_save</span> }
- <span class="ruby-identifier">items_processed</span> = <span class="ruby-identifier">items</span>.<span class="ruby-identifier">size</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-identifier">solr_optimize</span>
- <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-identifier">items_processed</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-node">&quot;Index for #{self.name} has been rebuilt&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-node">&quot;Nothing to index for #{self.name}&quot;</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
-
- </div>
-
-
- </div>
-
-
-<div id="validator-badges">
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
-</div>
-
-</body>
-</html>
View
355 rdoc/classes/ActsAsSolr/CommonMethods.html
@@ -1,355 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Module: ActsAsSolr::CommonMethods</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
- <script type="text/javascript">
- // <![CDATA[
-
- function popupCode( url ) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode( id ) {
- if ( document.getElementById )
- elem = document.getElementById( id );
- else if ( document.all )
- elem = eval( "document.all." + id );
- else
- return false;
-
- elemStyle = elem.style;
-
- if ( elemStyle.display != "block" ) {
- elemStyle.display = "block"
- } else {
- elemStyle.display = "none"
- }
-
- return true;
- }
-
- // Make codeblocks hidden by default
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
-
- // ]]>
- </script>
-
-</head>
-<body>
-
-
-
- <div id="classHeader">
- <table class="header-table">
- <tr class="top-aligned-row">
- <td><strong>Module</strong></td>
- <td class="class-name-in-header">ActsAsSolr::CommonMethods</td>
- </tr>
- <tr class="top-aligned-row">
- <td><strong>In:</strong></td>
- <td>
- <a href="../../files/lib/acts_as_solr/common_methods_rb.html">
- lib/acts_as_solr/common_methods.rb
- </a>
- <br />
- </td>
- </tr>
-
- </table>
- </div>
- <!-- banner header -->
-
- <div id="bodyContent">
-
-
-
- <div id="contextContent">
-
-
-
- </div>
-
- <div id="method-list">
- <h3 class="section-bar">Methods</h3>
-
- <div class="name-list">
- <a href="#M000014">get_solr_field_type</a>&nbsp;&nbsp;
- <a href="#M000020">record_id</a>&nbsp;&nbsp;
- <a href="#M000015">set_value_if_nil</a>&nbsp;&nbsp;
- <a href="#M000016">solr_add</a>&nbsp;&nbsp;
- <a href="#M000018">solr_commit</a>&nbsp;&nbsp;
- <a href="#M000017">solr_delete</a>&nbsp;&nbsp;
- <a href="#M000019">solr_optimize</a>&nbsp;&nbsp;
- </div>
- </div>
-
- </div>
-
-
- <!-- if includes -->
-
- <div id="section">
-
-
-
-
-
-
-
-
- <!-- if method_list -->
- <div id="methods">
- <h3 class="section-bar">Public Instance methods</h3>
-
- <div id="method-M000014" class="method-detail">
- <a name="M000014"></a>
-
- <div class="method-heading">
- <a href="#M000014" class="method-signature">
- <span class="method-name">get_solr_field_type</span><span class="method-args">(field_type)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Converts field types into Solr types
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000014-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/common_methods.rb, line 6</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_solr_field_type</span>(<span class="ruby-identifier">field_type</span>)
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">field_type</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
- <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">field_type</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:float</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;f&quot;</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:integer</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;i&quot;</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:boolean</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;b&quot;</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:string</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;s&quot;</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:date</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;d&quot;</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:range_float</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;rf&quot;</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:range_integer</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;ri&quot;</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:facet</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;facet&quot;</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:text</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;t&quot;</span>
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown field_type symbol: #{field_type}&quot;</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">field_type</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">field_type</span>
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown field_type class: #{field_type.class}: #{field_type}&quot;</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000020" class="method-detail">
- <a name="M000020"></a>
-
- <div class="method-heading">
- <a href="#M000020" class="method-signature">
- <span class="method-name">record_id</span><span class="method-args">(object)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Returns the id for the given instance
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000020-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/common_methods.rb, line 83</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">record_id</span>(<span class="ruby-identifier">object</span>)
- <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;object.#{object.class.primary_key}&quot;</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000015" class="method-detail">
- <a name="M000015"></a>
-
- <div class="method-heading">
- <a href="#M000015" class="method-signature">
- <span class="method-name">set_value_if_nil</span><span class="method-args">(field_type)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Sets a default value when value being set is nil.
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000015-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/common_methods.rb, line 38</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_value_if_nil</span>(<span class="ruby-identifier">field_type</span>)
- <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">field_type</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;b&quot;</span>, <span class="ruby-identifier">:boolean</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;false&quot;</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;s&quot;</span>, <span class="ruby-value str">&quot;t&quot;</span>, <span class="ruby-value str">&quot;d&quot;</span>, <span class="ruby-identifier">:date</span>, <span class="ruby-identifier">:string</span>, <span class="ruby-identifier">:text</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;&quot;</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;f&quot;</span>, <span class="ruby-value str">&quot;rf&quot;</span>, <span class="ruby-identifier">:float</span>, <span class="ruby-identifier">:range_float</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span><span class="ruby-value">.00</span>
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;i&quot;</span>, <span class="ruby-value str">&quot;ri&quot;</span>, <span class="ruby-identifier">:integer</span>, <span class="ruby-identifier">:range_integer</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span>
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;&quot;</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000016" class="method-detail">
- <a name="M000016"></a>
-
- <div class="method-heading">
- <a href="#M000016" class="method-signature">
- <span class="method-name">solr_add</span><span class="method-args">(add_xml)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Sends an add command to Solr
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000016-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/common_methods.rb, line 54</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">solr_add</span>(<span class="ruby-identifier">add_xml</span>)
- <span class="ruby-constant">ActsAsSolr</span><span class="ruby-operator">::</span><span class="ruby-constant">Post</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-constant">Solr</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span><span class="ruby-operator">::</span><span class="ruby-constant">AddDocument</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">add_xml</span>))
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000018" class="method-detail">
- <a name="M000018"></a>
-
- <div class="method-heading">
- <a href="#M000018" class="method-signature">
- <span class="method-name">solr_commit</span><span class="method-args">()</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Sends the commit command to Solr
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000018-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/common_methods.rb, line 64</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">solr_commit</span>
- <span class="ruby-constant">ActsAsSolr</span><span class="ruby-operator">::</span><span class="ruby-constant">Post</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-constant">Solr</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span><span class="ruby-operator">::</span><span class="ruby-constant">Commit</span>.<span class="ruby-identifier">new</span>)
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000017" class="method-detail">
- <a name="M000017"></a>
-
- <div class="method-heading">
- <a href="#M000017" class="method-signature">
- <span class="method-name">solr_delete</span><span class="method-args">(solr_ids)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Sends the delete command to Solr
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000017-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/common_methods.rb, line 59</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">solr_delete</span>(<span class="ruby-identifier">solr_ids</span>)
- <span class="ruby-constant">ActsAsSolr</span><span class="ruby-operator">::</span><span class="ruby-constant">Post</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-constant">Solr</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span><span class="ruby-operator">::</span><span class="ruby-constant">Delete</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">solr_ids</span>))
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000019" class="method-detail">
- <a name="M000019"></a>
-
- <div class="method-heading">
- <a href="#M000019" class="method-signature">
- <span class="method-name">solr_optimize</span><span class="method-args">()</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Optimizes the Solr index. Solr says:
-</p>
-<p>
-Optimizations can take nearly ten minutes to run. We are presuming
-optimizations should be run once following large batch-like updates to the
-collection and/or once a day.
-</p>
-<p>
-One of the solutions for this would be to create a cron job that runs every
-day at midnight and optmizes the index:
-</p>
-<pre>
- 0 0 * * * /your_rails_dir/script/runner -e production &quot;Model.solr_optimize&quot;
-</pre>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000019-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/common_methods.rb, line 78</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">solr_optimize</span>
- <span class="ruby-constant">ActsAsSolr</span><span class="ruby-operator">::</span><span class="ruby-constant">Post</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-constant">Solr</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span><span class="ruby-operator">::</span><span class="ruby-constant">Optimize</span>.<span class="ruby-identifier">new</span>)
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
-
- </div>
-
-
- </div>
-
-
-<div id="validator-badges">
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
-</div>
-
-</body>
-</html>
View
223 rdoc/classes/ActsAsSolr/Deprecation.html
@@ -1,223 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Class: ActsAsSolr::Deprecation</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
- <script type="text/javascript">
- // <![CDATA[
-
- function popupCode( url ) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode( id ) {
- if ( document.getElementById )
- elem = document.getElementById( id );
- else if ( document.all )
- elem = eval( "document.all." + id );
- else
- return false;
-
- elemStyle = elem.style;
-
- if ( elemStyle.display != "block" ) {
- elemStyle.display = "block"
- } else {
- elemStyle.display = "none"
- }
-
- return true;
- }
-
- // Make codeblocks hidden by default
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
-
- // ]]>
- </script>
-
-</head>
-<body>
-
-
-
- <div id="classHeader">
- <table class="header-table">
- <tr class="top-aligned-row">
- <td><strong>Class</strong></td>
- <td class="class-name-in-header">ActsAsSolr::Deprecation</td>
- </tr>
- <tr class="top-aligned-row">
- <td><strong>In:</strong></td>
- <td>
- <a href="../../files/lib/acts_as_solr/deprecation_rb.html">
- lib/acts_as_solr/deprecation.rb
- </a>
- <br />
- </td>
- </tr>
-
- <tr class="top-aligned-row">
- <td><strong>Parent:</strong></td>
- <td>
- Object
- </td>
- </tr>
- </table>
- </div>
- <!-- banner header -->
-
- <div id="bodyContent">
-
-
-
- <div id="contextContent">
-
-
-
- </div>
-
- <div id="method-list">
- <h3 class="section-bar">Methods</h3>
-
- <div class="name-list">
- <a href="#M000054">plog</a>&nbsp;&nbsp;
- <a href="#M000053">validate_index</a>&nbsp;&nbsp;
- <a href="#M000052">validate_query</a>&nbsp;&nbsp;
- </div>
- </div>
-
- </div>
-
-
- <!-- if includes -->
-
- <div id="section">
-
-
-
-
-
-
-
-
- <!-- if method_list -->
- <div id="methods">
- <h3 class="section-bar">Public Class methods</h3>
-
- <div id="method-M000054" class="method-detail">
- <a name="M000054"></a>
-
- <div class="method-heading">
- <a href="#M000054" class="method-signature">
- <span class="method-name">plog</span><span class="method-args">(text)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-This will print the text to stdout and log the text if rails logger is
-available
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000054-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/deprecation.rb, line 55</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">plog</span> <span class="ruby-identifier">text</span>
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">text</span>
- <span class="ruby-constant">RAILS_DEFAULT_LOGGER</span>.<span class="ruby-identifier">warn</span> <span class="ruby-identifier">text</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span> <span class="ruby-constant">RAILS_DEFAULT_LOGGER</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000053" class="method-detail">
- <a name="M000053"></a>
-
- <div class="method-heading">
- <a href="#M000053" class="method-signature">
- <span class="method-name">validate_index</span><span class="method-args">(options={})</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Validates the options passed during indexing
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000053-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/deprecation.rb, line 46</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">validate_index</span> <span class="ruby-identifier">options</span>={}
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:background</span>]
- <span class="ruby-identifier">plog</span> <span class="ruby-value str">&quot;The :background option is being deprecated. There are better and more efficient &quot;</span> <span class="ruby-operator">+</span>
- <span class="ruby-value str">&quot;ways to handle delayed saving of your records.&quot;</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000052" class="method-detail">
- <a name="M000052"></a>
-
- <div class="method-heading">
- <a href="#M000052" class="method-signature">
- <span class="method-name">validate_query</span><span class="method-args">(options={})</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Validates the options passed during query
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000052-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/deprecation.rb, line 26</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">validate_query</span> <span class="ruby-identifier">options</span>={}
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:field_types</span>]
- <span class="ruby-identifier">plog</span> <span class="ruby-value str">&quot;The option :field_types for searching is deprecated. &quot;</span> <span class="ruby-operator">+</span>
- <span class="ruby-value str">&quot;The field types are automatically traced back when you specify a field type in your model.&quot;</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:sort_by</span>]
- <span class="ruby-identifier">plog</span> <span class="ruby-value str">&quot;The option :sort_by is deprecated, use :order instead!&quot;</span>
- <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:order</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:sort_by</span>]
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:start</span>]
- <span class="ruby-identifier">plog</span> <span class="ruby-value str">&quot;The option :start is deprecated, use :offset instead!&quot;</span>
- <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:offset</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:start</span>]
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:rows</span>]
- <span class="ruby-identifier">plog</span> <span class="ruby-value str">&quot;The option :rows is deprecated, use :limit instead!&quot;</span>
- <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:limit</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:rows</span>]
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
-
- </div>
-
-
- </div>
-
-
-<div id="validator-badges">
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
-</div>
-
-</body>
-</html>
View
300 rdoc/classes/ActsAsSolr/InstanceMethods.html
@@ -1,300 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Module: ActsAsSolr::InstanceMethods</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
- <script type="text/javascript">
- // <![CDATA[
-
- function popupCode( url ) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode( id ) {
- if ( document.getElementById )
- elem = document.getElementById( id );
- else if ( document.all )
- elem = eval( "document.all." + id );
- else
- return false;
-
- elemStyle = elem.style;
-
- if ( elemStyle.display != "block" ) {
- elemStyle.display = "block"
- } else {
- elemStyle.display = "none"
- }
-
- return true;
- }
-
- // Make codeblocks hidden by default
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
-
- // ]]>
- </script>
-
-</head>
-<body>
-
-
-
- <div id="classHeader">
- <table class="header-table">
- <tr class="top-aligned-row">
- <td><strong>Module</strong></td>
- <td class="class-name-in-header">ActsAsSolr::InstanceMethods</td>
- </tr>
- <tr class="top-aligned-row">
- <td><strong>In:</strong></td>
- <td>
- <a href="../../files/lib/acts_as_solr/instance_methods_rb.html">
- lib/acts_as_solr/instance_methods.rb
- </a>
- <br />
- </td>
- </tr>
-
- </table>
- </div>
- <!-- banner header -->
-
- <div id="bodyContent">
-
-
-
- <div id="contextContent">
-
-
-
- </div>
-
- <div id="method-list">
- <h3 class="section-bar">Methods</h3>
-
- <div class="name-list">
- <a href="#M000011">indexing_disabled?</a>&nbsp;&nbsp;
- <a href="#M000012">solr_destroy</a>&nbsp;&nbsp;
- <a href="#M000009">solr_id</a>&nbsp;&nbsp;
- <a href="#M000010">solr_save</a>&nbsp;&nbsp;
- <a href="#M000013">to_solr_doc</a>&nbsp;&nbsp;
- </div>
- </div>
-
- </div>
-
-
- <!-- if includes -->
-
- <div id="section">
-
-
-
-
-
-
-
-
- <!-- if method_list -->
- <div id="methods">
- <h3 class="section-bar">Public Instance methods</h3>
-
- <div id="method-M000011" class="method-detail">
- <a name="M000011"></a>
-
- <div class="method-heading">
- <a href="#M000011" class="method-signature">
- <span class="method-name">indexing_disabled?</span><span class="method-args">()</span>
- </a>
- </div>
-
- <div class="method-description">
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000011-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/instance_methods.rb, line 23</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">indexing_disabled?</span>
- <span class="ruby-identifier">evaluate_condition</span>(<span class="ruby-identifier">:offline</span>, <span class="ruby-keyword kw">self</span>) <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:if</span>]
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000012" class="method-detail">
- <a name="M000012"></a>
-
- <div class="method-heading">
- <a href="#M000012" class="method-signature">
- <span class="method-name">solr_destroy</span><span class="method-args">()</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-remove from index
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000012-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/instance_methods.rb, line 28</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">solr_destroy</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">indexing_disabled?</span>
- <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">&quot;solr_destroy: #{self.class.name} : #{record_id(self)}&quot;</span>
- <span class="ruby-identifier">solr_delete</span> <span class="ruby-identifier">solr_id</span>
- <span class="ruby-identifier">solr_commit</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:auto_commit</span>]
- <span class="ruby-keyword kw">true</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000009" class="method-detail">
- <a name="M000009"></a>
-
- <div class="method-heading">
- <a href="#M000009" class="method-signature">
- <span class="method-name">solr_id</span><span class="method-args">()</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Solr id is &lt;class.name&gt;:&lt;id&gt; to be unique across all models
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000009-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/instance_methods.rb, line 6</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">solr_id</span>
- <span class="ruby-node">&quot;#{self.class.name}:#{record_id(self)}&quot;</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000010" class="method-detail">
- <a name="M000010"></a>
-
- <div class="method-heading">
- <a href="#M000010" class="method-signature">
- <span class="method-name">solr_save</span><span class="method-args">()</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-saves to the Solr index
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000010-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/instance_methods.rb, line 11</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">solr_save</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">indexing_disabled?</span>
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">evaluate_condition</span>(<span class="ruby-identifier">:if</span>, <span class="ruby-keyword kw">self</span>)
- <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">&quot;solr_save: #{self.class.name} : #{record_id(self)}&quot;</span>
- <span class="ruby-identifier">solr_add</span> <span class="ruby-identifier">to_solr_doc</span>
- <span class="ruby-identifier">solr_commit</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:auto_commit</span>]
- <span class="ruby-keyword kw">true</span>
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-identifier">solr_destroy</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000013" class="method-detail">
- <a name="M000013"></a>
-
- <div class="method-heading">
- <a href="#M000013" class="method-signature">
- <span class="method-name">to_solr_doc</span><span class="method-args">()</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-convert instance to Solr document
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000013-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/acts_as_solr/instance_methods.rb, line 37</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_solr_doc</span>
- <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">&quot;to_solr_doc: creating doc for class: #{self.class.name}, id: #{record_id(self)}&quot;</span>
- <span class="ruby-identifier">doc</span> = <span class="ruby-constant">Solr</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>
- <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">boost</span> = <span class="ruby-identifier">validate_boost</span>(<span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:boost</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:boost</span>]
-
- <span class="ruby-identifier">doc</span> <span class="ruby-operator">&lt;&lt;</span> {<span class="ruby-identifier">:id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">solr_id</span>,
- <span class="ruby-identifier">solr_configuration</span>[<span class="ruby-identifier">:type_field</span>] =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>,
- <span class="ruby-identifier">solr_configuration</span>[<span class="ruby-identifier">:primary_key_field</span>] =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">record_id</span>(<span class="ruby-keyword kw">self</span>).<span class="ruby-identifier">to_s</span>}
-
- <span class="ruby-comment cmt"># iterate through the fields and add them to the document,</span>
- <span class="ruby-identifier">configuration</span>[<span class="ruby-identifier">:solr_fields</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">field_name</span>, <span class="ruby-identifier">options</span><span class="ruby-operator">|</span>
- <span class="ruby-comment cmt">#field_type = configuration[:facets] &amp;&amp; configuration[:facets].include?(field) ? :facet : :text</span>
-
- <span class="ruby-identifier">field_boost</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:boost</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">solr_configuration</span>[<span class="ruby-identifier">:default_boost</span>]
- <span class="ruby-identifier">field_type</span> = <span class="ruby-identifier">get_solr_field_type</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:type</span>])
- <span class="ruby-identifier">solr_name</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:as</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">field_name</span>
-
- <span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{field_name}_for_solr&quot;</span>)
- <span class="