From 220cff2ec250926b81b3a741b0e075cea493958c Mon Sep 17 00:00:00 2001 From: Sam Sullivan Date: Tue, 7 Jan 2014 16:31:38 -0600 Subject: [PATCH 1/5] fix QueryStringMultiField rewrite parameter --- src/Sherlock/components/queries/QueryStringMultiField.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Sherlock/components/queries/QueryStringMultiField.php b/src/Sherlock/components/queries/QueryStringMultiField.php index 70a5537..2f52366 100644 --- a/src/Sherlock/components/queries/QueryStringMultiField.php +++ b/src/Sherlock/components/queries/QueryStringMultiField.php @@ -48,7 +48,7 @@ public function __construct($hashMap = null) $this->params['phrase_slop'] = 10; $this->params['analyze_wildcard'] = true; $this->params['auto_generate_phrase_queries'] = false; - $this->params['rewrite'] = "constant_score_default"; + $this->params['rewrite'] = "constant_score_auto"; $this->params['quote_analyzer'] = "standard"; $this->params['quote_field_suffix'] = ".unstemmed"; $this->params['use_dis_max'] = true; @@ -81,8 +81,8 @@ public function toArray() 'quote_field_suffix' => $this->params["quote_field_suffix"], 'use_dis_max' => $this->params["use_dis_max"], 'tie_breaker' => $this->params["tie_breaker"], + 'rewrite' => $this->params["rewrite"], ), - 'rewrite' => $this->params["rewrite"], ); return $ret; From 2a7504bfa5e5625240ef84a018cff9da6e41c279 Mon Sep 17 00:00:00 2001 From: Sam Sullivan Date: Wed, 5 Mar 2014 20:12:57 -0600 Subject: [PATCH 2/5] add Sort Script component --- src/Sherlock/components/sorts/Script.php | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/Sherlock/components/sorts/Script.php diff --git a/src/Sherlock/components/sorts/Script.php b/src/Sherlock/components/sorts/Script.php new file mode 100644 index 0000000..956387c --- /dev/null +++ b/src/Sherlock/components/sorts/Script.php @@ -0,0 +1,39 @@ +params['script'] = null; + + parent::__construct($hashMap); + } + + public function toArray() + { + $ret = array( + '_script' => + array( + 'script' => $this->params["script"], + ), + ); + + return $ret; + } + +} From a443e5faa91dcbc665b12dd520f177c309a55911 Mon Sep 17 00:00:00 2001 From: Sam Sullivan Date: Wed, 5 Mar 2014 20:13:53 -0600 Subject: [PATCH 3/5] add GeoDistance and Script to SortWrapper methods --- src/Sherlock/wrappers/SortWrapper.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Sherlock/wrappers/SortWrapper.php b/src/Sherlock/wrappers/SortWrapper.php index cc6a8cd..e3a1820 100644 --- a/src/Sherlock/wrappers/SortWrapper.php +++ b/src/Sherlock/wrappers/SortWrapper.php @@ -11,6 +11,8 @@ /** * @method \Sherlock\components\sorts\Field Field() Field() + * @method \Sherlock\components\sorts\GeoDistance GeoDistance() GeoDistance() + * @method \Sherlock\components\sorts\Script Script() Script() */ class SortWrapper { From 19947377d14b825a6169d9b2e0a48a0887a4865b Mon Sep 17 00:00:00 2001 From: Sam Sullivan Date: Wed, 5 Mar 2014 20:18:04 -0600 Subject: [PATCH 4/5] add basic parameters/methods to Sort Script --- src/Sherlock/components/sorts/Script.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Sherlock/components/sorts/Script.php b/src/Sherlock/components/sorts/Script.php index 956387c..b2198d8 100644 --- a/src/Sherlock/components/sorts/Script.php +++ b/src/Sherlock/components/sorts/Script.php @@ -12,6 +12,9 @@ /** * @method \Sherlock\components\sorts\Script script() script(\string $value) + * @method \Sherlock\components\sorts\Script type() type(\string $value) + * @method \Sherlock\components\sorts\Script order() order(\string $value) Default: asc + * @method \Sherlock\components\sorts\Script lang() lang(\string $value) Default: mvel */ class Script extends components\BaseComponent implements components\SortInterface @@ -20,6 +23,9 @@ class Script extends components\BaseComponent implements components\SortInterfac public function __construct($hashMap = null) { $this->params['script'] = null; + $this->params['type'] = null; + $this->params['order'] = 'asc'; + $this->params['lang'] = 'mvel'; parent::__construct($hashMap); } @@ -30,6 +36,9 @@ public function toArray() '_script' => array( 'script' => $this->params["script"], + 'type' => $this->params["type"], + 'order' => $this->params["order"], + 'lang' => $this->params["lang"], ), ); From 7cca1bd6603ff103f726855982d7e1fbee77491f Mon Sep 17 00:00:00 2001 From: Sam Sullivan Date: Wed, 5 Mar 2014 20:19:21 -0600 Subject: [PATCH 5/5] add params arry to Sort Script --- src/Sherlock/components/sorts/Script.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Sherlock/components/sorts/Script.php b/src/Sherlock/components/sorts/Script.php index b2198d8..4bd8964 100644 --- a/src/Sherlock/components/sorts/Script.php +++ b/src/Sherlock/components/sorts/Script.php @@ -13,6 +13,7 @@ /** * @method \Sherlock\components\sorts\Script script() script(\string $value) * @method \Sherlock\components\sorts\Script type() type(\string $value) + * @method \Sherlock\components\sorts\Script params() params(array $value) Default: array() * @method \Sherlock\components\sorts\Script order() order(\string $value) Default: asc * @method \Sherlock\components\sorts\Script lang() lang(\string $value) Default: mvel */ @@ -24,6 +25,7 @@ public function __construct($hashMap = null) { $this->params['script'] = null; $this->params['type'] = null; + $this->params['params'] = array(); $this->params['order'] = 'asc'; $this->params['lang'] = 'mvel'; @@ -37,6 +39,7 @@ public function toArray() array( 'script' => $this->params["script"], 'type' => $this->params["type"], + 'params' => $this->params["params"], 'order' => $this->params["order"], 'lang' => $this->params["lang"], ),