<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>generators/acts_as_xapian/USAGE</filename>
    </added>
    <added>
      <filename>generators/acts_as_xapian/acts_as_xapian_generator.rb</filename>
    </added>
    <added>
      <filename>generators/acts_as_xapian/templates/migration.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -88,7 +88,7 @@
 #         e.g. :texts =&gt; [ :title, :body ]
 # :values, things which have a range of values for indexing, or for collapsing. 
 #         Specify an array quadruple of [ field, identifier, prefix, type ] where 
-#         - number is an arbitary numeric identifier for use in the Xapian database
+#         - identifier is an arbitary numeric identifier for use in the Xapian database
 #         - prefix is the part to use in search queries that goes before the :
 #         - type can be any of :string, :number or :date
 #         e.g. :values =&gt; [ [ :created_at, 0, &quot;created_at&quot; ], [ :size, 1, &quot;size&quot;] ]
@@ -111,8 +111,10 @@
 # :if, either an attribute or a function which if returns false means the
 # object isn't indexed
 #
-# 2. Make and run the migration to create the ActsAsXapianJob model, code below
-# (search for ActsAsXapianJob).
+# 2. Make and run the migration to create the ActsAsXapianJob model:
+#    script/generate acts_as_xapian
+#
+#    (Or see code below in under ActsAsXapianJob).
 #
 # 3. Call 'rake xapian::rebuild_index models=&quot;ModelName1 ModelName2&quot;' to build the index
 # the first time (you must specify all your indexed models). It's put in a
@@ -249,40 +251,44 @@ module ActsAsXapian
             # and error check them - i.e. check for consistency between models
             @@query_parser.add_boolean_prefix(&quot;model&quot;, &quot;M&quot;)
             @@query_parser.add_boolean_prefix(&quot;modelid&quot;, &quot;I&quot;)
-            for term in options[:terms]
-                raise &quot;Use a single capital letter for term code&quot; if not term[1].match(/^[A-Z]$/)
-                raise &quot;M and I are reserved for use as the model/id term&quot; if term[1] == &quot;M&quot; or term[1] == &quot;I&quot;
-                raise &quot;model and modelid are reserved for use as the model/id prefixes&quot; if term[2] == &quot;model&quot; or term[2] == &quot;modelid&quot;
-                raise &quot;Z is reserved for stemming terms&quot; if term[1] == &quot;Z&quot;
-                raise &quot;Already have code '&quot; + term[1] + &quot;' in another model but with different prefix '&quot; + @@terms_by_capital[term[1]] + &quot;'&quot; if @@terms_by_capital.include?(term[1]) &amp;&amp; @@terms_by_capital[term[1]] != term[2]
-                @@terms_by_capital[term[1]] = term[2]
-                @@query_parser.add_boolean_prefix(term[2], term[1])
+            if options[:terms]
+              for term in options[:terms]
+                  raise &quot;Use a single capital letter for term code&quot; if not term[1].match(/^[A-Z]$/)
+                  raise &quot;M and I are reserved for use as the model/id term&quot; if term[1] == &quot;M&quot; or term[1] == &quot;I&quot;
+                  raise &quot;model and modelid are reserved for use as the model/id prefixes&quot; if term[2] == &quot;model&quot; or term[2] == &quot;modelid&quot;
+                  raise &quot;Z is reserved for stemming terms&quot; if term[1] == &quot;Z&quot;
+                  raise &quot;Already have code '&quot; + term[1] + &quot;' in another model but with different prefix '&quot; + @@terms_by_capital[term[1]] + &quot;'&quot; if @@terms_by_capital.include?(term[1]) &amp;&amp; @@terms_by_capital[term[1]] != term[2]
+                  @@terms_by_capital[term[1]] = term[2]
+                  @@query_parser.add_boolean_prefix(term[2], term[1])
+              end
             end
-            for value in options[:values]
-                raise &quot;Value index '&quot;+value[1].to_s+&quot;' must be an integer, is &quot; + value[1].class.to_s if value[1].class != 1.class
-                raise &quot;Already have value index '&quot; + value[1].to_s + &quot;' in another model but with different prefix '&quot; + @@values_by_number[value[1]].to_s + &quot;'&quot; if @@values_by_number.include?(value[1]) &amp;&amp; @@values_by_number[value[1]] != value[2]
-
-                # date types are special, mark them so the first model they're seen for
-                if !@@values_by_number.include?(value[1])
-                    if value[3] == :date 
-                        value_range = Xapian::DateValueRangeProcessor.new(value[1])
-                    elsif value[3] == :string 
-                        value_range = Xapian::StringValueRangeProcessor.new(value[1])
-                    elsif value[3] == :number
-                        value_range = Xapian::NumberValueRangeProcessor.new(value[1])
-                    else
-                        raise &quot;Unknown value type '&quot; + value[3].to_s + &quot;'&quot;
-                    end
-
-                    @@query_parser.add_valuerangeprocessor(value_range)
-
-                    # stop it being garbage collected, as
-                    # add_valuerangeprocessor ref is outside Ruby's GC
-                    @@value_ranges_store.push(value_range) 
-                end
-
-                @@values_by_number[value[1]] = value[2]
-                @@values_by_prefix[value[2]] = value[1]
+            if options[:values]
+              for value in options[:values]
+                  raise &quot;Value index '&quot;+value[1].to_s+&quot;' must be an integer, is &quot; + value[1].class.to_s if value[1].class != 1.class
+                  raise &quot;Already have value index '&quot; + value[1].to_s + &quot;' in another model but with different prefix '&quot; + @@values_by_number[value[1]].to_s + &quot;'&quot; if @@values_by_number.include?(value[1]) &amp;&amp; @@values_by_number[value[1]] != value[2]
+
+                  # date types are special, mark them so the first model they're seen for
+                  if !@@values_by_number.include?(value[1])
+                      if value[3] == :date 
+                          value_range = Xapian::DateValueRangeProcessor.new(value[1])
+                      elsif value[3] == :string 
+                          value_range = Xapian::StringValueRangeProcessor.new(value[1])
+                      elsif value[3] == :number
+                          value_range = Xapian::NumberValueRangeProcessor.new(value[1])
+                      else
+                          raise &quot;Unknown value type '&quot; + value[3].to_s + &quot;'&quot;
+                      end
+
+                      @@query_parser.add_valuerangeprocessor(value_range)
+
+                      # stop it being garbage collected, as
+                      # add_valuerangeprocessor ref is outside Ruby's GC
+                      @@value_ranges_store.push(value_range) 
+                  end
+
+                  @@values_by_number[value[1]] = value[2]
+                  @@values_by_prefix[value[2]] = value[1]
+              end
             end
         end
     end
@@ -433,6 +439,7 @@ module ActsAsXapian
     # Index
    
     # Offline indexing job queue model, create with this migration:
+    # (or use script/generate acts_as_xapian)
     #    class ActsAsXapianMigration &lt; ActiveRecord::Migration
     #        def self.up
     #           create_table :acts_as_xapian_jobs do |t|
@@ -445,7 +452,7 @@ module ActsAsXapian
     #        end
     #
     #        def self.down
-    #            remove_table :acts_as_xapian_jobs
+    #            drop_table :acts_as_xapian_jobs
     #        end
     #    end
     class ActsAsXapianJob &lt; ActiveRecord::Base
@@ -564,15 +571,21 @@ module ActsAsXapian
 
             doc.add_term(&quot;M&quot; + self.class.to_s)
             doc.add_term(&quot;I&quot; + doc.data)
-            for term in self.xapian_options[:terms]
-                doc.add_term(term[1] + xapian_value(term[0]))
+            if self.xapian_options[:terms]
+              for term in self.xapian_options[:terms]
+                  doc.add_term(term[1] + xapian_value(term[0]))
+              end
             end
-            for value in self.xapian_options[:values]
-                doc.add_value(value[1], xapian_value(value[0], value[3])) 
+            if self.xapian_options[:values]
+              for value in self.xapian_options[:values]
+                  doc.add_value(value[1], xapian_value(value[0], value[3])) 
+              end
             end
-            for text in self.xapian_options[:texts]
-                ActsAsXapian.term_generator.increase_termpos # stop phrases spanning different text fields
-                ActsAsXapian.term_generator.index_text(xapian_value(text)) 
+            if self.xapian_options[:texts]
+              for text in self.xapian_options[:texts]
+                  ActsAsXapian.term_generator.increase_termpos # stop phrases spanning different text fields
+                  ActsAsXapian.term_generator.index_text(xapian_value(text)) 
+              end
             end
 
             ActsAsXapian.writable_db.replace_document(&quot;I&quot; + doc.data, doc)</diff>
      <filename>lib/acts_as_xapian.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,8 @@
 require 'rubygems'
 require 'rake'
 require 'rake/testtask'
+require 'activerecord'
+require File.dirname(__FILE__) + '/../lib/acts_as_xapian.rb'
 
 namespace :xapian do
     # Parameters - specify &quot;flush=true&quot; to save changes to the Xapian database
@@ -16,7 +18,7 @@ namespace :xapian do
     # web server afterwards to make sure it gets the changes, rather than
     # still pointing to the old deleted database.
     desc 'Completely rebuilds Xapian search index (must specify all models)'
-    task :rebuild_index do
+    task (:rebuild_index =&gt; :environment) do
         raise &quot;specify ALL your models with models=\&quot;ModelName1 ModelName2\&quot; as parameter&quot; if ENV['models'].nil?
         ActsAsXapian.rebuild_index(ENV['models'].split(&quot; &quot;).map{|m| m.constantize})
     end
@@ -24,7 +26,7 @@ namespace :xapian do
     # Parameters - are models, query, offset, limit, sort_by_prefix,
     # collapse_by_prefix
     desc 'Run a query, return YAML of results'
-    task :query do
+    task (:query =&gt; :environment) do
         raise &quot;specify models=\&quot;ModelName1 ModelName2\&quot; as parameter&quot; if ENV['models'].nil?
         raise &quot;specify query=\&quot;your terms\&quot; as parameter&quot; if ENV['query'].nil?
         s = ActsAsXapian::Search.new(ENV['models'].split(&quot; &quot;).map{|m| m.constantize}, </diff>
      <filename>tasks/xapian.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f29f23658c4eb2c33583d14db59afedc2890639d</id>
    </parent>
    <parent>
      <id>a23c6d1df44c4074dd957af6369c88b9d18b1660</id>
    </parent>
  </parents>
  <author>
    <name>Francis Irving</name>
    <email>francis@cat.(none)</email>
  </author>
  <url>http://github.com/frabcus/acts_as_xapian/commit/9070c81ea69e67b20062d34c7d5ac9e6b44f9942</url>
  <id>9070c81ea69e67b20062d34c7d5ac9e6b44f9942</id>
  <committed-date>2008-05-16T07:27:10-07:00</committed-date>
  <authored-date>2008-05-16T07:27:10-07:00</authored-date>
  <message>Merge commit 'boone/master'

Conflicts:

	lib/acts_as_xapian.rb</message>
  <tree>fc6ee2ae319a23f5422cce3ad1a2af4b238d5df4</tree>
  <committer>
    <name>Francis Irving</name>
    <email>francis@cat.(none)</email>
  </committer>
</commit>
