Couchbase C Client  3.1.2
Asynchronous C Client for Couchbase
Full Text Search

Detailed Description

Search for strings in documents and more.

Functions

lcb_STATUS lcb_respsearch_status (const lcb_RESPSEARCH *resp)
 
lcb_STATUS lcb_respsearch_cookie (const lcb_RESPSEARCH *resp, void **cookie)
 
lcb_STATUS lcb_respsearch_row (const lcb_RESPSEARCH *resp, const char **row, size_t *row_len)
 
lcb_STATUS lcb_respsearch_http_response (const lcb_RESPSEARCH *resp, const lcb_RESPHTTP **http)
 
lcb_STATUS lcb_respsearch_handle (const lcb_RESPSEARCH *resp, lcb_SEARCH_HANDLE **handle)
 Get search handle from search response. More...
 
lcb_STATUS lcb_respsearch_error_context (const lcb_RESPSEARCH *resp, const lcb_SEARCH_ERROR_CONTEXT **ctx)
 
int lcb_respsearch_is_final (const lcb_RESPSEARCH *resp)
 
lcb_STATUS lcb_cmdsearch_create (lcb_CMDSEARCH **cmd)
 
lcb_STATUS lcb_cmdsearch_destroy (lcb_CMDSEARCH *cmd)
 
lcb_STATUS lcb_cmdsearch_callback (lcb_CMDSEARCH *cmd, lcb_SEARCH_CALLBACK callback)
 
lcb_STATUS lcb_cmdsearch_payload (lcb_CMDSEARCH *cmd, const char *payload, size_t payload_len)
 
lcb_STATUS lcb_cmdsearch_handle (lcb_CMDSEARCH *cmd, lcb_SEARCH_HANDLE **handle)
 Obtain handle to search. More...
 
lcb_STATUS lcb_cmdsearch_timeout (lcb_CMDSEARCH *cmd, uint32_t timeout)
 
lcb_STATUS lcb_search (lcb_INSTANCE *instance, void *cookie, const lcb_CMDSEARCH *cmd)
 Issue a full-text query. More...
 
lcb_STATUS lcb_search_cancel (lcb_INSTANCE *instance, lcb_SEARCH_HANDLE *handle)
 Cancel a full-text query in progress. More...
 

Typedefs

typedef struct lcb_SEARCH_HANDLE_ lcb_SEARCH_HANDLE
 
typedef struct lcb_RESPSEARCH_ lcb_RESPSEARCH
 
typedef struct lcb_CMDSEARCH_ lcb_CMDSEARCH
 
typedef void(* lcb_SEARCH_CALLBACK) (lcb_INSTANCE *, int, const lcb_RESPSEARCH *)
 

Function Documentation

◆ lcb_respsearch_handle()

lcb_STATUS lcb_respsearch_handle ( const lcb_RESPSEARCH *  resp,
lcb_SEARCH_HANDLE **  handle 
)

Get search handle from search response.

Used to cancel a request. See lcb_cmdsearch_handle as well

Parameters
respthe search response
handlepointer to handle pointer
Returns
LCB_SUCCESS if successful, otherwise an error code

◆ lcb_cmdsearch_handle()

lcb_STATUS lcb_cmdsearch_handle ( lcb_CMDSEARCH *  cmd,
lcb_SEARCH_HANDLE **  handle 
)

Obtain handle to search.

Used to cancel a query. See lcb_respsearch_handle as well

Parameters
cmdthe command
handlepointer to handle pointer
Returns
LCB_SUCCESS upon success, otherwise an error code

◆ lcb_search()

lcb_STATUS lcb_search ( lcb_INSTANCE instance,
void *  cookie,
const lcb_CMDSEARCH *  cmd 
)

Issue a full-text query.

The callback (lcb_SEARCH_CALLBACK) will be invoked for each hit. It will then be invoked one last time with the result metadata (including any facets) and the lcb_resp_is_final will return true.

Parameters
instancethe instance
cookieopaque user cookie to be set in the response object
cmdcommand containing the query and callback
Returns
LCB_SUCCESS if successfully scheduled, otherwise an error.
Examples:
example/fts/fts.c.

◆ lcb_search_cancel()

lcb_STATUS lcb_search_cancel ( lcb_INSTANCE instance,
lcb_SEARCH_HANDLE *  handle 
)

Cancel a full-text query in progress.

The handle is usually obtained via the lcb_cmdsearch_handle call

Parameters
instancethe instance
handlethe handle to the search. See lcb_cmdsearch_handle.
Returns
LCB_SUCCESS if successful, otherwise an error.