Class: NoBrainer::Criteria::Where::IndexFinder::IndexStrategy
- Inherits:
-
Struct
- Object
- Struct
- NoBrainer::Criteria::Where::IndexFinder::IndexStrategy
- Defined in:
- lib/no_brainer/criteria/where.rb
Instance Attribute Summary collapse
-
#criteria_ast ⇒ Object
Returns the value of attribute criteria_ast.
-
#index ⇒ Object
Returns the value of attribute index.
-
#index_finder ⇒ Object
Returns the value of attribute index_finder.
-
#optimized_clauses ⇒ Object
Returns the value of attribute optimized_clauses.
-
#rql_args ⇒ Object
Returns the value of attribute rql_args.
-
#rql_op ⇒ Object
Returns the value of attribute rql_op.
-
#rql_options ⇒ Object
Returns the value of attribute rql_options.
Instance Method Summary collapse
Instance Attribute Details
#criteria_ast ⇒ Object
Returns the value of attribute criteria_ast
375 376 377 |
# File 'lib/no_brainer/criteria/where.rb', line 375 def criteria_ast @criteria_ast end |
#index ⇒ Object
Returns the value of attribute index
375 376 377 |
# File 'lib/no_brainer/criteria/where.rb', line 375 def index @index end |
#index_finder ⇒ Object
Returns the value of attribute index_finder
375 376 377 |
# File 'lib/no_brainer/criteria/where.rb', line 375 def index_finder @index_finder end |
#optimized_clauses ⇒ Object
Returns the value of attribute optimized_clauses
375 376 377 |
# File 'lib/no_brainer/criteria/where.rb', line 375 def optimized_clauses @optimized_clauses end |
#rql_args ⇒ Object
Returns the value of attribute rql_args
375 376 377 |
# File 'lib/no_brainer/criteria/where.rb', line 375 def rql_args @rql_args end |
#rql_op ⇒ Object
Returns the value of attribute rql_op
375 376 377 |
# File 'lib/no_brainer/criteria/where.rb', line 375 def rql_op @rql_op end |
#rql_options ⇒ Object
Returns the value of attribute rql_options
375 376 377 |
# File 'lib/no_brainer/criteria/where.rb', line 375 def @rql_options end |
Instance Method Details
#ast ⇒ Object
376 377 378 |
# File 'lib/no_brainer/criteria/where.rb', line 376 def ast MultiOperator.new(criteria_ast.op, criteria_ast.clauses - optimized_clauses) end |
#rql_proc ⇒ Object
380 381 382 383 384 385 386 387 388 389 390 |
# File 'lib/no_brainer/criteria/where.rb', line 380 def rql_proc lambda do |rql| return RethinkDB::RQL.new.expr([]) if rql_op == :get_all && rql_args.empty? opt = ( || {}).merge(:index => index.aliased_name) r = rql.__send__(rql_op, *rql_args, opt) r = r.map { |i| i['doc'] } if rql_op == :get_nearest r = r.distinct if index.multi && !index_finder.criteria.[:without_distinct] r end end |