Class: Connection

Connection

A connection to Septima Search

Constructor

new Connection(client, connectionOptions)

Parameters:
Name Type Description
client Object | string An object exposing callback functions
Properties
Name Type Description
onReady Septima.Search.Connection~onReady Called when connection is ready
onSearcherResults Septima.Search.Connection~onSearcherResults Called when a searcher has results
onSearchResults Septima.Search.Connection~onSearchResults Called when all results are ready.
onSelect Septima.Search.Connection~onSelect Called when a result is selected.
doTextSearch Septima.Search.Connection~doTextSearch Called with new search string
log Septima.Search.Connection~log Called when log is written to (if options.log > 0).
onError Septima.Search.Connection~onError Called when an error occurs
connectionOptions object
Properties
Name Type Attributes Default Description
log int <optional>
0 Set to 1 to receive log messages
stringify boolean <optional>
false Set to true to receive serialized objects
mode string Must be "static" or "configUrl". If value is "configUrl" a "url" MUST be given
url string <optional>
Url to controller configuration
Source:

Methods

getSearcherResults(handle, searcherId) → {Array.<Septima.Search.Connection.SimpleResult>|string}

Get list of results from specific searcher. Serialized with JSON.stringify if connectionOptions.stringify === true.
Parameters:
Name Type Description
handle int
searcherId int
Source:
Returns:
Type
Array.<Septima.Search.Connection.SimpleResult> | string

getSearchers() → {Array.<Septima.Search.Connection.SearcherInfo>}

Get list of searchers active on this connection. Serialized with JSON.stringify if connectionOptions.stringify === true.
Source:
Returns:
Type
Array.<Septima.Search.Connection.SearcherInfo>

getSearchResults(handle) → {Array.<Septima.Search.Connection.SimpleResult>}

Get list of results. Serialized with JSON.stringify if connectionOptions.stringify === true.
Parameters:
Name Type Description
handle int
Source:
Returns:
Type
Array.<Septima.Search.Connection.SimpleResult>
Initiate a search.
Parameters:
Name Type Description
queryString string
limit int
timeout int
Source:
Returns:
handle
Type
int

select(handle, resultId)

Notify this connection that a result has been selected. Calling this function will result in either a call to {Septima.Search.Connection~onSelect} or {Septima.Search.Connection~doTextSearch}
Parameters:
Name Type Description
handle int
resultId int
Source:

Type Definitions

SearcherInfo

Type:
  • Object
Properties:
Type Description
string
int
Source:

SimpleResult

Type:
  • Object
Properties:
Name Type Description
id int
title string
description string
image string url of svg
searcherId int
Source:

doTextSearch(query)

Function. Called with new search string.
Parameters:
Name Type Description
query string
Source:

log(message)

Function. Called when log is written to (if options.loglevel > 0).
Parameters:
Name Type Description
message string
Source:

onError(message)

Function. Called when an error occurs.
Parameters:
Name Type Description
message string
Source:

onReady()

Function. Called when connection is ready.
Source:

onSearcherResults(handle, searcherId)

Function. Called when a searcher has results.
Parameters:
Name Type Description
handle int
searcherId int
Source:

onSearchResults(handle)

Function. Called when all results are ready.
Parameters:
Name Type Description
handle int
Source:

onSelect(result)

Function which is called when a result is selected.
Parameters:
Name Type Description
result Septima.Search.Searcher.Result Returned as string of options.stringify === true
Source: