Kouhei Sutou
null+****@clear*****
Tue May 22 16:44:38 JST 2018
Kouhei Sutou 2018-05-22 16:44:38 +0900 (Tue, 22 May 2018) New Revision: ab73986d83e90ba303eb7f1ec26bcaf984852d49 https://github.com/groonga/groonga/commit/ab73986d83e90ba303eb7f1ec26bcaf984852d49 Message: mrb: follow ID -> Record change Modified files: lib/mrb/scripts/index_column.rb lib/mrb/scripts/scan_info_data_size_estimator.rb Modified: lib/mrb/scripts/index_column.rb (+10 -0) =================================================================== --- lib/mrb/scripts/index_column.rb 2018-05-22 16:39:29 +0900 (25ebc1493) +++ lib/mrb/scripts/index_column.rb 2018-05-22 16:44:38 +0900 (5ad0f400e) @@ -6,6 +6,10 @@ module Groonga # Estimate the number of matched records for term ID or query. # + # @overload estimate_size(:term => term) + # @param term [Record] the term as a Record + # @return [Integer] the number of matched records for the term ID. + # # @overload estimate_size(:term_id => term_id) # @return [Integer] the number of matched records for the term ID. # @@ -16,6 +20,12 @@ module Groonga # @return [Integer] the number of matched records for the lexicon cursor. # def estimate_size(parameters) + term = parameters[:term] + if term + # TODO: Validate lexicon + return estimate_size_for_term_id(term.id) + end + term_id = parameters[:term_id] if term_id return estimate_size_for_term_id(term_id) Modified: lib/mrb/scripts/scan_info_data_size_estimator.rb (+4 -4) =================================================================== --- lib/mrb/scripts/scan_info_data_size_estimator.rb 2018-05-22 16:39:29 +0900 (5d3dc4e04) +++ lib/mrb/scripts/scan_info_data_size_estimator.rb 2018-05-22 16:44:38 +0900 (6079c594f) @@ -87,13 +87,13 @@ module Groonga else lexicon = index_column.lexicon if query.domain == lexicon.id - term_id = query.value + term = query.value else - term_id = lexicon[query] + term = lexicon[query] end - return 0 if term_id.nil? + return 0 if term.nil? - index_column.estimate_size(:term_id => term_id) + index_column.estimate_size(:term => term) end end -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180522/6e900b7a/attachment-0001.htm