Sha256: 72cf61686989545f254eeb72f9e6d10d3973cb35867aaab9fdd265112b65c726

Contents?: true

Size: 784 Bytes

Versions: 13

Compression:

Stored size: 784 Bytes

Contents

module Sunspot
  module Query
    class StandardQuery < CommonQuery
      attr_accessor :scope, :fulltext

      def initialize(types)
        super
        @components << @fulltext = Conjunction.new
      end

      def add_fulltext(keywords)
        @fulltext.add_fulltext(keywords)
      end

      def add_join(keywords, target, from, to)
        @fulltext.add_join(keywords, target, from, to)
      end

      def disjunction
        parent_fulltext = @fulltext
        @fulltext = @fulltext.add_disjunction

        yield
      ensure
        @fulltext = parent_fulltext
      end

      def conjunction
        parent_fulltext = @fulltext
        @fulltext = @fulltext.add_conjunction

        yield
      ensure
        @fulltext = parent_fulltext
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
sunspot-2.5.0 lib/sunspot/query/standard_query.rb
sunspot-2.4.0 lib/sunspot/query/standard_query.rb
sunspot-2.3.0 lib/sunspot/query/standard_query.rb
sunspot-2.2.8 lib/sunspot/query/standard_query.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/sunspot-2.2.7/lib/sunspot/query/standard_query.rb
sunspot-2.2.7 lib/sunspot/query/standard_query.rb
sunspot-2.2.6 lib/sunspot/query/standard_query.rb
sunspot-2.2.5 lib/sunspot/query/standard_query.rb
sunspot-2.2.4 lib/sunspot/query/standard_query.rb
sunspot-2.2.3 lib/sunspot/query/standard_query.rb
sunspot-2.2.2 lib/sunspot/query/standard_query.rb
sunspot-2.2.1 lib/sunspot/query/standard_query.rb
sunspot-2.2.0 lib/sunspot/query/standard_query.rb