src/snac/server/ServerExecutor.php
/**
     * Search Vocabulary
     *
     * Searches the vocabulary from the database, based on the input given and returns
     * a list of results
     *
     * @param string[] $input Direct server input
     * @return string[] The response to send to the client
     */
Search Vocabulary
Searches the vocabulary from the database, based on the input given and returns
a list of results

@param string[] $input Direct server input
@return string[] The response to send to the client
Search Vocabulary Searches the vocabulary from the database based on the input given and returns a list of results @param string [] $input Direct server input @return string [] The response to send to the client
public function searchVocabulary(&$input) {
        $response = array();
        if (isset($input["term_id"])) {
            return $this->readVocabulary($input);
        } else {
            if (!array_key_exists("type", $input) || !array_key_exists("query_string", $input)) {
                throw new \snac\exceptions\SNACInputException("Missing required field.", 400);
            }
            $search = [
                "type" => $input["type"],
                "query_string" => $input["query_string"],
                "entity_type" => isset($input["entity_type"]) ? $input["entity_type"] : null,
                "count" => isset($input["count"]) ? $input["count"] : 100
            ];
            switch ($search["type"]) {
                case "holding":
                    $response["results"] = array();
                    $response["results"] = $this->neo4J->searchHoldingInstitutions($search["query_string"], $search["count"]);
                    break;
                default:
                    $response["results"] = array();
                    $results = $this->cStore->searchVocabulary(
                        $search["type"],
                        $search["query_string"],
                        $search["entity_type"],
                        $search["count"]);
                    foreach ($results as $result)
                        array_push($response["results"], $result->toArray(false));
                    break;
            }
        }
        return $response;
    }
public function searchVocabulary ( & $ input ) { $ response = array ( ) ; if ( isset ( $ input [ " term_id " ] ) ) { return $ this -> readVocabulary ( $ input ) ; } else { if ( ! array_key_exists ( " type " , $ input ) || ! array_key_exists ( " query_string " , $ input ) ) { throw new \ snac \ exceptions \ SNACInputException ( " Missing required field. " , 400 ) ; } $ search = [ " type " => $ input [ " type " ] , " query_string " => $ input [ " query_string " ] , " entity_type " => isset ( $ input [ " entity_type " ] ) ? $ input [ " entity_type " ] : null , " count " => isset ( $ input [ " count " ] ) ? $ input [ " count " ] : 100 ] ; switch ( $ search [ " type " ] ) { case " holding " : $ response [ " results " ] = array ( ) ; $ response [ " results " ] = $ this -> neo4J -> searchHoldingInstitutions ( $ search [ " query_string " ] , $ search [ " count " ] ) ; break ; default : $ response [ " results " ] = array ( ) ; $ results = $ this -> cStore -> searchVocabulary ( $ search [ " type " ] , $ search [ " query_string " ] , $ search [ " entity_type " ] , $ search [ " count " ] ) ; foreach ( $ results as $ result ) array_push ( $ response [ " results " ] , $ result -> toArray ( false ) ) ; break ; } } return $ response ; }
Search Vocabulary
 Searches the vocabulary from the database, based on the input given and returns
 a list of results
Search Vocabulary Searches the vocabulary from the database based on the input given and returns a list of results
// Create data structure for information to search