[Groonga-commit] groonga/groonga [master] [query-log][analyzer] support --query.

アーカイブの一覧に戻る

null+****@clear***** null+****@clear*****
2011年 6月 10日 (金) 11:05:00 JST


Kouhei Sutou	2011-06-10 02:05:00 +0000 (Fri, 10 Jun 2011)

  New Revision: 4415a260ff5ac43f83ab84d5a3f0a467ffbc5350

  Log:
    [query-log][analyzer] support --query.

  Modified files:
    tools/groonga-query-log-analyzer.rb

  Modified: tools/groonga-query-log-analyzer.rb (+17 -4)
===================================================================
--- tools/groonga-query-log-analyzer.rb    2011-06-10 01:55:19 +0000 (d3d7b3e)
+++ tools/groonga-query-log-analyzer.rb    2011-06-10 02:05:00 +0000 (4b5fdc2)
@@ -235,8 +235,16 @@ class GroongaQueryLogAnaylzer
       @parameters["scorer"]
     end
 
+    def query
+      @parameters["query"]
+    end
+
+    def filter
+      @parameters["filter"]
+    end
+
     def conditions
-      @parameters["filter"].split(/(?:&&|&!|\|\|)/).collect do |condition|
+      @conditions ||= filter.split(/(?:&&|&!|\|\|)/).collect do |condition|
         condition = condition.strip
         condition = condition.gsub(/\A[\s\(]*/, '')
         condition = condition.gsub(/[\s\)]*\z/, '') unless /\(/ =~ condition
@@ -337,9 +345,14 @@ class GroongaQueryLogAnaylzer
     def operation_context(label, context)
       case label
       when "filter"
-        index = context[:filter_index]
-        context[:filter_index] += 1
-        @select_command.conditions[index]
+        if @select_command.query and context[:query_used].nil?
+          context[:query_used] = true
+          "query: #{@select_command.query}"
+        else
+          index = context[:filter_index]
+          context[:filter_index] += 1
+          @select_command.conditions[index]
+        end
       when "sort"
         @select_command.sortby
       when "score"




Groonga-commit メーリングリストの案内
アーカイブの一覧に戻る