CyberDuck\Searchly\Index\SearchQuery
Object representing a search query and its results.
- Author: Andrew Mc Cormack <andy@cyber-duck.co.uk>
- Copyright: Copyright (c) 2018, Andrew Mc Cormack
- License: https://github.com/cyber-duck/silverstripe-searchly/license
Synopsis
class SearchQuery
{
- // members
- protected $query;
- protected $index;
- protected integer $size = 50;
- protected $source;
- protected string $operator = 'AND';
- protected boolean $wildcard = true;
- protected boolean $highlight = false;
- protected boolean $executed = false;
- protected SearchIndexClient $client;
- protected $response;
- // methods
- public void __construct()
- public SearchQuery setSize()
- public SearchQuery setOperator()
- public SearchQuery setWildcard()
- public SearchQuery setHighlight()
- public SearchQuery setConfig()
- public SearchIndexClient getClient()
- public array getConfig()
- public mixed getResponse()
- public void getIDs()
- public array getHits()
- public void getHighlights()
- protected void execute()
- protected string getEscapedQuery()
Members
protected
- $client
—
CyberDuck\Searchly\Index\SearchIndexClient
Search index client instance. - $executed
—
boolean
Whether the query request has been executed. - $highlight
—
boolean
Enable query matched highlights. - $index
—
string
Query index name. - $operator
—
string
Query match operator. - $query
—
string
Query text string. - $response
—
mixed
HTTP response instance. - $size
—
int
Query result limit. - $source
—
int
Query result _source. - $wildcard
—
boolean
Enable query wildcard matching.
Methods
protected
- execute() — Executes the search query request.
- getEscapedQuery() — Returns the escaped search query string.
public
- __construct() — Sets the search text and index name.
- getClient() — Returns the search client instance.
- getConfig() — Returns the search query configuration.
- getHighlights() — Returns an array of query highlights in $id => $highlight format.
- getHits() — Returns all matched objects from the index.
- getIDs() — Returns the matched IDs.
- getResponse() — Returns the query HTTP response.
- setConfig() — Sets a query configuration option.
- setHighlight() — Enables highlights.
- setOperator() — Sets the match operator.
- setSize() — Sets the result limit.
- setWildcard() — Enables wildcard matching.