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

Represents a single search result. Wraps all REST API search result metadata and content. More...

#include <SearchResult.hpp>

Public Types

enum  Detail { SNIPPETS, CONTENT, NONE, CUSTOM }
 

Public Member Functions

MLCLIENT_API SearchResult ()
 
MLCLIENT_API SearchResult (const SearchResult &other)=default
 
MLCLIENT_API SearchResult (SearchResult &&other)
 
MLCLIENT_API SearchResultoperator= (SearchResult &&other)
 
SearchResultoperator= (const SearchResult &&other)
 
MLCLIENT_API ~SearchResult ()
 Destructor.
 
MLCLIENT_API SearchResult (const long index, const std::string &uri, const std::string &path, const long score, const double confidence, const double fitness, const Detail &detail, IDocumentContent *detailContent=nullptr, const std::string &mimeType="", const Format &format=Format::JSON)
 
MLCLIENT_API long getIndex ()
 Returns the (1 based) index of this result in the total search results, across all pages. More...
 
MLCLIENT_API const std::string & getUri () const
 Returns the document uri of the result. More...
 
MLCLIENT_API const std::string & getPath () const
 Returns the document (more accurately, fragment) XPath of the result. More...
 
MLCLIENT_API long getScore ()
 Returns the calculated search score for this result. More...
 
MLCLIENT_API double getConfidence ()
 Returns the calculated search confidence for this result. More...
 
MLCLIENT_API double getFitness ()
 Returns the calculated search fitness for this result. More...
 
MLCLIENT_API const DetailgetDetail () const
 Returns the level of detail of this result. More...
 
MLCLIENT_API const IDocumentContentgetDetailContent () const
 Returns the raw text content of this result. More...
 
MLCLIENT_API const std::string & getMimeType () const
 Returns the MIME type of the result. More...
 
MLCLIENT_API const FormatgetFormat () const
 Returns the short text format of this result. More...
 

Detailed Description

Represents a single search result. Wraps all REST API search result metadata and content.

A SearchResult in MarkLogic Server consistent of not just the result itself, but also its metadata. Indeed, using the "none" snippet option means no content is returned, leaving just the metadata.

Note
Supports std::move and C++11 move semantics.
Since
8.0.2
Date
2016-06-08

Member Enumeration Documentation

Represents one of the snippetting options in use by the search result

Constructor & Destructor Documentation

MLCLIENT_API mlclient::SearchResult::SearchResult ( )

Empty constructor

MLCLIENT_API mlclient::SearchResult::SearchResult ( const SearchResult other)
default

Copy constructor

Parameters
otherThe SearchResult to copy (shallow copy)
MLCLIENT_API mlclient::SearchResult::SearchResult ( SearchResult &&  other)

Move constructor

Parameters
otherThe SearchResult to move (deep reference move)
MLCLIENT_API mlclient::SearchResult::SearchResult ( const long  index,
const std::string &  uri,
const std::string &  path,
const long  score,
const double  confidence,
const double  fitness,
const Detail detail,
IDocumentContent detailContent = nullptr,
const std::string &  mimeType = "",
const Format format = Format::JSON 
)

Detail constructor. Used by SearchResultSet and other search result wrapping functions and classes.

Parameters
indexThe index (position, 1 based) of this result in the total search result list, across all pages
uriThe document URI this search result represents
pathThe XPath representing this document (more accurately, MarkLogic Fragment)
scoreThe search score calculated for this result
confidenceThe search confidence calculated for this result
fitnessThe search fitness calculated for this result
detailThe level of snippet detail returned from the result
detailContentThe raw text content of the search result
mimeTypeThe MIME type of the result content
formatThe REST API format of the result (can be "json" or "xml" or "binary" or "text" or "none")

Member Function Documentation

MLCLIENT_API double mlclient::SearchResult::getConfidence ( )

Returns the calculated search confidence for this result.

Returns
The search confidence
MLCLIENT_API const Detail& mlclient::SearchResult::getDetail ( ) const

Returns the level of detail of this result.

Returns
The level of detail returned for this result
MLCLIENT_API const IDocumentContent* mlclient::SearchResult::getDetailContent ( ) const

Returns the raw text content of this result.

Returns
The raw text content of this result
MLCLIENT_API double mlclient::SearchResult::getFitness ( )

Returns the calculated search fitness for this result.

Returns
The search fitness
MLCLIENT_API const Format& mlclient::SearchResult::getFormat ( ) const

Returns the short text format of this result.

Returns
The short text format of this result. Could be "text" or "json" or "xml" or "none"
MLCLIENT_API long mlclient::SearchResult::getIndex ( )

Returns the (1 based) index of this result in the total search results, across all pages.

Returns
The (1 based) index
MLCLIENT_API const std::string& mlclient::SearchResult::getMimeType ( ) const

Returns the MIME type of the result.

Returns
The MIME type. Could be application/json, application/xml, or any other stored MIME type
MLCLIENT_API const std::string& mlclient::SearchResult::getPath ( ) const

Returns the document (more accurately, fragment) XPath of the result.

Returns
The document (fragment) XPath of the result
MLCLIENT_API long mlclient::SearchResult::getScore ( )

Returns the calculated search score for this result.

Returns
The search score
MLCLIENT_API const std::string& mlclient::SearchResult::getUri ( ) const

Returns the document uri of the result.

Returns
The document uri of the result
MLCLIENT_API SearchResult& mlclient::SearchResult::operator= ( SearchResult &&  other)

Move assignment operator

Note
If this is not defined, it is implicitly deleted by the compiler
SearchResult& mlclient::SearchResult::operator= ( const SearchResult &&  other)

Copy assignment operator

Note
If this is not defined, it is implicitly deleted by the compiler

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