Overview

Namespaces

  • PHP
  • vierbergenlars
    • Forage
      • ODM
        • HydrationSettings
      • QueryParser
      • SearchIndex
      • SearchQuery
      • SearchResult
      • Transport

Classes

  • Http

Interfaces

  • TransportInterface

Exceptions

  • TransportException
  • Overview
  • Namespace
  • Class
  • Tree

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
Namespace: vierbergenlars\Forage\Transport
Located at vierbergenlars/Forage/Transport/Http.php
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

vierbergenlars\Forage\Transport\TransportException

Implementation of

vierbergenlars\Forage\Transport\TransportInterface::indexBatch()
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

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

vierbergenlars\Forage\Transport\TransportException

Implementation of

vierbergenlars\Forage\Transport\TransportInterface::search()
public boolean
# deleteDoc( integer $docId )

Removes a document with a specific ID

Removes a document with a specific ID

Parameters

$docId
integer
$docId

Returns

boolean

Throws

vierbergenlars\Forage\Transport\TransportException

Implementation of

vierbergenlars\Forage\Transport\TransportInterface::deleteDoc()
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

vierbergenlars\Forage\Transport\TransportException

Implementation of

vierbergenlars\Forage\Transport\TransportInterface::getIndexMetadata()
Forage-PHP-Client API documentation generated by ApiGen 2.8.0