src/snac/server/ServerExecutor.php
/**
     * Search Resources
     *
     * Searches the resources 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 Resources
Searches the resources 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 Resources Searches the resources 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 searchResources(&$input) {
        $response = array();
        $start = $input["start"] ?? null;
        $count = $input["count"] ?? null;
        $filters = $input["filters"] ?? null;
        if (isset($input["term"])) {
            $response = $this->elasticSearch->searchResourceIndex($input["term"], $start, $count, $filters);
            $this->logger->addDebug("Got the following ES result", $response);
            if (isset($response["results"])) {
                $results = $response["results"];
                $response["results"] = array();
                foreach ($results as $result) {
                    $resource = $this->cStore->readResource($result["id"]);
                    if (isset($resource)) {
                        $response["results"][] = $resource->toArray();
                    }
                }
            }
        }
        $this->logger->addDebug("Returning the following resource search results", $response);
        return $response;
    }
public function searchResources ( & $ input ) { $ response = array ( ) ; $ start = $ input [ " start " ] ?? null ; $ count = $ input [ " count " ] ?? null ; $ filters = $ input [ " filters " ] ?? null ; if ( isset ( $ input [ " term " ] ) ) { $ response = $ this -> elasticSearch -> searchResourceIndex ( $ input [ " term " ] , $ start , $ count , $ filters ) ; $ this -> logger -> addDebug ( " Got the following ES result " , $ response ) ; if ( isset ( $ response [ " results " ] ) ) { $ results = $ response [ " results " ] ; $ response [ " results " ] = array ( ) ; foreach ( $ results as $ result ) { $ resource = $ this -> cStore -> readResource ( $ result [ " id " ] ) ; if ( isset ( $ resource ) ) { $ response [ " results " ] [ ] = $ resource -> toArray ( ) ; } } } } $ this -> logger -> addDebug ( " Returning the following resource search results " , $ response ) ; return $ response ; }
Search Resources
 Searches the resources from the database, based on the input given and returns
 a list of results
Search Resources Searches the resources from the database based on the input given and returns a list of results
// If there are results from the search, then replace them with full // resources from the database (rather than from ES results)