README.rdoc in xapian_db-1.2.5.1 vs README.rdoc in xapian_db-1.3

- old
+ new

@@ -2,12 +2,15 @@ {<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)! +Version 1.3 does not support YAML serialization for attributes anymore. If you don't apply a type information for an attribute (like attribute :birth, as: :date) in your blueprint, +the attribute gets stored as a string. The new preferred type for complex attributes is JSON. Why the change? We were experiencing a unacceptable performance hit when we switched from Syck to Psych. The new philosophy for blueprints is therefore explicit type information. lib/type_codec.rb contains the most common codecs and of course, you can add your own (see examples/custom_serialization.rb). +<b>Please note: You may want to fine tune your blueprints and you MUST rebuild your xapian index when switching to version 1.3</b> + == What's in the box? XapianDb is a ruby gem that combines features of nosql databases and fulltext indexing into one piece. The result: Rich documents and very fast queries. It is based on {Xapian}[http://xapian.org/], an efficient and powerful indexing library. XapianDb is inspired by {xapian-fu}[https://github.com/johnl/xapian-fu] and {xapit}[https://github.com/ryanb/xapit]. @@ -137,17 +140,18 @@ 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, :date_time and :number are supported (and required for range queries): +You can add a type information to an attribute (default format is string). 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 + blueprint.attribute :address, :as => :json end If you don't need field searches for an attribute, turn off the prefixed option (makes your index smaller and more efficient): XapianDb::DocumentBlueprint.setup(:Person) do |blueprint| @@ -163,11 +167,11 @@ end If you use associations in your blueprints, it might be a good idea to specify a base query to speed up rebuild_xapian_index calls (avoiding 1+n queries): XapianDb::DocumentBlueprint.setup(:Person) do |blueprint| - blueprint.index :addresses + blueprint.index :addresses, as: :json blueprint.base_query { |p| p.includes(:addresses) } end You can specify a natural sort order for each class using a method symbol or a block. If you don't specify an order expression in your xapian query, the matches are ordered by relevance and - within the same relevance - by the natural sort order. If you don't specify the natural sort order, it defaults to id. Examples: @@ -372,10 +376,10 @@ end Person.rebuild_xapian_index == Add your own serializers for special objects -XapianDb serializes objects to xapian documents using YAML by default. This way, type information is preserved und you get back what you put into a xapian document, not just a string. +XapianDb serializes objects to xapian documents as strings by default. However, dates need special handling to support date range queries. To support date range queries and allow the addition of other custom data types in the future, XapianDb uses a simple, extensible mechanism to serialize / deserialize your objects. An example on how to extend this mechanism is provided in examples/custom_serialization.rb. == Term Splitting