MarkLogic Connect
MarkLogic Connect Client API Collection
Public Member Functions | List of all members
mlclient::SearchDescription Class Reference

A POD class representing input to the POST of /v1/search - i.e. all search configuration. More...

#include <SearchDescription.hpp>

Public Member Functions

MLCLIENT_API SearchDescription ()
 Default Constructor.
 
MLCLIENT_API SearchDescription (const SearchDescription &desc)
 
virtual MLCLIENT_API ~SearchDescription ()
 Default destructor. More...
 
MLCLIENT_API void setOptions (ITextDocumentContent &options)
 Set the search options content. More...
 
MLCLIENT_API const ITextDocumentContentgetOptions () const
 Returns the options as a document. More...
 
MLCLIENT_API void setQuery (ITextDocumentContent &query)
 Sets the complex query using an XML or JSON IDocumentContent instance. More...
 
MLCLIENT_API const ITextDocumentContentgetQuery () const
 Returns the complex query as a document. More...
 
MLCLIENT_API void setQueryText (std::string qtext)
 Sets the plain text query text. More...
 
MLCLIENT_API const std::string & getQueryText () const
 Returns the plain text query. More...
 
MLCLIENT_API ITextDocumentContentgetPayload () const
 Returns a string representation of the total payload for this search, as passed to MarkLogic Server. More...
 
searchdescription_parameters Common REST API call parameters to override options on the fly
MLCLIENT_API void setStart (const long start)
 Sets the start (first result) index. These are 1 not 0 based in MarkLogic Server. More...
 
MLCLIENT_API const long getStart () const
 Retrieves the start (first result) index. These are 1 not 0 based in MarkLogic Server. More...
 
MLCLIENT_API void setPageLength (const long pageLength)
 Sets the number of results to return per page. More...
 
MLCLIENT_API const long getPageLength () const
 Returns the number of results shown per page. More...
 

Detailed Description

A POD class representing input to the POST of /v1/search - i.e. all search configuration.

Since
8.0.0
Author
Adam Fowler adam..nosp@m.fowl.nosp@m.er@ma.nosp@m.rklo.nosp@m.gic.c.nosp@m.om
Date
2016-04-25

May contain just query text, a complex query, options, or a mix thereof.

Used to simplify calls to Connection::search

Defaults to a blank text query (i.e. return all results) and default (server side configured) options.

Constructor & Destructor Documentation

virtual MLCLIENT_API mlclient::SearchDescription::~SearchDescription ( )
virtual

Default destructor.

Note
Virtual so allows subclassing

Member Function Documentation

MLCLIENT_API const ITextDocumentContent& mlclient::SearchDescription::getOptions ( ) const

Returns the options as a document.

Returns
A non-editable reference to the underlying search options.
MLCLIENT_API const long mlclient::SearchDescription::getPageLength ( ) const

Returns the number of results shown per page.

Returns
The number of results per page
MLCLIENT_API ITextDocumentContent* mlclient::SearchDescription::getPayload ( ) const

Returns a string representation of the total payload for this search, as passed to MarkLogic Server.

Includes search complex query, query text, and options document, if supplied.

Used as the raw input to POST /v1/search, and encompasses all search configuration

Returns
A TextDocumentContent (Which may be XML or JSON) wrapping the entire search request. Caller is responsible for deleting this object.
MLCLIENT_API const ITextDocumentContent& mlclient::SearchDescription::getQuery ( ) const

Returns the complex query as a document.

Note
Does not return a representation of the query text as a cts:query - use ::getQueryText for that
Returns
A non editable reference to the underlying complex query TextDocumentContent
MLCLIENT_API const std::string& mlclient::SearchDescription::getQueryText ( ) const

Returns the plain text query.

Returns
A non-editable reference to the underlying string query text.
MLCLIENT_API const long mlclient::SearchDescription::getStart ( ) const

Retrieves the start (first result) index. These are 1 not 0 based in MarkLogic Server.

Returns
The start (first result) index (1 based)
MLCLIENT_API void mlclient::SearchDescription::setOptions ( ITextDocumentContent options)

Set the search options content.

Could be either an XML or JSON description of search options.

See CppRestJsonHelper or PugiXmlHelper to create a TextDocumentContent that wraps raw JSON or XML strings.

Parameters
[in,out]optionsThe search options as an XML or JSON IDocumentContent instance
MLCLIENT_API void mlclient::SearchDescription::setPageLength ( const long  pageLength)

Sets the number of results to return per page.

Parameters
pageLengthThe number of results per page to return
MLCLIENT_API void mlclient::SearchDescription::setQuery ( ITextDocumentContent query)

Sets the complex query using an XML or JSON IDocumentContent instance.

See CppRestJsonHelper or PugiXmlHelper to create a TextDocumentContent that wraps raw JSON or XML strings.

Parameters
[in,out]queryThe TextDocumentContent instance wrapping the XML or JSON query.
MLCLIENT_API void mlclient::SearchDescription::setQueryText ( std::string  qtext)

Sets the plain text query text.

This can be used at the same time as a complex query in POST /v1/search (i.e. in Connection::search )

Parameters
[in,out]qtextThe plain text query
MLCLIENT_API void mlclient::SearchDescription::setStart ( const long  start)

Sets the start (first result) index. These are 1 not 0 based in MarkLogic Server.

Parameters
startThe point in the result set to begin returning results from the server

The documentation for this class was generated from the following file: