MLPHP


MLPHP\Search
MarkLogic/MLPHP/Search.php at line 26

Class Search

Search

public class Search

Represents a search.

Author:
Mike Wooldridge

Constructor Summary
void

__construct(RESTClient client, int start, int pageLength, str view, str format)

Create a Search object.

Method Summary
void

setConnection(RESTClient client)

Set the REST client connection.

array

getParams()

Get the common search parameters as an associated array.

SearchResults

retrieve(string query, array params, bool structured)

Retrieve the search results using the REST client.

SearchResults

retrieveKeyValue(string key, string value, mixed params)

Retrieve the key-value search results for JSON content using the REST client.

SearchResults

retrieveKeyValueElement(string element, string attribute, string value, mixed params)

Retrieve the key-value search results, where the key is an element name, for XML content using the REST client.

string

highlight(string content, string contentType, string query, array params, bool structured, mixed class)

Highlight hits in the given content based on the given queryImplemented via a MarkLogic REST API resource extension.

string

getStart()

Get the start setting.

void

setStart(string start)

Set the start setting.

int

getPageLength()

Get the page length.

void

setPageLength(int pageLength)

Set the page length.

string

getOptions()

Get the search-options name.

void

setOptions(string option, mixed options)

Set the search-options name.

string

getView()

Get the view setting.

void

setView(string view)

Set the view setting ('facets', 'results', 'metadata', or 'all').

string

getFormat()

Get the format setting.

void

setFormat(string format)

Set the format setting ('xml' or 'json').

string

getCollection()

Get the collection to filter by.

void

setCollection(array|string collection)

Set the collection to filter by.

string

getDirectory()

Get the directory to filter by.

void

setDirectory(array|string directory)

Set the directory to filter by.

Constructor Detail

MarkLogic/MLPHP/Search.php at line 47

__construct

public void __construct(RESTClient client, int start, int pageLength, str view, str format)

Create a Search object.

Parameters:
client - A REST client object.

Method Detail

MarkLogic/MLPHP/Search.php at line 61

setConnection

public void setConnection(RESTClient client)

Set the REST client connection.

Parameters:
client - The RestClient object.

MarkLogic/MLPHP/Search.php at line 71

getParams

public array getParams()

Get the common search parameters as an associated array.

Returns:
An associated array of name/value pairs.

MarkLogic/MLPHP/Search.php at line 97

retrieve

public SearchResults retrieve(string query, array params, bool structured)

Retrieve the search results using the REST client.

Parameters:
query - The search query.
structured - defaults to false
Returns:
A search results object.

MarkLogic/MLPHP/Search.php at line 123

retrieveKeyValue

public SearchResults retrieveKeyValue(string key, string value, mixed params)

Retrieve the key-value search results for JSON content using the REST client.

Parameters:
key - The key (property name) in JSON content.
value - The value (property value) in JSON content.
Returns:
A search results object.

MarkLogic/MLPHP/Search.php at line 162

retrieveKeyValueElement

public SearchResults retrieveKeyValueElement(string element, string attribute, string value, mixed params)

Retrieve the key-value search results, where the key is an element name, for XML content using the REST client.

Parameters:
element - The element name.
attribute - The attribute for the element, to search for attribute content.
value - The value for that element (or attribute).
Returns:
A search results object.

MarkLogic/MLPHP/Search.php at line 222

highlight

public string highlight(string content, string contentType, string query, array params, bool structured, mixed class)

Highlight hits in the given content based on the given query

Implemented via a MarkLogic REST API resource extension.

Parameters:
contentType - - describes content to be highlighted - support for application/xml and text'plain
query - The search query.
structured - defaults to false (only false is supported today)
Returns:
hit-highlighted content

MarkLogic/MLPHP/Search.php at line 270

getStart

public string getStart()

Get the start setting.

Returns:
The debug setting, 'true' or 'false'.

MarkLogic/MLPHP/Search.php at line 280

setStart

public void setStart(string start)

Set the start setting.

Parameters:
start - The debug setting, 'true' or 'false'.

MarkLogic/MLPHP/Search.php at line 291

getPageLength

public int getPageLength()

Get the page length.

Returns:
The page length.

MarkLogic/MLPHP/Search.php at line 303

setPageLength

public void setPageLength(int pageLength)

Set the page length.

See Also:
http://docs.marklogic.com/REST/GET/v1/search
Parameters:
pageLength - The page length.

MarkLogic/MLPHP/Search.php at line 314

getOptions

public string getOptions()

Get the search-options name.

Returns:
The search-options name.

MarkLogic/MLPHP/Search.php at line 324

setOptions

public void setOptions(string option, mixed options)

Set the search-options name.

Parameters:
option - The search-options name.

MarkLogic/MLPHP/Search.php at line 335

getView

public string getView()

Get the view setting.

Returns:
The search options as XML.

MarkLogic/MLPHP/Search.php at line 347

setView

public void setView(string view)

Set the view setting ('facets', 'results', 'metadata', or 'all').

See Also:
http://docs.marklogic.com/REST/GET/v1/search
Parameters:
view - The search options as XML.

MarkLogic/MLPHP/Search.php at line 358

getFormat

public string getFormat()

Get the format setting.

Returns:
The format setting.

MarkLogic/MLPHP/Search.php at line 371

setFormat

public void setFormat(string format)

Set the format setting ('xml' or 'json'). MLPHP only supports 'xml' currently.

See Also:
http://docs.marklogic.com/REST/GET/v1/search
Parameters:
format - The format setting.

MarkLogic/MLPHP/Search.php at line 382

getCollection

public string getCollection()

Get the collection to filter by.

Returns:
A collection string.

MarkLogic/MLPHP/Search.php at line 395

setCollection

public void setCollection(array|string collection)

Set the collection to filter by.

See Also:
http://docs.marklogic.com/guide/rest-dev/search#id_74024
Parameters:
collection - An array of collection strings or a collection string.

MarkLogic/MLPHP/Search.php at line 406

getDirectory

public string getDirectory()

Get the directory to filter by.

Returns:
A directory string.

MarkLogic/MLPHP/Search.php at line 419

setDirectory

public void setDirectory(array|string directory)

Set the directory to filter by.

See Also:
http://docs.marklogic.com/guide/rest-dev/search#id_74024
Parameters:
directory - An array of directory strings or a directory string.

MLPHP