コード例 #1
0
ファイル: Solr.php プロジェクト: victorfcm/VuFind-Plus
 /**
  * Process a search for a particular tag.
  *
  * @access  private
  * @param   string  $lookfor    The tag to search for
  * @return  array   A revised searchTerms array to get matching Solr records
  *                  (empty if no tag matches found).
  */
 private function processTagSearch($lookfor)
 {
     // Include the app database objects
     require_once ROOT_DIR . '/sys/LocalEnrichment/UserTag.php';
     require_once ROOT_DIR . '/sys/Grouping/GroupedWork.php';
     // Find our tag in the database
     $tag = new UserTag();
     $tag->tag = $lookfor;
     $tag->selectAdd(null);
     $tag->selectAdd('DISTINCT(groupedRecordPermanentId) as groupedRecordPermanentId');
     $newSearch = array();
     $newSearch[0] = array('join' => 'OR', 'group' => array());
     $tag->find();
     while ($tag->fetch()) {
         // Grab the list of records tagged with this tag
         $id = $tag->groupedRecordPermanentId;
         $newSearch[0]['group'][] = array('field' => 'id', 'lookfor' => $id, 'bool' => 'OR');
     }
     return $newSearch;
 }