This class helps create a MarkLogic complex search JSON object for use with SearchDescription.
More...
#include <SearchBuilder.hpp>
|
|
MLCLIENT_API IQuery * | valueQuery (const std::string ref, const std::string value) |
| Creates a value query given the named reference. More...
|
|
MLCLIENT_API IQuery * | jsonValueQuery (const std::string ref, const std::string value) |
| Creates a JSON property value query given the named reference. More...
|
|
MLCLIENT_API IQuery * | xmlValueQuery (const std::string ref, const std::string value) |
| Creates an xml element value query given the named reference. More...
|
|
MLCLIENT_API IQuery * | rangeQuery (const std::string ref, const RangeOperation op, const std::string value) |
| Creates a range query given the named reference, and range operation. More...
|
|
MLCLIENT_API IQuery * | jsonRangeQuery (const std::string ref, const RangeOperation op, const std::string value) |
| Creates a JSON property range query given the named reference, and range operation. More...
|
|
MLCLIENT_API IQuery * | xmlRangeQuery (const std::string ref, const RangeOperation op, const std::string value) |
| Creates an XML element range query given the named reference, and range operation. More...
|
|
|
MLCLIENT_API SearchBuilder * | setQuery (IQuery *query) |
| Sets the root query for this search. More...
|
|
MLCLIENT_API void | setDefaultXmlNamespace (const std::string &ns) |
| Convenience method. Sets the default XML namespace for all XML queries. More...
|
|
MLCLIENT_API const std::string & | getDefaultXmlNamespace () const |
| Returns the default namespace. More...
|
|
MLCLIENT_API void | setMode (const QueryBuilderMode mode) |
| Sets the query builder mode, i.e. the format of the query. More...
|
|
MLCLIENT_API const QueryBuilderMode | getMode () const |
| Returns the current query builder format mode (JSON) More...
|
|
MLCLIENT_API ITextDocumentContent * | toDocument () |
| Generates an ITextDocumentContent instance representing the serialisation of this structured query. More...
|
|
This class helps create a MarkLogic complex search JSON object for use with SearchDescription.
- Author
- Adam Fowler adam..nosp@m.fowl.nosp@m.er@ma.nosp@m.rklo.nosp@m.gic.c.nosp@m.om
- Since
- 8.0.2
- Date
- 2016-06-08
- Note
- This class deals only with a complex search, NOT search options or text grammar.
-
This class only ever generates JSON output, never XML. This enables the class to be more efficient, using the same internal structures as required by a JSON stream.
-
This class has an external dependency on Microsoft's C++ cpprest API. As this API is required to use MarkLogic's C++ wrapper (this API) , this does not introduce any extra dependencies.
static MLCLIENT_API IQuery* mlclient::utilities::SearchBuilder::andQuery |
( |
const std::vector< IQuery * > & |
queries | ) |
|
|
static |
Factory method. Creates an and-query.
- Parameters
-
queries | A set of IQuery instances to and-together |
- Returns
- An IQuery pointer instance representing this structured query. Caller OWNS the pointer (this class does not delete it).
static MLCLIENT_API IQuery* mlclient::utilities::SearchBuilder::collectionQuery |
( |
const CollectionSet & |
collections | ) |
|
|
static |
Factory method. Creates a collection query instance.
- Parameters
-
collections | The set of collections specified for the query (an OR evaluated list) |
- Returns
- An IQuery pointer instance representing this structured query. Caller OWNS the pointer (this class does not delete it).
static MLCLIENT_API IQuery* mlclient::utilities::SearchBuilder::documentQuery |
( |
const DocumentUriSet & |
uris | ) |
|
|
static |
Factory method. Creates a Document Query instance.
- Parameters
-
uris | The DocumentUriSet (a vector<std::string>) listing the collections a document must be a member of (OR query) |
- Returns
- An IQuery pointer instance representing this structured query. Caller OWNS the pointer (this class does not delete it).
MLCLIENT_API const std::string& mlclient::utilities::SearchBuilder::getDefaultXmlNamespace |
( |
| ) |
const |
Returns the default namespace.
- Returns
- The default namespace string
MLCLIENT_API const QueryBuilderMode mlclient::utilities::SearchBuilder::getMode |
( |
| ) |
const |
Returns the current query builder format mode (JSON)
- Returns
- The QueryBuilderMode in use (JSON)
MLCLIENT_API IQuery* mlclient::utilities::SearchBuilder::jsonRangeQuery |
( |
const std::string |
ref, |
|
|
const RangeOperation |
op, |
|
|
const std::string |
value |
|
) |
| |
Creates a JSON property range query given the named reference, and range operation.
- Note
- This method checks a list of named references, and thus is an instance method.
- Parameters
-
ref | The reference to check |
op | The RangeOperation to perform |
value | The string value to match |
- Returns
- The IQuery instance created. The caller OWNS this pointer. (This class does not delete the pointer.)
MLCLIENT_API IQuery* mlclient::utilities::SearchBuilder::jsonValueQuery |
( |
const std::string |
ref, |
|
|
const std::string |
value |
|
) |
| |
Creates a JSON property value query given the named reference.
- Note
- This method checks a list of named references, and thus is an instance method.
- Parameters
-
ref | The reference to check |
value | The string value to match |
- Returns
- The IQuery instance created. The caller OWNS this pointer. (This class does not delete the pointer.)
static MLCLIENT_API IQuery* mlclient::utilities::SearchBuilder::notQuery |
( |
const IQuery * |
query | ) |
|
|
static |
Factory method. Creates a not-query.
- Parameters
-
query | The single query to not-query (pass it an or query to not anything where one of a set of queries match) |
- Returns
- An IQuery pointer instance representing this structured query. Caller OWNS the pointer (this class does not delete it).
static MLCLIENT_API IQuery* mlclient::utilities::SearchBuilder::orQuery |
( |
const std::vector< IQuery * > & |
queries | ) |
|
|
static |
Factory method. Creates an or-query instance.
- Parameters
-
queries | A set of IQuery instances to or-together |
- Returns
- An IQuery pointer instance representing this structured query. Caller OWNS the pointer (this class does not delete it).
MLCLIENT_API IQuery* mlclient::utilities::SearchBuilder::rangeQuery |
( |
const std::string |
ref, |
|
|
const RangeOperation |
op, |
|
|
const std::string |
value |
|
) |
| |
Creates a range query given the named reference, and range operation.
- Note
- This method checks a list of named references, and thus is an instance method.
- Parameters
-
ref | The reference to check |
op | The RangeOperation to perform |
value | The string value to match |
- Returns
- The IQuery instance created. The caller OWNS this pointer. (This class does not delete the pointer.)
MLCLIENT_API void mlclient::utilities::SearchBuilder::setDefaultXmlNamespace |
( |
const std::string & |
ns | ) |
|
Convenience method. Sets the default XML namespace for all XML queries.
- Parameters
-
ns | The XML namespace full URI string |
MLCLIENT_API void mlclient::utilities::SearchBuilder::setMode |
( |
const QueryBuilderMode |
mode | ) |
|
Sets the query builder mode, i.e. the format of the query.
- Warning
- This should ALWAYS be JSON for now. XML queries are not yet supported.
- Parameters
-
mode | The query format mode |
Sets the root query for this search.
Use and-query and or-query to join multiple queries together, then pass the result to this function.
- Parameters
-
query | The root query for this structured query |
- Returns
- A chainable reference to this class instance, allowing for multiple calls and easy function calling.
MLCLIENT_API IQuery* mlclient::utilities::SearchBuilder::valueQuery |
( |
const std::string |
ref, |
|
|
const std::string |
value |
|
) |
| |
Creates a value query given the named reference.
- Note
- This method checks a list of named references, and thus is an instance method.
- Parameters
-
ref | The reference to check |
value | The string value to match |
- Returns
- The IQuery instance created. The caller OWNS this pointer. (This class does not delete the pointer.)
MLCLIENT_API IQuery* mlclient::utilities::SearchBuilder::xmlRangeQuery |
( |
const std::string |
ref, |
|
|
const RangeOperation |
op, |
|
|
const std::string |
value |
|
) |
| |
Creates an XML element range query given the named reference, and range operation.
- Note
- This method checks a list of named references, and thus is an instance method.
- Parameters
-
ref | The reference to check |
op | The RangeOperation to perform |
value | The string value to match |
- Returns
- The IQuery instance created. The caller OWNS this pointer. (This class does not delete the pointer.)
MLCLIENT_API IQuery* mlclient::utilities::SearchBuilder::xmlValueQuery |
( |
const std::string |
ref, |
|
|
const std::string |
value |
|
) |
| |
Creates an xml element value query given the named reference.
- Note
- This method checks a list of named references, and thus is an instance method.
- Parameters
-
ref | The reference to check |
value | The string value to match |
- Returns
- The IQuery instance created. The caller OWNS this pointer. (This class does not delete the pointer.)
The documentation for this class was generated from the following file: