Skip to content

Commit

Permalink
Merge pull request #36 from Traackr/kw_match_error
Browse files Browse the repository at this point in the history
#35 Removed validation for requiring keyword_matches flag to be true
  • Loading branch information
KidA78 authored Jul 21, 2016
2 parents 71f965d + 8db288e commit 02850a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
5 changes: 0 additions & 5 deletions lib/TraackrApi/Posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ public static function search($p = array(
$p['include_brand_content'] = $posts->convertBool($p, 'include_brand_content');
$p['include_shared_content'] = $posts->convertBool($p, 'include_shared_content');

// Validate business requirements
if ( $p['enable_keyword_aggregation'] === 'true' && $p['include_keyword_matches'] === 'false' ) {
throw new MissingParameterException("'include_keyword_matches' needs to be set to true for 'keyword_aggregation' to work");
}

// support for multi params
$p['keywords'] = is_array($p['keywords']) ?
implode(',', $p['keywords']) : $p['keywords'];
Expand Down
9 changes: 5 additions & 4 deletions test/Posts/PostsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ public function testLookup() {
} // End function testLookup()

/**
* If keyword_aggregation is enable, keyword_matches must be set to true
* Having a false keyword match param, should still return
* valid results, even with keyword aggregation turned on
* @group read only
* @expectedException Traackr\MissingParameterException
*/
public function testSearchInvalidParameter() {
Traackr\Posts::search(array(
public function testSearchWithKeywordAggregations() {
$posts = Traackr\Posts::search(array(
'keywords' => array('traackr', '"content marketing"'),
'include_keyword_matches' => false,
'enable_keyword_aggregation' => true
));
$this->assertGreaterThan(0, $posts['posts'], 'No results found');
}

/**
Expand Down

0 comments on commit 02850a2

Please sign in to comment.