Sha256: ab3a2900b50df574d896baa4791511a487171a0d9d16dc75f956b7d05785a4ca

Contents?: true

Size: 1.05 KB

Versions: 38

Compression:

Stored size: 1.05 KB

Contents

module CloudSesame
	module Query
		module DSL
			module Operators

				# NEAR: creates a single NEAR node
				# =======================================
				def near(value, options = {})
					_build_operator AST::Near, options, value
				end

				alias_method :sloppy,     :near

				# PREFIX: creates a single PREFIX node
				# =======================================
				def prefix(value, options = {})
					_build_operator AST::Prefix, options, value
				end

				alias_method :start_with,	:prefix
				alias_method :begin_with, :prefix

				# PHRASE: creates a single PHRASE node
				# =======================================
				def phrase(value, options = {})
					_build_operator AST::Phrase, options, value
				end

				# TERM: creates a single TERM node
				# =======================================
				def term(value, options = {})
					_build_operator AST::Term, options, value
				end

				private

				def _build_operator(klass, options, value)
					node = klass.new _context, options
					node << AST::Literal.new(nil, value)
					node
				end

			end
		end
	end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
CloudSesame-1.0.1 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-1.0.0 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.9.4 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.9.3 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.9.2 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.9.1 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.9.0 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.8.3 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.8.2 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.8.1 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.8.0 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.7.13 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.7.12 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.7.11 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.7.10 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.7.9 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.7.8 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.7.7 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.7.5 lib/cloud_sesame/query/dsl/operators.rb
CloudSesame-0.7.4 lib/cloud_sesame/query/dsl/operators.rb