예제 #1
0
 /**
  * Build a string for onscreen display showing the
  *   query used in the search (not the filters).
  *
  * @return string user friendly version of 'query'
  */
 public function getDisplayQuery()
 {
     // Set up callbacks with no-op translator to keep the English
     // boolean operators:
     $translate = function ($str) {
         return $str;
     };
     $showField = [$this->getOptions(), 'getHumanReadableFieldName'];
     // Build display query:
     return QueryAdapter::display($this->getQuery(), $translate, $showField);
 }
예제 #2
0
파일: Params.php 프로젝트: grharry/vufind
 /**
  * Build a string for onscreen display showing the
  *   query used in the search (not the filters).
  *
  * @return string user friendly version of 'query'
  */
 public function getDisplayQuery()
 {
     // Set up callbacks:
     $translate = [$this, 'translate'];
     $showField = [$this->getOptions(), 'getHumanReadableFieldName'];
     // Build display query:
     return QueryAdapter::display($this->getQuery(), $translate, $showField);
 }
예제 #3
0
 /**
  * Test display capabilities.
  *
  * @return void
  */
 public function testDisplay()
 {
     // Array of fixture directory => expected display query
     $cases = ['basic' => 'john smith', 'advanced' => '(CallNumber:oranges AND toc:bananas AND ISN:pears) OR (Title:cars OR Subject:trucks) NOT ((AllFields:squid))'];
     // Create simple closure to fill in for translation callbacks:
     $echo = function ($str) {
         return $str;
     };
     // Run the tests:
     $fixturePath = realpath(__DIR__ . '/../../../../fixtures/searches') . '/';
     foreach ($cases as $case => $expected) {
         $q = unserialize(file_get_contents($fixturePath . $case . '/query'));
         $this->assertEquals($expected, QueryAdapter::display($q, $echo, $echo));
     }
 }