{"issue":{"milestone":null,"user":{"id":1133051,"login":"itayco","url":"https://api.github.com/users/itayco","gravatar_id":"f23ae9b27497919e8f0ae0db9f82dbb4","avatar_url":"https://secure.gravatar.com/avatar/f23ae9b27497919e8f0ae0db9f82dbb4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"created_at":"2011-12-18T08:24:03Z","title":"The Facet initializer doesn't allow to pass parameters to Facet","labels":[],"state":"closed","updated_at":"2011-12-18T09:02:26Z","id":2592230,"closed_at":"2011-12-18T09:02:26Z","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"html_url":"https://github.com/karmi/tire/issues/176","body":"In the current implementation it's impossible to pass parameters to Facet.\r\n\r\nFor example, the following code:\r\n\r\n    @term = \"category_ids\"\r\n\r\n    search =  Tire.search do |search|\r\n      search.facet 'category' do |facet|\r\n          facet.terms @term, :size => 100\r\n      end      \r\n    end\r\n\r\ngenerates the following query:\r\n\r\n\t{\"facets\":{\"category\":{\"terms\":{\"field\":null,\"size\":100,\"all_terms\":false}}}}\r\n\r\n( note the \"field\":null )\r\n\r\nThe reason seems to be the Facet initializer - it's last line performs only instance_eval and not considering the block arity.\r\nIt should be exactly like the last line of the Query initializer, where passing parameters is possible.\r\n\r\nFixed it in this fork.","number":176,"url":"https://api.github.com/repos/karmi/tire/issues/176","comments":1,"assignee":null},"action":"closed"}