From a3efd780557aa71b118c63fea5e391cbb87f3ced Mon Sep 17 00:00:00 2001 From: Mathieu Darse Date: Mon, 7 Sep 2015 16:05:10 +0200 Subject: [PATCH 1/2] Fix cross field queries (see PHRAS-691) --- lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/TextNode.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/TextNode.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/TextNode.php index 2506a9ddf1..c1d8463fe6 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/TextNode.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/TextNode.php @@ -53,6 +53,7 @@ class TextNode extends AbstractTermNode implements ContextAbleInterface 'multi_match' => [ 'fields' => $index_fields, 'query' => $this->text, + 'type' => 'cross_fields', 'operator' => 'and', 'lenient' => true, ] From 2afd15dd38c614612986bff564d1ad647b8f4e66 Mon Sep 17 00:00:00 2001 From: Mathieu Darse Date: Tue, 8 Sep 2015 10:37:32 +0200 Subject: [PATCH 2/2] Fix tests --- .../Alchemy/Tests/Phrasea/SearchEngine/AST/TextNodeTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/Alchemy/Tests/Phrasea/SearchEngine/AST/TextNodeTest.php b/tests/Alchemy/Tests/Phrasea/SearchEngine/AST/TextNodeTest.php index db887e0d00..9ff9bcbc43 100644 --- a/tests/Alchemy/Tests/Phrasea/SearchEngine/AST/TextNodeTest.php +++ b/tests/Alchemy/Tests/Phrasea/SearchEngine/AST/TextNodeTest.php @@ -55,6 +55,7 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase "multi_match": { "fields": ["foo.fr", "foo.en"], "query": "bar", + "type": "cross_fields", "operator": "and", "lenient": true } @@ -94,6 +95,7 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase "multi_match": { "fields": ["foo.fr", "foo.en"], "query": "baz", + "type": "cross_fields", "operator": "and", "lenient": true } @@ -108,6 +110,7 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase "multi_match": { "fields": ["private_caption.bar.fr", "private_caption.bar.en"], "query": "baz", + "type": "cross_fields", "operator": "and", "lenient": true } @@ -140,6 +143,7 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase "multi_match": { "fields": ["foo.fr", "foo.en"], "query": "bar", + "type": "cross_fields", "operator": "and", "lenient": true } @@ -189,6 +193,7 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase "multi_match": { "fields": ["foo.fr", "foo.en"], "query": "baz", + "type": "cross_fields", "operator": "and", "lenient": true } @@ -212,6 +217,7 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase "multi_match": { "fields": ["private_caption.bar.fr", "private_caption.bar.en"], "query": "baz", + "type": "cross_fields", "operator": "and", "lenient": true }