src/snac/server/ServerExecutor.php
/**
     * Search For Constellation
     *
     * Given a search term, starting point (0+), and a count of results, search SNAC for a
     * constellation matching that name heading and return the list of results.
     *
     * @param string[] $input Input array from the Server object
     * @return string[] The response to send to the client
     */
Search For Constellation
Given a search term, starting point (0+), and a count of results, search SNAC for a
constellation matching that name heading and return the list of results.

@param string[] $input Input array from the Server object
@return string[] The response to send to the client
Search For Constellation Given a search term starting point ( 0 + ) and a count of results search SNAC for a constellation matching that name heading and return the list of results . @param string [] $input Input array from the Server object @return string [] The response to send to the client
public function searchConstellations(&$input) {
        $response = array();
        if (!isset($input["term"]) || !isset($input["start"]) || !isset($input["count"])) {
            $this->logger->addDebug("Something was not set correctly", $input);
            return $response;
        }
        if ($input["entity_type"] === "")
            $input["entity_type"] = null;
        if (!isset($input["search_type"])) {
            $input["search_type"] = "default";
        }
        if (!isset($input["facets"])) {
            $input["facets"] = null;
        }
        if (!isset($input["biog_hist"])) {
            $input["biog_hist"] = false;
        }
        if (\snac\Config::$USE_ELASTIC_SEARCH) {
            switch($input["search_type"]) {
                case "autocomplete":
                    $response = $this->elasticSearch->searchMainIndexAutocomplete($input["term"], $input["entity_type"],
                                                                        $input["start"], $input["count"]);
                    break;
                case "advanced":
                    $response = $this->elasticSearch->searchMainIndexAdvanced($input["term"], $input["entity_type"],
                                                                        $input["start"], $input["count"], $input["facets"], $input["biog_hist"]);
                    break;
                default:
                    $response = $this->elasticSearch->searchMainIndexWithDegree($input["term"], $input["entity_type"],
                                                                            $input["start"], $input["count"], $input["facets"], $input["biog_hist"]);
            }
            $searchResults = array();
            foreach ($response["results"] as $k => $result) {
                $constellation = $this->cStore->readPublishedConstellationByID($result["id"], DBUtil::$READ_SHORT_SUMMARY);
                if (\snac\Config::$USE_NEO4J) {
                    $this->neo4J->checkHoldingInstitutionStatus($constellation);
                }
                $constellation = $constellation->toArray();
                $constellation["resource_count"] = $result["resources"];
                array_push($searchResults, $constellation);
            }
            $response["results"] = $searchResults;
            $response["count"] = $input["count"];
            $response["term"] = $input["term"];
            $response["search_type"] = $input["search_type"];
            if (isset(\snac\Config::$MAX_SEARCH_RESULT_PAGES) &&
                    $response["pagination"] > \snac\Config::$MAX_SEARCH_RESULT_PAGES)
                $response["pagination"] = \snac\Config::$MAX_SEARCH_RESULT_PAGES;
        }
        return $response;
    }
public function searchConstellations ( & $ input ) { $ response = array ( ) ; if ( ! isset ( $ input [ " term " ] ) || ! isset ( $ input [ " start " ] ) || ! isset ( $ input [ " count " ] ) ) { $ this -> logger -> addDebug ( " Something was not set correctly " , $ input ) ; return $ response ; } if ( $ input [ " entity_type " ] === " " ) $ input [ " entity_type " ] = null ; if ( ! isset ( $ input [ " search_type " ] ) ) { $ input [ " search_type " ] = " default " ; } if ( ! isset ( $ input [ " facets " ] ) ) { $ input [ " facets " ] = null ; } if ( ! isset ( $ input [ " biog_hist " ] ) ) { $ input [ " biog_hist " ] = false ; } if ( \ snac \ Config :: $ USE_ELASTIC_SEARCH ) { switch ( $ input [ " search_type " ] ) { case " autocomplete " : $ response = $ this -> elasticSearch -> searchMainIndexAutocomplete ( $ input [ " term " ] , $ input [ " entity_type " ] , $ input [ " start " ] , $ input [ " count " ] ) ; break ; case " advanced " : $ response = $ this -> elasticSearch -> searchMainIndexAdvanced ( $ input [ " term " ] , $ input [ " entity_type " ] , $ input [ " start " ] , $ input [ " count " ] , $ input [ " facets " ] , $ input [ " biog_hist " ] ) ; break ; default : $ response = $ this -> elasticSearch -> searchMainIndexWithDegree ( $ input [ " term " ] , $ input [ " entity_type " ] , $ input [ " start " ] , $ input [ " count " ] , $ input [ " facets " ] , $ input [ " biog_hist " ] ) ; } $ searchResults = array ( ) ; foreach ( $ response [ " results " ] as $ k => $ result ) { $ constellation = $ this -> cStore -> readPublishedConstellationByID ( $ result [ " id " ] , DBUtil :: $ READ_SHORT_SUMMARY ) ; if ( \ snac \ Config :: $ USE_NEO4J ) { $ this -> neo4J -> checkHoldingInstitutionStatus ( $ constellation ) ; } $ constellation = $ constellation -> toArray ( ) ; $ constellation [ " resource_count " ] = $ result [ " resources " ] ; array_push ( $ searchResults , $ constellation ) ; } $ response [ " results " ] = $ searchResults ; $ response [ " count " ] = $ input [ " count " ] ; $ response [ " term " ] = $ input [ " term " ] ; $ response [ " search_type " ] = $ input [ " search_type " ] ; if ( isset ( \ snac \ Config :: $ MAX_SEARCH_RESULT_PAGES ) && $ response [ " pagination " ] > \ snac \ Config :: $ MAX_SEARCH_RESULT_PAGES ) $ response [ " pagination " ] = \ snac \ Config :: $ MAX_SEARCH_RESULT_PAGES ; } return $ response ; }
Search For Constellation
 Given a search term, starting point (0+), and a count of results, search SNAC for a
 constellation matching that name heading and return the list of results.
Search For Constellation Given a search term starting point ( 0 + ) and a count of results search SNAC for a constellation matching that name heading and return the list of results .
// error condition // Update the ES search results to include information from the constellation // Limit the search results, if specified in the configuration