Debian Codegraph @

lib/mrb/scripts/index_column.rb

raw symbols SCIP
1 module Groonga
2 class IndexColumn
3 private :estimate_size_for_term_id
4 private :estimate_size_for_query
5 private :estimate_size_for_lexicon_cursor
6
7 # Estimate the number of matched records for term ID or query.
8 #
9 # @overload estimate_size(term: term)
10 # @param term [Record] the term as a Record
11 # @return [Integer] the number of matched records for the term ID.
12 #
13 # @overload estimate_size(term_id: term_id)
14 # @return [Integer] the number of matched records for the term ID.
15 #
16 # @overload estimate_size(query: query, mode: mode)
17 # @return [Integer] the number of matched records for the query.
18 #
19 # @overload estimate_size(lexicon_cursor: lexicon_cursor)
20 # @return [Integer] the number of matched records for the lexicon cursor.
21 #
22 def estimate_size(term: nil,
23 term_id: nil,
24 query: nil,
25 mode: nil,
26 lexicon_cursor: nil)
27 if term
28 # TODO: Validate lexicon
29 return estimate_size_for_term_id(term.id)
30 end
31
32 if term_id
33 return estimate_size_for_term_id(term_id)
34 end
35
36 if query
37 return estimate_size_for_query(query, mode: mode)
38 end
39
40 if lexicon_cursor
41 return estimate_size_for_lexicon_cursor(lexicon_cursor)
42 end
43
44 message = "must specify :term_id, :term_id, :query or :lexicon_cursor"
45 raise InvalidArgument, message
46 end
47 end
48 end