spec/cloud_sesame_spec.rb in CloudSesame-0.4.6 vs spec/cloud_sesame_spec.rb in CloudSesame-0.5.0
- old
+ new
@@ -23,10 +23,14 @@
# # Usage Example
# # =======================================================
# class Product
# include CloudSesame
+# def self.greeting
+# "hello world!"
+# end
+
# define_cloudsearch do
# # Product CloudSesame Config
# config.endpoint = ENV['AWS_ENDPOINT']
# config.region = ENV['AWS_REGION']
@@ -60,30 +64,35 @@
# end
# end
-# # n = 10_000
-# # q = nil
-# # result = RubyProf.profile do
-# # n.times do
-# q = Product.cloudsearch.query("black jacket").sort(price: :asc).page(1).size(1000).and {
+# @tags = [1, 2]
+# n = 10_000
+# q = nil
+# result = RubyProf.profile do
+# n.times do
+# q = Product.cloudsearch.query("black jacket").sort(price: :asc).page(1).size(1000)
+# .price { gt 100 }
+# .and {
# or! {
-# tags "1", "2"
+# tags *@tags
+# tags
+# tags nil
# and! {
# tags.not "3", "4"
# }
# and!.not {
# tags.start_with "5", "6"
-# tags.not.start_with "7"
-# tags.not.near "8"
+# tags.not.start_with("7")
+# tags.not.near("8", distance: 7)
# tags start_with("9"), near("10")
-# tags term "11"
-# tags phrase "12"
+# tags term("11", boost: 2)
+# tags.not phrase "12"
# }
# or!.not {
-# price 25..100
+# price(25..100)
# price 100...200
# price gte(200).lt(300)
# price gte(300)
# }
# or! {
@@ -91,32 +100,36 @@
# created_at gte(Date.today)
# created_at gte(Date.today).lt(Date.today + 3)
# }
# }
# }
-# # q.applied_filters
+# q.applied_filters
-# # end
-# # end
-# # printer = RubyProf::FlatPrinter.new(result)
-# # printer.print(STDOUT, {})
+# end
+# end
+# printer = RubyProf::FlatPrinter.new(result)
+# printer.print(STDOUT, {})
# binding.pry
-# # class TestClass
-# # def initialize
+# # class ProductController
+
+# # def load_user
# # @name = "scott"
# # end
+
# # def greeting
# # "hello world!"
# # end
-# # def test_method
-# # local = :test
+
+# # def search
+# # load_user
# # q = Product.cloudsearch.and {
# # binding.pry
# # }
# # end
+
# # end
-# # test = TestClass.new
-# # test.test_method
+# # test = ProductController.new
+# # test.search
# end