README.rdoc in xapian_db-1.2.3 vs README.rdoc in xapian_db-1.2.4
- old
+ new
@@ -1,7 +1,9 @@
= XapianDb
+{<img src="https://secure.travis-ci.org/garaio/xapian_db.png" />}[http://travis-ci.org/garaio/xapian_db]
+
== Important Information
If you upgrade from an earlier version of xapian_db to 1.1, you MUST rebuild your entire index (XapianDb.rebuild_xapian_index)!
== What's in the box?
@@ -126,16 +128,17 @@
blueprint.attributes :name, :first_name, :profession
blueprint.index :notes, :remarks, :cv
blueprint.ignore_if {active == false}
end
-You can add a type information to an attribute. As of now the special types :string, :date and :number are supported (and required for range queries):
+You can add a type information to an attribute. As of now the special types :string, :date, :date_time and :number are supported (and required for range queries):
XapianDb::DocumentBlueprint.setup(:Person) do |blueprint|
blueprint.attribute :age, :as => :number
blueprint.attribute :date_of_birth, :as => :date
blueprint.attribute :name, :as => :string
+ blueprint.attribute :updated_at, :as => :date_time
end
You can override the global adapter configuration in a specific blueprint. Let's say you use ActiveRecord, but you have
one more class that is not stored in the database, but you want it to be indexed:
@@ -161,9 +164,18 @@
XapianDb::DocumentBlueprint.setup(:Person) do |blueprint|
blueprint.natural_sort_order do
"#{surname} #{name}"
end
end
+
+If you want to manage the (re)indexing of your objects on your own, turn off autoindexing in your blueprint:
+
+ XapianDb::DocumentBlueprint.setup(:Person) do |blueprint|
+ blueprint.autoindex false
+ end
+
+This will turn off the auto-reindexing for any object of the configured class. Use XapianDb.reindex(object) to trigger the reindexing logic in your code. Please note that destroying an object will always remove it from the xapian index.
+
Place these configurations either into the corresponding class or - I prefer to have the index configurations outside
the models - into the file config/xapian_blueprints.rb.
IMPORTANT: Do not place them into an initializer, this will not work when cache_classes is set to false (default in config/development.rb).