Skip to content

Commit

Permalink
Merge pull request #1811 from SemanticMediaWiki/ask-profile
Browse files Browse the repository at this point in the history
Track queries even in case of an error, refs #1768
  • Loading branch information
mwjames committed Aug 24, 2016
2 parents 3b79742 + c15b861 commit 7a2449e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions includes/parserhooks/AskParserFunction.php
Expand Up @@ -220,10 +220,11 @@ private function doFetchResultsForRawParameters( array $rawParams ) {

private function createQueryProfile( $query, $format, $duration ) {

// In case of an query error add a marker to the subject for
// discoverability of a failed query
// In case of an query error add a marker to the subject for discoverability
// of a failed query, don't bail-out as we can have results and errors
// at the same time
if ( $query->getErrors() !== array() ) {
return $this->addProcessingError( $query->getErrors() );
$this->addProcessingError( $query->getErrors() );
}

$queryProfileAnnotatorFactory = $this->applicationFactory->newQueryProfileAnnotatorFactory();
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/Integration/ByJsonScript/Fixtures/p-0902.json
Expand Up @@ -19,8 +19,8 @@
"store": {
"semantic-data": {
"strict-mode-valuematch": false,
"propertyCount": 3,
"propertyKeys": [ "_MDAT", "_SKEY", "_ERRC" ]
"propertyCount": 4,
"propertyKeys": [ "_MDAT", "_SKEY", "_ASK", "_ERRC" ]
}
},
"expected-output": {
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/includes/parserhooks/AskParserFunctionTest.php
Expand Up @@ -293,8 +293,8 @@ public function testEmbeddedQueryWithError() {
);

$expected = array(
'propertyCount' => 1,
'propertyKeys' => array( '_ERRC' ),
'propertyCount' => 2,
'propertyKeys' => array( '_ASK', '_ERRC' ),
);

$parserData = $this->applicationFactory->newParserData(
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/includes/parserhooks/ShowParserFunctionTest.php
Expand Up @@ -193,7 +193,7 @@ public function testQueryWithErroneousData() {
);

$instance->parse( $params );
/*

$expected = array(
'output' => 'class="smwtticon warning"', // lazy content check for the error
'propertyCount' => 4,
Expand All @@ -205,7 +205,7 @@ public function testQueryWithErroneousData() {
$expected,
$parserData->getSemanticData()->findSubSemanticData( '_QUERYc685f41368e6d9c59dfc9d8d69ef557f' )
);
*/

$expected = array(
'propertyCount' => 2,
'propertyKeys' => array( '_ERRP', '_ERRT' ),
Expand Down

0 comments on commit 7a2449e

Please sign in to comment.