Overview

Namespaces

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

Classes

  • Http

Interfaces

  • TransportInterface

Exceptions

  • TransportException
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: namespace vierbergenlars\Forage\Transport;
 4: 
 5: /**
 6:  * Interface all transport objects should implement
 7:  *
 8:  * The Transport layer provides a low-level interface to the Forage search server.
 9:  * The transport layer is responsible for serializing of the passed data,
10:  * and unserialisation of the received data. It should not modify requests or responses.
11:  */
12: interface TransportInterface
13: {
14:     /**
15:      * Adds a set of documents to the index
16:      *
17:      * @param array $documents An array of documents to submit. Each document is an array. The document may not have a key named 'id'.
18:      * @param array $filter Array of fields that can be used for faceted search. Can only contain fields that are arrays in the document.
19:      * @return boolean
20:      * @throws TransportException
21:      */
22:     public function indexBatch(array $documents, array $filter);
23: 
24:     /**
25:      * Perform a search query
26:      *
27:      * @param string $query The search query
28:      * @param array $searchFields An array of fields to search in
29:      * @param array $facets An array of fields to facet on
30:      * @param array $filters Limit search to fields with a particular value(s). Each field contains an array of acceptable values.
31:      * @param int $offset The offset to start in the result set
32:      * @param int $pagesize The size of each page
33:      * @param array $weight The weights to give each field.
34:      * @return array Raw json decoded data from the search server
35:      * @throws TransportException
36:      */
37:     public function search(
38:               $query,
39:         array $searchFields = null,
40:         array $facets       = null,
41:         array $filters      = null,
42:               $offset       = 0,
43:               $pagesize     = 10,
44:         array $weight       = null
45:     );
46: 
47:     /**
48:      * Removes a document with a specific ID
49:      *
50:      * @param int|string $docId
51:      * @return boolean
52:      * @throws TransportException
53:      */
54:     public function deleteDoc($docId);
55: 
56:     /**
57:      * Retrieve meta-data about the index
58:      *
59:      * @return array The raw JSON decoded data from the search server
60:      * @throws TransportException
61:      */
62:     public function getIndexMetadata();
63: }
Forage-PHP-Client API documentation generated by ApiGen 2.8.0