Kouhei Sutou
null+****@clear*****
Thu Jan 31 14:43:35 JST 2013
Kouhei Sutou 2013-01-31 14:43:35 +0900 (Thu, 31 Jan 2013) New Revision: 0bb98db31c77bbb6d31f1faec7132386d0407b3d https://github.com/groonga/fluent-plugin-kotoumi/commit/0bb98db31c77bbb6d31f1faec7132386d0407b3d Log: Support attributes Modified files: lib/kotoumi/worker.rb test/test_worker.rb Modified: lib/kotoumi/worker.rb (+9 -0) =================================================================== --- lib/kotoumi/worker.rb 2013-01-31 14:40:46 +0900 (06ef8d9) +++ lib/kotoumi/worker.rb 2013-01-31 14:43:35 +0900 (2ebdc84) @@ -52,11 +52,20 @@ module Kotoumi def search_query(query) start_time = Time.now source = @context[query["source"]] + attributes = source.columns.collect do |column| + { + "name" => column.local_name, + "type" => column.range.name, + "vector" => column.vector?, + } + end elapsed_time = Time.now.to_f - start_time.to_f + { "count" => source.size, "startTime" => start_time.iso8601, "elapsedTime" => elapsed_time, + "attributes" => attributes } end end Modified: test/test_worker.rb (+5 -1) =================================================================== --- test/test_worker.rb 2013-01-31 14:40:46 +0900 (25fd1d1) +++ test/test_worker.rb 2013-01-31 14:43:35 +0900 (bc35b7c) @@ -59,7 +59,11 @@ class WorkerTest < Test::Unit::TestCase "startTime" => start_time, "elapsedTime" => elapsed_time, "count" => 9, - } + "attributes" => [ + {"name" => "content", "type" => "Text", "vector" => false}, + {"name" => "title", "type" => "ShortText", "vector" => false}, + ], + }, } actual =****@worke*****_message(request) assert_equal(expected, normalize_result_set(actual)) -------------- next part -------------- HTML����������������������������...다운로드