Permalink
Browse files

properly implement MLT api

  • Loading branch information...
1 parent d982698 commit 98cf9973c3266de6393b6282d67d3ccfab7ca38b @skade skade committed Apr 16, 2012
@@ -1,10 +1,52 @@
module Eson
module Shared
module MoreLikeThis
- include Search
extend API
-
- parameters :type, :id
+
+ multi_index false
+
+ parameters :id,
+ :type,
+ :mlt_fields,
+ :like_text,
+ :percent_terms_to_match,
+ :min_term_freq,
+ :max_query_terms,
+ :stop_words,
+ :min_doc_freq,
+ :max_doc_freq,
+ :min_word_len,
+ :max_word_len,
+ :boost_terms,
+ :boost,
+ :analyzer,
+ :scroll,
+ :scroll_id,
+ :timeout,
+ :from,
+ :size,
+ :sort,
+ :track_scores,
+ :highlight,
+ :fields,
+ :script_fields,
+ :indices_boost,
+ :explain,
+ :version,
+ :min_score
+
+ source_param :timeout,
+ :from,
+ :size,
+ :sort,
+ :track_scores,
+ :highlight,
+ :fields,
+ :script_fields,
+ :indices_boost,
+ :explain,
+ :version,
+ :min_score
end
end
end
@@ -2,11 +2,11 @@ module Eson
module Shared
module Search
extend API
-
+
attr_accessor :type
-
+
multi_index true
-
+
source_param :query,
:timeout,
:from,
@@ -22,9 +22,9 @@ module Search
:explain,
:version,
:min_score
-
- parameters :timeout,
- :types,
+
+ parameters :timeout,
+ :types,
:routing,
:query,
:from,
@@ -47,7 +47,7 @@ module Search
:q,
:df,
:analyzer
-
+
def types
if @types
Array(@types)
@@ -57,7 +57,6 @@ def types
[]
end
end
-
end
end
end
@@ -3,11 +3,11 @@ module HTTP
module MoreLikeThis
include Shared::MoreLikeThis
extend API
-
+
request_method :get
-
+
def path
- "{-list|,|indices}/{type}/{id}/_mlt"
+ "{index}/{type}/{id}/_mlt"
end
end
end
@@ -17,7 +17,7 @@
module Node
module External
def self.instance
- @node ||= begin
+ @node ||= begin
node = ElasticSearch::Node::External.new("gateway.type" => "none")
at_exit do
node.close

0 comments on commit 98cf997

Please sign in to comment.