1module Groonga
2  class ScanInfo
3    module Flags
4      ACCESSOR  = 0x01
5      PUSH      = 0x02
6      POP       = 0x04
7      PRE_CONST = 0x08
8    end
9
10    def apply(data)
11      self.op = data.op
12      self.logical_op = data.logical_op
13      self.end = data.end
14      self.query = data.query
15      self.flags = data.flags
16      if data.max_interval
17        self.max_interval = data.max_interval
18      end
19      if data.similarity_threshold
20        self.similarity_threshold = data.similarity_threshold
21      end
22      data.args.each do |arg|
23        push_arg(arg)
24      end
25      data.search_indexes.each do |search_index|
26        put_index(search_index.index_column,
27                  search_index.section_id,
28                  search_index.weight,
29                  search_index.scorer,
30                  search_index.scorer_args_expr,
31                  search_index.scorer_args_expr_offset || 0)
32      end
33      if data.start_position
34        self.start_position = data.start_position
35      end
36    end
37  end
38end
39