Exemplo n.º 1
0
 /**
  * Gets a list of concepts matching the search options.
  * 
  * @param array $searchOptions
  * @return array An array with the labels of the schemes
  */
 public function searchConcepts($searchOptions)
 {
     $editorOptions = OpenSKOS_Application_BootstrapAccess::getOption('editor');
     $availableOptions = Editor_Forms_SearchOptions::getAvailableSearchOptions();
     $availableOptions['conceptSchemes'] = $this->getAllConceptSchemeUriTitlesMap();
     $query = OpenSKOS_Solr_Queryparser_Editor::factory()->parse($searchOptions, $editorOptions['languages'], $availableOptions, $this->_getCurrentTenant());
     // Pagination
     $queryParams = array();
     if (isset($searchOptions['start']) && !empty($searchOptions['start'])) {
         $queryParams['start'] = $searchOptions['start'];
     }
     if (isset($searchOptions['rows']) && !empty($searchOptions['rows'])) {
         $queryParams['rows'] = $searchOptions['rows'];
     }
     //@TODO: implement language specific sort by using prefLabelSort@... Solr fields
     $queryParams['sort'] = 'prefLabelSort asc';
     $response = Api_Models_Concepts::factory()->setQueryParams($queryParams)->getConcepts($query);
     $response = $response['response'];
     $result = array();
     $result['numFound'] = $response['numFound'];
     $result['data'] = array();
     if (isset($response['start'])) {
         $result['start'] = $response['start'];
     }
     if ($response['numFound'] > 0) {
         foreach ($response['docs'] as &$record) {
             $result['data'][] = new Api_Models_Concept($record);
         }
     }
     return $result;
 }