Skip to content

Commit

Permalink
Added 'match' result for analysis and updated the examples
Browse files Browse the repository at this point in the history
  • Loading branch information
basdenooijer committed Oct 21, 2011
1 parent 64c9401 commit cb45f8b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/2.4.1-analysis-document.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
echo 'Position: ' . $result->getPosition() . '<br/>';
echo 'Position history: ' . implode(', ',$result->getPositionHistory()) . '<br/>';
echo 'Type: ' . htmlspecialchars($result->getType()) . '<br/>';
echo 'Match: ' . var_export($result->getMatch(),true) . '<br/>';
echo '-----------<br/>';
}
}
Expand All @@ -82,6 +83,7 @@
echo 'Position: ' . $result->getPosition() . '<br/>';
echo 'Position history: ' . implode(', ',$result->getPositionHistory()) . '<br/>';
echo 'Type: ' . htmlspecialchars($result->getType()) . '<br/>';
echo 'Match: ' . var_export($result->getMatch(),true) . '<br/>';
echo '-----------<br/>';
}
}
Expand Down
2 changes: 2 additions & 0 deletions examples/2.4.2-analysis-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
echo 'Position: ' . $result->getPosition() . '<br/>';
echo 'Position history: ' . implode(', ',$result->getPositionHistory()) . '<br/>';
echo 'Type: ' . htmlspecialchars($result->getType()) . '<br/>';
echo 'Match: ' . var_export($result->getMatch(),true) . '<br/>';
echo '-----------<br/>';
}
}
Expand All @@ -62,6 +63,7 @@
echo 'Position: ' . $result->getPosition() . '<br/>';
echo 'Position history: ' . implode(', ',$result->getPositionHistory()) . '<br/>';
echo 'Type: ' . htmlspecialchars($result->getType()) . '<br/>';
echo 'Match: ' . var_export($result->getMatch(),true) . '<br/>';
echo '-----------<br/>';
}
}
Expand Down
20 changes: 19 additions & 1 deletion library/Solarium/Result/Analysis/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ class Solarium_Result_Analysis_Item
*/
protected $_type;

/**
* @var boolean
*/
protected $_match = false;

/**
* Constructor
Expand All @@ -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'];
}
}

/**
Expand Down Expand Up @@ -154,7 +162,7 @@ public function getPosition()

/**
* Get position history value
*
*
* @return array
*/
public function getPositionHistory()
Expand All @@ -172,4 +180,14 @@ public function getType()
return $this->_type;
}

/**
* Get match value
*
* @return boolean
*/
public function getMatch()
{
return $this->_match;
}

}

0 comments on commit cb45f8b

Please sign in to comment.