src/snac/server/elastic/ElasticSearchUtil.php
/**
     * Autocomplete Search SNAC Main Index
     *
     * Searches the main names index for the query using number of related resources as a factor, while also using the
     * Elastic Search simple_query_string query that allows for wildcard, missing, and edit distance queries.  This provides
     * an autocomplete-like response by appending the wildcard "*" to the end of the search string.
     *
     * Allows for pagination by the start and count parameters.
     *
     * @param string $query The search query
     * @param string $entityType optional The entity type to search for, or null
     * @param integer $start optional The result index to start from (default 0)
     * @param integer $count optional The number of results to return from the start (default 10)
     * @return string[] Results from Elastic Search: total, results list, pagination (num pages), page (current page)
     */
Autocomplete Search SNAC Main Index
Searches the main names index for the query using number of related resources as a factor, while also using the
Elastic Search simple_query_string query that allows for wildcard, missing, and edit distance queries.  This provides
an autocomplete-like response by appending the wildcard "*" to the end of the search string.

Allows for pagination by the start and count parameters.


Autocomplete Search SNAC Main Index Searches the main names index for the query using number of related resources as a factor while also using the Elastic Search simple_query_string query that allows for wildcard missing and edit distance queries . This provides an autocomplete - like response by appending the wildcard " * " to the end of the search string . Allows for pagination by the start and count parameters .
public function searchMainIndexAutocomplete($query, $entityType=null, $start=0, $count=10) {
        $searchBody = [
            'query' => [
                'function_score' => [
                    'query' => [
                        'bool' => [
                            'must' => [
                               'simple_query_string' => [
                                   'fields' => ['nameEntry'],
                                   'query' => $query .'*',
                                   'default_operator' => 'and'
                               ]
                            ]
                        ]
                    ],
                    'field_value_factor' => [
                        'field' => 'resources',
                        'modifier' => 'log1p',
                        'factor' => 1.5
                    ],
                    'boost_mode' => "multiply",
                    'max_boost' => 3
                ]
            ]
        ];
        if ($entityType !== null) {
            $searchBody["query"]["function_score"]["query"]["bool"]["filter"] = [
                    "term" => [
                        'entityType' => $entityType
                    ]
            ];
        }
        return $this->elasticSearchQuery($searchBody, $start, $count);
    }
public function searchMainIndexAutocomplete ( $ query , $ entityType = null , $ start = 0 , $ count = 10 ) { $ searchBody = [ 'query' => [ 'function_score' => [ 'query' => [ 'bool' => [ 'must' => [ 'simple_query_string' => [ 'fields' => [ 'nameEntry' ] , 'query' => $ query . '*' , 'default_operator' => 'and' ] ] ] ] , 'field_value_factor' => [ 'field' => 'resources' , 'modifier' => 'log1p' , 'factor' => 1.5 ] , 'boost_mode' => " multiply " , 'max_boost' => 3 ] ] ] ; if ( $ entityType !== null ) { $ searchBody [ " query " ] [ " function_score " ] [ " query " ] [ " bool " ] [ " filter " ] = [ " term " => [ 'entityType' => $ entityType ] ] ; } return $ this -> elasticSearchQuery ( $ searchBody , $ start , $ count ) ; }
Autocomplete Search SNAC Main Index
 Searches the main names index for the query using number of related resources as a factor, while also using the
 Elastic Search simple_query_string query that allows for wildcard, missing, and edit distance queries.
Autocomplete Search SNAC Main Index Searches the main names index for the query using number of related resources as a factor while also using the Elastic Search simple_query_string query that allows for wildcard missing and edit distance queries .
/* This query uses a full-word matching search */