/** * 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 . '/services/MyResearch/lib/Tags.php'; require_once ROOT_DIR . '/services/MyResearch/lib/Resource.php'; // Find our tag in the database $tag = new Tags(); $tag->tag = $lookfor; $newSearch = array(); if ($tag->find(true)) { // Grab the list of records tagged with this tag $resourceList = $tag->getResources(); if (count($resourceList)) { $newSearch[0] = array('join' => 'OR', 'group' => array()); foreach ($resourceList as $resource) { $id = $resource->record_id; if ($resource->source == 'eContent') { $id = 'econtentRecord' . $id; } $newSearch[0]['group'][] = array('field' => 'id', 'lookfor' => $id, 'bool' => 'OR'); } } } return $newSearch; }
/** * Process a search for a particular tag. * * @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). * @access private */ private function _processTagSearch($lookfor) { // Include the app database objects include_once 'services/MyResearch/lib/Tags.php'; include_once 'services/MyResearch/lib/Resource.php'; // Find our tag in the database $tag = new Tags(); $tag->tag = $lookfor; $tagList = array(); if ($tag->find(true)) { // Grab the list of records tagged with this tag $resourceList = array(); $resourceList = $tag->getResources(); if (count($resourceList)) { foreach ($resourceList as $resource) { $tagList[] = $resource->record_id; } } } return $tagList; }