Class: Groonga::Command::Select

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga/command.rb

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Constructor Details

#initialize(context, table, options) ⇒ Select

Returns a new instance of Select.



54
55
56
57
58
# File 'lib/groonga/command.rb', line 54

def initialize(context, table, options)
  @context = context
  @table = table
  @options = normalize_options(options)
end

Instance Method Details

#execObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/groonga/command.rb', line 60

def exec
  request_id = @context.send(query)
  loop do
    response_id, result = @context.receive
    if request_id == response_id
      drill_down_keys = @options["drilldown"]
      if drill_down_keys.is_a?(String)
        drill_down_keys = drill_down_keys.split(/(?:\s+|\s*,\s*)/)
      end
      return Result.parse(result, drill_down_keys)
    end
    # raise if request_id < response_id
  end
end