Class Http
HTTP as transport layer for Forage queries
The Transport layer provides a low-level interface to the Forage search
server. The transport layer is responsible for serializing of the passed data,
and unserialisation of the received data. It should not modify requests or
responses.
-
vierbergenlars\Forage\Transport\Http
implements
vierbergenlars\Forage\Transport\TransportInterface
Methods summary
public
|
#
__construct( string $base_path = 'http://localhost:3000/' )
Creates a new HTTP transport layer
Creates a new HTTP transport layer
Parameters
- $base_path
string $base_path The base path of the Forage server
|
public
boolean
|
#
indexBatch( array $documents, array $filter )
Adds a set of documents to the index
Adds a set of documents to the index
Parameters
- $documents
array $documents An array of documents to submit. Each document is an array. The
document may not have a key named 'id'.
- $filter
array $filter Array of fields that can be used for faceted search. Can only contain
fields that are arrays in the document.
Returns
boolean
Throws
Implementation of
|
public
array
|
#
search( string $query, array $searchFields = null, array $facets = null, array $filters = null, integer $offset = 0, integer $pagesize = 10, array $weight = null )
Perform a search query
Parameters
- $query
string $query The search query
- $searchFields
array $searchFields An array of fields to search in
- $facets
array $facets An array of fields to facet on
- $filters
array $filters Limit search to fields with a particular value(s). Each field contains
an array of acceptable values.
- $offset
integer $offset The offset to start in the result set
- $pagesize
integer $pagesize The size of each page
- $weight
array $weight The weights to give each field.
Returns
array Raw json decoded data from the search server
Throws
Implementation of
|
public
boolean
|
#
deleteDoc( integer $docId )
Removes a document with a specific ID
Removes a document with a specific ID
Parameters
Returns
boolean
Throws
Implementation of
|
public
array
|
#
getIndexMetadata( )
Retrieve meta-data about the index
Retrieve meta-data about the index
Returns
array The raw JSON decoded data from the search server
Throws
Implementation of
|