Sha256: 25ad09257726021e9453be9f3bbf7d7d69e31d83fa07655152e45a43ac3b2a21
Contents?: true
Size: 1.98 KB
Versions: 2
Compression:
Stored size: 1.98 KB
Contents
require 'test_helper' class DslTest < ActiveSupport::TestCase test 'search' do seed = rand days = [1,2,3] opens_at = Time.now.to_i closes_at = (Time.now + 1.day).to_i assert_equal( { query: { function_score: { functions: [ { random_score: { seed: seed } }, { weight: 400, filter: { bool: { must: [ { term: {} } ] } } } ] }, query: { filtered: { filter: { bool: { should: [ { term: { :'schedules.days' => days } } ], must: [ { range: { :'schedules.opens_at' => { lte: opens_at } } } ], must_not: [] } } } } }, size: {} }, build_request do query do function_score do functions do random_score do seed seed end filter weight: 400 do bool do must do term end end end end end query do filtered do filter do bool do should do term 'schedules.days' => days end must do range 'schedules.opens_at' do lte opens_at end end must_not do end end end end end end size end ) end private def build_request(&block) Indexes::Dsl::Search.new(&block).to_h end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
indexes-4.0.0.0 | test/dsl_test.rb |
indexes-0.0.1 | test/dsl_test.rb |