search_magic 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +44 -27
- data/README.markdown +397 -0
- data/lib/search_magic.rb +2 -0
- data/lib/search_magic/breadcrumb.rb +1 -1
- data/lib/search_magic/full_text_search.rb +11 -4
- data/lib/search_magic/metadata.rb +14 -2
- data/lib/search_magic/version.rb +1 -1
- data/search_magic.gemspec +2 -0
- data/spec/fabricators/developer_fabricator.rb +4 -0
- data/spec/fabricators/field_skip_prefix_fabricator.rb +3 -0
- data/spec/models/field_skip_prefix.rb +7 -0
- data/spec/models/game.rb +1 -1
- data/spec/models/model_with_field_types.rb +22 -0
- data/spec/unit/search_magic/arrangements_spec.rb +2 -2
- data/spec/unit/search_magic/breadcrumb_spec.rb +33 -0
- data/spec/unit/search_magic/configuration_spec.rb +28 -0
- data/spec/unit/search_magic/date_parsing_spec.rb +15 -0
- data/spec/unit/search_magic/fields_spec.rb +31 -0
- data/spec/unit/search_magic/metadata_spec.rb +23 -0
- data/spec/unit/search_magic/metadata_type_spec.rb +19 -0
- data/spec/unit/search_magic/simple_inclusion_model_spec.rb +2 -0
- data/spec/unit/search_magic/stack_frame_spec.rb +28 -0
- metadata +106 -71
- data/README.textile +0 -178
data/lib/search_magic.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
module SearchMagic
|
2
|
+
require 'chronic'
|
2
3
|
require 'search_magic/breadcrumb'
|
3
4
|
require 'search_magic/stack_frame'
|
4
5
|
require 'search_magic/metadata'
|
5
6
|
require 'search_magic/full_text_search'
|
7
|
+
include ActiveSupport::Configurable
|
6
8
|
extend ActiveSupport::Concern
|
7
9
|
|
8
10
|
included do
|
@@ -10,7 +10,7 @@ module SearchMagic
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def term
|
13
|
-
@term ||= options[:skip_prefix].presence ? nil : (options[:as] || field_name.to_s.pluralize.singularize)
|
13
|
+
@term ||= options[:skip_prefix].presence ? nil : (options[:as] || field_name.to_s.pluralize.singularize).to_sym
|
14
14
|
end
|
15
15
|
|
16
16
|
def clone
|
@@ -29,12 +29,19 @@ module SearchMagic
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def search_for(pattern)
|
32
|
+
separator = Regexp.escape(SearchMagic.config.selector_value_separator || ':')
|
32
33
|
rval = /("[^"]+"|'[^']+'|\S+)/
|
33
|
-
rsearch = /(?:(#{searchables.keys.join('|')})
|
34
|
+
rsearch = /(?:(#{searchables.keys.join('|')})#{separator}#{rval})|#{rval}/i
|
34
35
|
unless pattern.blank?
|
35
36
|
terms = pattern.scan(rsearch).map(&:compact).map do |term|
|
36
|
-
term.
|
37
|
-
|
37
|
+
selector = term.length > 1 ? Regexp.escape(term.first) : "[^#{separator}]+"
|
38
|
+
metadata = searchables[term.first.to_sym] if term.length > 1
|
39
|
+
parsed_date = Chronic.parse(term.last) if metadata && metadata.datable?
|
40
|
+
prefix = "#{selector}#{separator}"
|
41
|
+
prefix = "(#{prefix})?" if term.length == 1
|
42
|
+
fragment = /#{selector}#{separator}#{parsed_date}/i if parsed_date
|
43
|
+
fragment || term.last.scan(/\b(\S+)\b/).flatten.map do |word|
|
44
|
+
/#{prefix}.*#{Regexp.escape(word)}/i
|
38
45
|
end
|
39
46
|
end.flatten
|
40
47
|
all_in(:searchable_values => terms)
|
@@ -62,7 +69,7 @@ module SearchMagic
|
|
62
69
|
if association = current.type.reflect_on_association(field_name)
|
63
70
|
stack << StackFrame.new(association.class_name.constantize, path)
|
64
71
|
else
|
65
|
-
fields << Metadata.new(:
|
72
|
+
fields << Metadata.new(:type => current.type.fields[field_name.to_s].try(:type) || Object, :through => path, :options => options)
|
66
73
|
end
|
67
74
|
end
|
68
75
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module SearchMagic
|
2
2
|
class Metadata
|
3
|
-
attr_accessor :
|
3
|
+
attr_accessor :type, :through, :options
|
4
4
|
|
5
5
|
def initialize(attributes = {})
|
6
6
|
attributes.each do |key, value|
|
@@ -11,6 +11,18 @@ module SearchMagic
|
|
11
11
|
def name
|
12
12
|
@name ||= through.map(&:term).compact.join("_").to_sym
|
13
13
|
end
|
14
|
+
|
15
|
+
def comparable?
|
16
|
+
@comparable ||= self.type.public_instance_methods.include? :<
|
17
|
+
end
|
18
|
+
|
19
|
+
def datable?
|
20
|
+
@datable ||= [Date, DateTime, Time].include? self.type
|
21
|
+
end
|
22
|
+
|
23
|
+
def unnameable?
|
24
|
+
@unnameable ||= self.name == :""
|
25
|
+
end
|
14
26
|
|
15
27
|
def value_for(obj, keep_punctuation)
|
16
28
|
v = get_value(obj)
|
@@ -24,7 +36,7 @@ module SearchMagic
|
|
24
36
|
end
|
25
37
|
|
26
38
|
def searchable_value_for(obj)
|
27
|
-
value_for(obj, options[:keep_punctuation]).downcase.split.map {|word| [name, word].join(
|
39
|
+
value_for(obj, options[:keep_punctuation]).downcase.split.map {|word| [name.blank? ? nil : name, word].compact.join(SearchMagic.config.selector_value_separator || ':')}
|
28
40
|
end
|
29
41
|
|
30
42
|
private
|
data/lib/search_magic/version.rb
CHANGED
data/search_magic.gemspec
CHANGED
@@ -13,10 +13,12 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = %q{Adds scopes to a Mongoid document providing search and sort capabilities on arbitrary fields and associations.}
|
14
14
|
|
15
15
|
s.add_dependency("mongoid", ">= 2.0.0")
|
16
|
+
s.add_dependency("chronic")
|
16
17
|
s.add_development_dependency("rspec")
|
17
18
|
s.add_development_dependency("database_cleaner")
|
18
19
|
s.add_development_dependency("bson_ext")
|
19
20
|
s.add_development_dependency("fabrication")
|
21
|
+
s.add_development_dependency('ruby-debug19')
|
20
22
|
|
21
23
|
s.rubyforge_project = "search_magic"
|
22
24
|
|
data/spec/models/game.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
class ModelWithFieldTypes
|
2
|
+
include Mongoid::Document
|
3
|
+
include SearchMagic
|
4
|
+
field :generic_field
|
5
|
+
field :string_field, :type => String
|
6
|
+
field :int_field, :type => Integer
|
7
|
+
field :date_field, :type => Date
|
8
|
+
field :float_field, :type => Float
|
9
|
+
field :bool_field, :type => Boolean
|
10
|
+
|
11
|
+
def some_value
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
search_on :generic_field
|
16
|
+
search_on :string_field
|
17
|
+
search_on :int_field
|
18
|
+
search_on :date_field
|
19
|
+
search_on :float_field
|
20
|
+
search_on :bool_field
|
21
|
+
search_on :some_value
|
22
|
+
end
|
@@ -47,7 +47,7 @@ describe SearchMagic::FullTextSearch do
|
|
47
47
|
before(:each) do
|
48
48
|
Asset.create(:title => "Foo Bar: The Bazzening", :description => "Sequel to last years hit summer blockbuster.", :tags => ["movies", "suspense", "foo.bar", "the-bazzening"])
|
49
49
|
Asset.create(:title => "Undercover Foo", :description => "When a foo goes undercover, how far will he go to protect those he loves?", :tags => ["movies", "action", "undercover.foo"])
|
50
|
-
Asset.create(:title => "Cheese of the Damned", :description => "This is not your father's munster.", :tags => ["movies", "horror", "cheese", "munster"])
|
50
|
+
Asset.create(:title => "Cheese of the Damned", :description => "This is not your father's munster.", :tags => ["movies", "horror", "cheese", "munster", "zamorano"])
|
51
51
|
end
|
52
52
|
|
53
53
|
context "when arranging a model by nil" do
|
@@ -108,6 +108,6 @@ describe SearchMagic::FullTextSearch do
|
|
108
108
|
|
109
109
|
it_should_behave_like "arranged assets", :title, :desc, ["Undercover Foo", "Foo Bar: The Bazzening", "Cheese of the Damned"]
|
110
110
|
it_should_behave_like "arranged assets", :description, :desc, ["Undercover Foo", "Cheese of the Damned", "Foo Bar: The Bazzening"]
|
111
|
-
it_should_behave_like "arranged assets", :tag, :desc, ["
|
111
|
+
it_should_behave_like "arranged assets", :tag, :desc, ["Cheese of the Damned", "Undercover Foo", "Foo Bar: The Bazzening"]
|
112
112
|
end
|
113
113
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SearchMagic::Breadcrumb do
|
4
|
+
context "when creating a breadcrumb without any options" do
|
5
|
+
subject { SearchMagic::Breadcrumb.new(:a_field, {}) }
|
6
|
+
its(:options) { should_not be_blank }
|
7
|
+
its(:options) { should include(:only => [], :except => []) }
|
8
|
+
its(:field_name) { should == :a_field }
|
9
|
+
its(:term) { should == :a_field }
|
10
|
+
end
|
11
|
+
|
12
|
+
context "when creating a breadcrumb with the :skip_prefix option" do
|
13
|
+
subject { SearchMagic::Breadcrumb.new(:a_field, :skip_prefix => true) }
|
14
|
+
its(:field_name) { should == :a_field }
|
15
|
+
its(:term) { should be_nil }
|
16
|
+
end
|
17
|
+
|
18
|
+
context "when creating a breadcrumb with the :as option" do
|
19
|
+
subject { SearchMagic::Breadcrumb.new(:a_field, :as => :something_completely_different) }
|
20
|
+
its(:field_name) { should == :a_field }
|
21
|
+
its(:term) { should == :something_completely_different }
|
22
|
+
end
|
23
|
+
|
24
|
+
context "when creating a breadcrumb with an array for the :only and :except options" do
|
25
|
+
subject { SearchMagic::Breadcrumb.new(:a_collection, :only => [:foo, :bar], :except => [:baz]) }
|
26
|
+
its(:options) { should include(:only => [:foo, :bar], :except => [:baz]) }
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when creating a breadcrumb with a singular value for the :only and :except options" do
|
30
|
+
subject { SearchMagic::Breadcrumb.new(:a_collection, :only => :foo, :except => :bar) }
|
31
|
+
its(:options) { should include(:only => [:foo], :except => [:bar]) }
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
describe SearchMagic do
|
2
|
+
it { should respond_to(:config) }
|
3
|
+
|
4
|
+
shared_examples_for "selector_value_separator" do |separator|
|
5
|
+
context "with a configuration for :selector_value_separator of '#{separator}'" do
|
6
|
+
let(:tags) { %w{foo b.a.r b-az q:ux z!png p'zow} }
|
7
|
+
before(:each) { SearchMagic.config.selector_value_separator = separator }
|
8
|
+
before(:each) { Fabricate(:asset, :tags => tags) }
|
9
|
+
after(:each) { SearchMagic.config.selector_value_separator = nil }
|
10
|
+
let(:asset) { Asset.first }
|
11
|
+
describe do
|
12
|
+
subject { asset }
|
13
|
+
its(:searchable_values) { should include( *tags.map {|tag| "tag#{separator || ':'}#{tag}"} ) }
|
14
|
+
end
|
15
|
+
describe "searching for models should use '#{separator || ':'}'" do
|
16
|
+
subject { Asset.search_for("tag#{separator || ':'}foo") }
|
17
|
+
its(:count) { should == 1 }
|
18
|
+
its(:first) { should == asset }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it_should_behave_like "selector_value_separator", nil
|
24
|
+
it_should_behave_like "selector_value_separator", ':'
|
25
|
+
it_should_behave_like "selector_value_separator", '/'
|
26
|
+
it_should_behave_like "selector_value_separator", '-'
|
27
|
+
it_should_behave_like "selector_value_separator", '!'
|
28
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SearchMagic do
|
4
|
+
context "when searching for natural language dates and times" do
|
5
|
+
subject { Developer.search_for("opened_on:yesterday") }
|
6
|
+
its(:selector) { should_not include(:searchable_values => {"$all" => [/opened_on:.*yesterday/i]}) }
|
7
|
+
it { subject.selector[:searchable_values]["$all"].first.to_s.should match(/opened_on:#{1.day.ago.to_date}/)}
|
8
|
+
end
|
9
|
+
|
10
|
+
context "when searching for a complex natural language date or time" do
|
11
|
+
subject { Developer.search_for("opened_on:'1 year ago'") }
|
12
|
+
its(:selector) { should_not include(:searchable_values => {"$all" => [/opened_on:.*1/i, /opened_on:.*year/i, /opened_on:.*ago/i]}) }
|
13
|
+
it { subject.selector[:searchable_values]["$all"].first.to_s.should match(/opened_on:#{1.year.ago.to_date}/)}
|
14
|
+
end
|
15
|
+
end
|
@@ -130,4 +130,35 @@ describe SearchMagic::FullTextSearch do
|
|
130
130
|
it { should include("Undercover Foo", "Foo Bar: The Bazzening") }
|
131
131
|
end
|
132
132
|
end
|
133
|
+
|
134
|
+
context "when working with a model with :skip_prefix on a field" do
|
135
|
+
subject { FieldSkipPrefix }
|
136
|
+
its('searchable_fields.keys') { should include(:name) }
|
137
|
+
its('searchables.keys') { should include(:"") }
|
138
|
+
end
|
139
|
+
|
140
|
+
context "when searching for a model with :skip_prefix on a field" do
|
141
|
+
before(:each) do
|
142
|
+
5.times { Fabricate(:field_skip_prefix) }
|
143
|
+
end
|
144
|
+
|
145
|
+
let(:dirigible) { Fabricate(:field_skip_prefix, :name => "Dirigible") }
|
146
|
+
|
147
|
+
context "the field should not be prefixed in :searchable_values" do
|
148
|
+
subject { dirigible }
|
149
|
+
its(:searchable_values) { should include("dirigible") }
|
150
|
+
its(:searchable_values) { should_not include("name:dirigible") }
|
151
|
+
its(:searchable_values) { should_not include(":dirigible") }
|
152
|
+
end
|
153
|
+
|
154
|
+
context "searching on that field should return nothing" do
|
155
|
+
subject { FieldSkipPrefix.search_for("name:test") }
|
156
|
+
its(:count) { should == 0 }
|
157
|
+
end
|
158
|
+
|
159
|
+
context "performing a full text search should return instances" do
|
160
|
+
subject { FieldSkipPrefix.search_for("test") }
|
161
|
+
its(:count) { should == 5 }
|
162
|
+
end
|
163
|
+
end
|
133
164
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SearchMagic::Metadata do
|
4
|
+
context "when dealing with a single breadcrumb" do
|
5
|
+
subject { SearchMagic::Metadata.new(:through => [SearchMagic::Breadcrumb.new(:foo, {})]) }
|
6
|
+
its(:name) { should == :foo }
|
7
|
+
end
|
8
|
+
|
9
|
+
context "when dealing with breadcrumbs without options" do
|
10
|
+
subject { SearchMagic::Metadata.new(:through => [SearchMagic::Breadcrumb.new(:foo, {}), SearchMagic::Breadcrumb.new(:bar, {}), SearchMagic::Breadcrumb.new(:baz, {})]) }
|
11
|
+
its(:name) { should == :foo_bar_baz }
|
12
|
+
end
|
13
|
+
|
14
|
+
context "when dealing with breadcrumbs with :skip_prefix" do
|
15
|
+
subject { SearchMagic::Metadata.new(through: [SearchMagic::Breadcrumb.new(:foo, {skip_prefix: true}), SearchMagic::Breadcrumb.new(:bar, {})]) }
|
16
|
+
its(:name) { should == :bar }
|
17
|
+
end
|
18
|
+
|
19
|
+
context "when dealing with breadcrumbs with :skip_prefix and :as options" do
|
20
|
+
subject { SearchMagic::Metadata.new(:through => [SearchMagic::Breadcrumb.new(:foo, {}), SearchMagic::Breadcrumb.new(:bar, {:skip_prefix => true}), SearchMagic::Breadcrumb.new(:baz, {:as => :qux})]) }
|
21
|
+
its(:name) { should == :foo_qux }
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
describe SearchMagic do
|
2
|
+
context "when included in a model which defines field types" do
|
3
|
+
subject { ModelWithFieldTypes.searchables }
|
4
|
+
it { subject[:generic_field].type.should == Mongoid::Fields::Serializable::Object }
|
5
|
+
it { subject[:generic_field].comparable?.should be_false }
|
6
|
+
it { subject[:string_field].type.should == String }
|
7
|
+
it { subject[:string_field].comparable?.should be_true }
|
8
|
+
it { subject[:float_field].type.should == Float }
|
9
|
+
it { subject[:float_field].comparable?.should be_true }
|
10
|
+
it { subject[:int_field].type.should == Integer }
|
11
|
+
it { subject[:int_field].comparable?.should be_true }
|
12
|
+
it { subject[:date_field].type.should == Date }
|
13
|
+
it { subject[:date_field].comparable?.should be_true }
|
14
|
+
it { subject[:bool_field].type.should == Boolean }
|
15
|
+
it { subject[:bool_field].comparable?.should be_false }
|
16
|
+
it { subject[:some_value].type.should == Object }
|
17
|
+
it { subject[:some_value].comparable?.should be_false }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SearchMagic::StackFrame do
|
4
|
+
context "when looking at a stack frame with breadcrumbs containing no exceptions" do
|
5
|
+
subject { SearchMagic::StackFrame.new(Object, [SearchMagic::Breadcrumb.new(:a_collection, {})]) }
|
6
|
+
it { subject.wants_field?(:foo).should be_true }
|
7
|
+
it { subject.wants_field?(:bar).should be_true }
|
8
|
+
end
|
9
|
+
|
10
|
+
context "when looking at a stack frame with the current breadcrumb containing an only" do
|
11
|
+
subject { SearchMagic::StackFrame.new(Object, [SearchMagic::Breadcrumb.new(:a_collection, {:only => :foo})]) }
|
12
|
+
it { subject.wants_field?(:foo).should be_true }
|
13
|
+
it { subject.wants_field?(:bar).should be_false }
|
14
|
+
end
|
15
|
+
|
16
|
+
context "when looking at a stack frame with the current breadcrumb containing an except" do
|
17
|
+
subject { SearchMagic::StackFrame.new(Object, [SearchMagic::Breadcrumb.new(:a_collection, {:except => :foo})]) }
|
18
|
+
it { subject.wants_field?(:foo).should be_false }
|
19
|
+
it { subject.wants_field?(:bar).should be_true }
|
20
|
+
end
|
21
|
+
|
22
|
+
context "when looking at a stack frame with the current breadcrumb having overlapping only and except" do
|
23
|
+
subject { SearchMagic::StackFrame.new(Object, [SearchMagic::Breadcrumb.new(:a_collection, {:except => :foo, :only => [:foo, :bar, :baz]})]) }
|
24
|
+
it { subject.wants_field?(:foo).should be_false }
|
25
|
+
it { subject.wants_field?(:bar).should be_true }
|
26
|
+
it { subject.wants_field?(:baz).should be_true }
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,87 +1,105 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: search_magic
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Joshua Bowers
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-12-03 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: mongoid
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70196635537280 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
24
21
|
version: 2.0.0
|
25
22
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: *70196635537280
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: chronic
|
27
|
+
requirement: &70196635536820 !ruby/object:Gem::Requirement
|
31
28
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70196635536820
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &70196635536300 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
36
44
|
type: :development
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: database_cleaner
|
40
45
|
prerelease: false
|
41
|
-
|
46
|
+
version_requirements: *70196635536300
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: database_cleaner
|
49
|
+
requirement: &70196635535760 !ruby/object:Gem::Requirement
|
42
50
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
47
55
|
type: :development
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: bson_ext
|
51
56
|
prerelease: false
|
52
|
-
|
57
|
+
version_requirements: *70196635535760
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: bson_ext
|
60
|
+
requirement: &70196635535140 !ruby/object:Gem::Requirement
|
53
61
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
58
66
|
type: :development
|
59
|
-
|
60
|
-
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70196635535140
|
69
|
+
- !ruby/object:Gem::Dependency
|
61
70
|
name: fabrication
|
71
|
+
requirement: &70196635534340 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
62
78
|
prerelease: false
|
63
|
-
|
79
|
+
version_requirements: *70196635534340
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: ruby-debug19
|
82
|
+
requirement: &70196635533880 !ruby/object:Gem::Requirement
|
64
83
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version:
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
69
88
|
type: :development
|
70
|
-
|
71
|
-
|
72
|
-
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70196635533880
|
91
|
+
description: Adds scopes to a Mongoid document providing search and sort capabilities
|
92
|
+
on arbitrary fields and associations.
|
93
|
+
email:
|
73
94
|
- joshua.bowers+code@gmail.com
|
74
95
|
executables: []
|
75
|
-
|
76
96
|
extensions: []
|
77
|
-
|
78
97
|
extra_rdoc_files: []
|
79
|
-
|
80
|
-
files:
|
98
|
+
files:
|
81
99
|
- .gitignore
|
82
100
|
- Gemfile
|
83
101
|
- Gemfile.lock
|
84
|
-
- README.
|
102
|
+
- README.markdown
|
85
103
|
- Rakefile
|
86
104
|
- lib/search_magic.rb
|
87
105
|
- lib/search_magic/breadcrumb.rb
|
@@ -91,16 +109,20 @@ files:
|
|
91
109
|
- lib/search_magic/version.rb
|
92
110
|
- search_magic.gemspec
|
93
111
|
- spec/fabricators/asset_fabricator.rb
|
112
|
+
- spec/fabricators/developer_fabricator.rb
|
113
|
+
- spec/fabricators/field_skip_prefix_fabricator.rb
|
94
114
|
- spec/fabricators/simple_inclusion_model_fabricator.rb
|
95
115
|
- spec/models/absolutely_not_searchable.rb
|
96
116
|
- spec/models/address.rb
|
97
117
|
- spec/models/asset.rb
|
98
118
|
- spec/models/custom_method_searchable.rb
|
99
119
|
- spec/models/developer.rb
|
120
|
+
- spec/models/field_skip_prefix.rb
|
100
121
|
- spec/models/game.rb
|
101
122
|
- spec/models/graph_1_model_a.rb
|
102
123
|
- spec/models/graph_1_model_b.rb
|
103
124
|
- spec/models/is_searchable.rb
|
125
|
+
- spec/models/model_with_field_types.rb
|
104
126
|
- spec/models/no_searchables.rb
|
105
127
|
- spec/models/part.rb
|
106
128
|
- spec/models/part_category.rb
|
@@ -112,51 +134,58 @@ files:
|
|
112
134
|
- spec/spec_helper.rb
|
113
135
|
- spec/unit/search_magic/arrangements_spec.rb
|
114
136
|
- spec/unit/search_magic/associations_spec.rb
|
137
|
+
- spec/unit/search_magic/breadcrumb_spec.rb
|
138
|
+
- spec/unit/search_magic/configuration_spec.rb
|
139
|
+
- spec/unit/search_magic/date_parsing_spec.rb
|
115
140
|
- spec/unit/search_magic/fields_spec.rb
|
116
141
|
- spec/unit/search_magic/graph_searches_spec.rb
|
142
|
+
- spec/unit/search_magic/metadata_spec.rb
|
143
|
+
- spec/unit/search_magic/metadata_type_spec.rb
|
117
144
|
- spec/unit/search_magic/model_updates_spec.rb
|
118
145
|
- spec/unit/search_magic/search_pattern_syntax_spec.rb
|
119
146
|
- spec/unit/search_magic/simple_inclusion_model_spec.rb
|
120
|
-
|
147
|
+
- spec/unit/search_magic/stack_frame_spec.rb
|
121
148
|
homepage: http://github.com/joshuabowers/search_magic
|
122
149
|
licenses: []
|
123
|
-
|
124
150
|
post_install_message:
|
125
151
|
rdoc_options: []
|
126
|
-
|
127
|
-
require_paths:
|
152
|
+
require_paths:
|
128
153
|
- lib
|
129
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
155
|
none: false
|
131
|
-
requirements:
|
132
|
-
- -
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
version:
|
135
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
161
|
none: false
|
137
|
-
requirements:
|
138
|
-
- -
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
version:
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
141
166
|
requirements: []
|
142
|
-
|
143
167
|
rubyforge_project: search_magic
|
144
|
-
rubygems_version: 1.
|
168
|
+
rubygems_version: 1.8.10
|
145
169
|
signing_key:
|
146
170
|
specification_version: 3
|
147
|
-
summary: SearchMagic provides scoped full text search and sort capabilities to Mongoid
|
148
|
-
|
171
|
+
summary: SearchMagic provides scoped full text search and sort capabilities to Mongoid
|
172
|
+
documents
|
173
|
+
test_files:
|
149
174
|
- spec/fabricators/asset_fabricator.rb
|
175
|
+
- spec/fabricators/developer_fabricator.rb
|
176
|
+
- spec/fabricators/field_skip_prefix_fabricator.rb
|
150
177
|
- spec/fabricators/simple_inclusion_model_fabricator.rb
|
151
178
|
- spec/models/absolutely_not_searchable.rb
|
152
179
|
- spec/models/address.rb
|
153
180
|
- spec/models/asset.rb
|
154
181
|
- spec/models/custom_method_searchable.rb
|
155
182
|
- spec/models/developer.rb
|
183
|
+
- spec/models/field_skip_prefix.rb
|
156
184
|
- spec/models/game.rb
|
157
185
|
- spec/models/graph_1_model_a.rb
|
158
186
|
- spec/models/graph_1_model_b.rb
|
159
187
|
- spec/models/is_searchable.rb
|
188
|
+
- spec/models/model_with_field_types.rb
|
160
189
|
- spec/models/no_searchables.rb
|
161
190
|
- spec/models/part.rb
|
162
191
|
- spec/models/part_category.rb
|
@@ -168,8 +197,14 @@ test_files:
|
|
168
197
|
- spec/spec_helper.rb
|
169
198
|
- spec/unit/search_magic/arrangements_spec.rb
|
170
199
|
- spec/unit/search_magic/associations_spec.rb
|
200
|
+
- spec/unit/search_magic/breadcrumb_spec.rb
|
201
|
+
- spec/unit/search_magic/configuration_spec.rb
|
202
|
+
- spec/unit/search_magic/date_parsing_spec.rb
|
171
203
|
- spec/unit/search_magic/fields_spec.rb
|
172
204
|
- spec/unit/search_magic/graph_searches_spec.rb
|
205
|
+
- spec/unit/search_magic/metadata_spec.rb
|
206
|
+
- spec/unit/search_magic/metadata_type_spec.rb
|
173
207
|
- spec/unit/search_magic/model_updates_spec.rb
|
174
208
|
- spec/unit/search_magic/search_pattern_syntax_spec.rb
|
175
209
|
- spec/unit/search_magic/simple_inclusion_model_spec.rb
|
210
|
+
- spec/unit/search_magic/stack_frame_spec.rb
|