diff options
| author | hukl <contact@smyck.org> | 2009-04-28 00:15:53 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-05-01 17:14:02 +0200 |
| commit | 4bd16f053847f2efe347ebda9136ef2233ee0d2c (patch) | |
| tree | f4c11f89455de991c8d87726d5757b752e7129e2 /vendor/plugins/thinking-sphinx/features/support/models | |
| parent | d3a9b46ba5c863a0ff377dcffae9a494fe476e02 (diff) | |
added thinking_sphinx plugin for fulltext search on nodes and heads
Diffstat (limited to 'vendor/plugins/thinking-sphinx/features/support/models')
16 files changed, 118 insertions, 0 deletions
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/alpha.rb b/vendor/plugins/thinking-sphinx/features/support/models/alpha.rb new file mode 100644 index 0000000..0973c1c --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/alpha.rb | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | class Alpha < ActiveRecord::Base | ||
| 2 | define_index do | ||
| 3 | indexes :name, :sortable => true | ||
| 4 | |||
| 5 | has value, cost, created_at, created_on | ||
| 6 | |||
| 7 | set_property :field_weights => {"name" => 10} | ||
| 8 | end | ||
| 9 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/animal.rb b/vendor/plugins/thinking-sphinx/features/support/models/animal.rb new file mode 100644 index 0000000..75f8cc5 --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/animal.rb | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | class Animal < ActiveRecord::Base | ||
| 2 | define_index do | ||
| 3 | indexes name, :sortable => true | ||
| 4 | end | ||
| 5 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/beta.rb b/vendor/plugins/thinking-sphinx/features/support/models/beta.rb new file mode 100644 index 0000000..096a78c --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/beta.rb | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | class Beta < ActiveRecord::Base | ||
| 2 | define_index do | ||
| 3 | indexes :name, :sortable => true | ||
| 4 | |||
| 5 | set_property :delta => true | ||
| 6 | end | ||
| 7 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/box.rb b/vendor/plugins/thinking-sphinx/features/support/models/box.rb new file mode 100644 index 0000000..bd948c4 --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/box.rb | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | class Box < ActiveRecord::Base | ||
| 2 | define_index do | ||
| 3 | indexes width, :as => :width_field | ||
| 4 | |||
| 5 | has width, length, depth | ||
| 6 | has [width, length, depth], :as => :dimensions | ||
| 7 | end | ||
| 8 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/cat.rb b/vendor/plugins/thinking-sphinx/features/support/models/cat.rb new file mode 100644 index 0000000..f6cf75a --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/cat.rb | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | class Cat < Animal | ||
| 2 | # | ||
| 3 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/category.rb b/vendor/plugins/thinking-sphinx/features/support/models/category.rb new file mode 100644 index 0000000..ea52b65 --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/category.rb | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | class Category < ActiveRecord::Base | ||
| 2 | has_many :posts | ||
| 3 | has_many :comments | ||
| 4 | end \ No newline at end of file | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/comment.rb b/vendor/plugins/thinking-sphinx/features/support/models/comment.rb new file mode 100644 index 0000000..a93451c --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/comment.rb | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | class Comment < ActiveRecord::Base | ||
| 2 | belongs_to :post | ||
| 3 | belongs_to :category | ||
| 4 | |||
| 5 | define_index do | ||
| 6 | indexes :content | ||
| 7 | |||
| 8 | has category.name, :facet => true, :as => :category_name, :type => :string | ||
| 9 | end | ||
| 10 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/delayed_beta.rb b/vendor/plugins/thinking-sphinx/features/support/models/delayed_beta.rb new file mode 100644 index 0000000..ccd9846 --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/delayed_beta.rb | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | class DelayedBeta < ActiveRecord::Base | ||
| 2 | define_index do | ||
| 3 | indexes :name, :sortable => true | ||
| 4 | |||
| 5 | set_property :delta => :delayed | ||
| 6 | end | ||
| 7 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/developer.rb b/vendor/plugins/thinking-sphinx/features/support/models/developer.rb new file mode 100644 index 0000000..d461ebc --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/developer.rb | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | class Developer < ActiveRecord::Base | ||
| 2 | has_many :taggings, :as => :taggable | ||
| 3 | has_many :tags, :through => :taggings | ||
| 4 | |||
| 5 | define_index do | ||
| 6 | indexes country, :facet => true | ||
| 7 | indexes state, :facet => true | ||
| 8 | has age, :facet => true | ||
| 9 | has tags(:id), :as => :tag_ids, :facet => true | ||
| 10 | facet city | ||
| 11 | end | ||
| 12 | end \ No newline at end of file | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/extensible_beta.rb b/vendor/plugins/thinking-sphinx/features/support/models/extensible_beta.rb new file mode 100644 index 0000000..40b64f5 --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/extensible_beta.rb | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | require File.join(File.dirname(__FILE__), "..", "lib", "generic_delta_handler") | ||
| 2 | |||
| 3 | class ExtensibleBeta < ActiveRecord::Base | ||
| 4 | define_index do | ||
| 5 | indexes :name, :sortable => true | ||
| 6 | |||
| 7 | set_property :delta => GenericDeltaHandler | ||
| 8 | end | ||
| 9 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/gamma.rb b/vendor/plugins/thinking-sphinx/features/support/models/gamma.rb new file mode 100644 index 0000000..5e9d259 --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/gamma.rb | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | class Gamma < ActiveRecord::Base | ||
| 2 | define_index do | ||
| 3 | indexes :name, :sortable => true | ||
| 4 | end | ||
| 5 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/person.rb b/vendor/plugins/thinking-sphinx/features/support/models/person.rb new file mode 100644 index 0000000..62a0a96 --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/person.rb | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | class Person < ActiveRecord::Base | ||
| 2 | define_index do | ||
| 3 | indexes first_name, last_name, :sortable => true | ||
| 4 | |||
| 5 | has [first_name, middle_initial, last_name], :as => :name_sort | ||
| 6 | has birthday | ||
| 7 | has gender, :facet => true | ||
| 8 | end | ||
| 9 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/post.rb b/vendor/plugins/thinking-sphinx/features/support/models/post.rb new file mode 100644 index 0000000..430d17c --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/post.rb | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | class Post < ActiveRecord::Base | ||
| 2 | has_many :comments, :dependent => :destroy | ||
| 3 | has_many :taggings, :as => :taggable | ||
| 4 | has_many :tags, :through => :taggings | ||
| 5 | belongs_to :category | ||
| 6 | |||
| 7 | define_index do | ||
| 8 | indexes subject | ||
| 9 | indexes content | ||
| 10 | indexes tags.text, :as => :tags | ||
| 11 | indexes comments.content, :as => :comments | ||
| 12 | |||
| 13 | has comments(:id), :as => :comment_ids, :source => :ranged_query | ||
| 14 | has category.name, :facet => true, :as => :category_name, :type => :string | ||
| 15 | end | ||
| 16 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/tag.rb b/vendor/plugins/thinking-sphinx/features/support/models/tag.rb new file mode 100644 index 0000000..30992e8 --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/tag.rb | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | class Tag < ActiveRecord::Base | ||
| 2 | belongs_to :post | ||
| 3 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/tagging.rb b/vendor/plugins/thinking-sphinx/features/support/models/tagging.rb new file mode 100644 index 0000000..33daf86 --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/tagging.rb | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | class Tagging < ActiveRecord::Base | ||
| 2 | belongs_to :tag | ||
| 3 | belongs_to :taggable, :polymorphic => true | ||
| 4 | end | ||
diff --git a/vendor/plugins/thinking-sphinx/features/support/models/theta.rb b/vendor/plugins/thinking-sphinx/features/support/models/theta.rb new file mode 100644 index 0000000..0ce91d6 --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/models/theta.rb | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | class Theta < ActiveRecord::Base | ||
| 2 | define_index do | ||
| 3 | indexes :name, :sortable => true | ||
| 4 | |||
| 5 | set_property :delta => :datetime, :threshold => 1.hour | ||
| 6 | end | ||
| 7 | end | ||
