From cb45f8b773844e3c2862033ced60ae57e25f467f Mon Sep 17 00:00:00 2001 From: Bas de Nooijer Date: Fri, 21 Oct 2011 08:33:02 +0200 Subject: [PATCH] Added 'match' result for analysis and updated the examples --- examples/2.4.1-analysis-document.php | 2 ++ examples/2.4.2-analysis-field.php | 2 ++ library/Solarium/Result/Analysis/Item.php | 20 +++++++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/examples/2.4.1-analysis-document.php b/examples/2.4.1-analysis-document.php index fb211b2f5..b472f2dc0 100644 --- a/examples/2.4.1-analysis-document.php +++ b/examples/2.4.1-analysis-document.php @@ -62,6 +62,7 @@ echo 'Position: ' . $result->getPosition() . '
'; echo 'Position history: ' . implode(', ',$result->getPositionHistory()) . '
'; echo 'Type: ' . htmlspecialchars($result->getType()) . '
'; + echo 'Match: ' . var_export($result->getMatch(),true) . '
'; echo '-----------
'; } } @@ -82,6 +83,7 @@ echo 'Position: ' . $result->getPosition() . '
'; echo 'Position history: ' . implode(', ',$result->getPositionHistory()) . '
'; echo 'Type: ' . htmlspecialchars($result->getType()) . '
'; + echo 'Match: ' . var_export($result->getMatch(),true) . '
'; echo '-----------
'; } } diff --git a/examples/2.4.2-analysis-field.php b/examples/2.4.2-analysis-field.php index 5b4791080..51a3a9550 100644 --- a/examples/2.4.2-analysis-field.php +++ b/examples/2.4.2-analysis-field.php @@ -42,6 +42,7 @@ echo 'Position: ' . $result->getPosition() . '
'; echo 'Position history: ' . implode(', ',$result->getPositionHistory()) . '
'; echo 'Type: ' . htmlspecialchars($result->getType()) . '
'; + echo 'Match: ' . var_export($result->getMatch(),true) . '
'; echo '-----------
'; } } @@ -62,6 +63,7 @@ echo 'Position: ' . $result->getPosition() . '
'; echo 'Position history: ' . implode(', ',$result->getPositionHistory()) . '
'; echo 'Type: ' . htmlspecialchars($result->getType()) . '
'; + echo 'Match: ' . var_export($result->getMatch(),true) . '
'; echo '-----------
'; } } diff --git a/library/Solarium/Result/Analysis/Item.php b/library/Solarium/Result/Analysis/Item.php index 5865b23bb..37814867d 100644 --- a/library/Solarium/Result/Analysis/Item.php +++ b/library/Solarium/Result/Analysis/Item.php @@ -80,6 +80,10 @@ class Solarium_Result_Analysis_Item */ protected $_type; + /** + * @var boolean + */ + protected $_match = false; /** * Constructor @@ -98,6 +102,10 @@ public function __construct($analysis) if (isset($analysis['raw_text'])) { $this->_rawText = $analysis['raw_text']; } + + if (isset($analysis['match'])) { + $this->_match = $analysis['match']; + } } /** @@ -154,7 +162,7 @@ public function getPosition() /** * Get position history value - * + * * @return array */ public function getPositionHistory() @@ -172,4 +180,14 @@ public function getType() return $this->_type; } + /** + * Get match value + * + * @return boolean + */ + public function getMatch() + { + return $this->_match; + } + } \ No newline at end of file