ddc
List of all members
CConcSession Class Reference

class for a single (thread-local) DDC query session; formerly CConcHolder An instance of CConcSession is created for each thread querying a corpus. It contains all user options for query processing such as m_ResultLimit (maximal number of hits to output) or m_QueryResultStr (the string representation of the query result). More...

#include <ConcSession.h>

Inheritance diagram for CConcSession:
Inheritance graph
[legend]
Collaboration diagram for CConcSession:
Collaboration graph
[legend]

Public Member Functions

Low-level API (formerly private)
void AddFileReference (const long FileNo)
 add a reference to FileNo according to m_ResultFormat More...
 
void ShowBibliographyForTextOrHtml (const CHit &Hit, DWORD PageNumber)
 add bibliographical information about Hit to m_QueryResultStr More...
 
bool ShowBibliographyForTable (DWORD PageNumber, const CHit &Hit, const vector< COutputToken > &Tokens)
 add bibliographical information about Hit to m_QueryResultStr under TableFormat More...
 
bool GenerateOneHitString (DWORD PageNumber, const CHit &Hit, const vector< COutputToken > &Tokens)
 add hit string built by Hit to to m_QueryResultStr More...
 
bool GenerateOneHitStringJson (DWORD PageNumber, const CHit &Hit, const vector< COutputToken > &Tokens)
 json: add hit string built by Hit to to m_QueryResultStr More...
 
bool GetContext (int StartBreakNo, int EndBreakNo, const DWORD CurrFileNo, const bool bConvertASCIIToHtmlSymbols, string &Result) const
 add hit strings [StartBreakNo, EndBreakNo) without highlighting to m_QueryResultStr More...
 
bool GetContextJson (int StartBreakNo, int EndBreakNo, const DWORD CurrFileNo, string &js) const
 append json hit strings [StartBreakNo, EndBreakNo) without highlighting to js More...
 
DDCErrorEnum GetAllHits (const string &Query, size_t Start, size_t Limit)
 
DDCErrorEnum GetAllHits (CQuery *QueryRoot, size_t Start, size_t Limit)
 
bool IsUniversalCountQuery (CQuery *QueryRoot) const
 check if CountQuery is a count(*) query suitable for use with GetUniversalCounts() More...
 
bool TryToGetFromCache (const string &Query, DWORD &EndHitNo)
 checks if Query si already in the cache, and if true, it returns its hit results from the cache More...
 
void SaveToCache (const string &Query, vector< size_t >::const_iterator start, vector< size_t >::const_iterator end)
 stores Query to the cache More...
 
void SetHitType ()
 sets hit type, initializing m_pBreaks More...
 
bool GetFileSnippets (const int HitNo, vector< COutputToken > &Tokens) const
 creates snippets, concatenating contexts of found words More...
 
bool SaveOccurrences (const vector< DWORD > &ChunkLengths, int ContextSize, const vector< CTokenNo > &Occurrences, const vector< CHit > &Hits, SaveTriggerType SaveTrigger, DWORD LParam)
 saves current found hits using SaveTrigger, this function is only called from GetOccurrences More...
 
bool GetTokensFromStorageByBreak (size_t IndexNo, size_t BreakNo, vector< COutputToken > &Tokens) const
 initializes Tokens with words of hit BreakNo More...
 
void InitFileReferences (vector< CHit > &Hits) const
 initializes CHit::m_FileNo for each hit of Hits More...
 
void InitSortKeyForHits (const CQuery *pQuery, const CDDCFilterWithBounds &Filter, vector< size_t > &PeriodHitsIndex)
 
void InitSortByRank (const CQuery *pQuery) const
 
void InitSortBySize (const CQuery *pQuery) const
 
void InitSortByRandom (const CQuery *pQuery) const
 
void InitSortByContext (const CQuery *pQuery, const CDDCFilterWithBounds &Filter) const
 
void SortKeyLB (CHitSortKey &key, const CDDCFilterWithBounds &Filter)
 
Constructors etc.
 CConcSession (CConcSessionContext *SessionContext=NULL)
 
 ~CConcSession ()
 
Worker-thread and ConcSessionContext utilities
CConcSessionWorkerClone (size_t WorkerId)
 
void WorkerCloneFree ()
 
int LockSessionContext ()
 
int UnlockSessionContext ()
 
void ClearQueryCache ()
 
size_t CacheSize (void) const
 
- Public Member Functions inherited from ConcIndexatorInvoker
 ConcIndexatorInvoker ()
 
void SetCurrMessage (string Message) const
 outputs a message to stdout or to GUI More...
 
bool BuildIndex (string ProjectFile)
 builds index files for project ProjectFile More...
 
- Public Member Functions inherited from CQueryResult
void ClearQueryResults ()
 clears CQueryResult fields More...
 
template<typename HitIndexLessThanT >
void SortResultsByIndex (HitIndexLessThanT &HitIndexLess)
 
template<typename HitLessThanT >
void SortResultsByHit (HitLessThanT &HitLess)
 
template<typename HitIndexLessThanT >
void SortResultsByIndexP (HitIndexLessThanT HitIndexLess)
 
template<typename HitLessThanT >
void SortResultsByHitP (HitLessThanT HitLess)
 

Public Attributes

Low-level data (formerly private)
CConcSessionContextm_pSessionContext
 shared session data (cache, etc.) More...
 
bool m_bSessionMaster
 are we acting as a session master? if false, m_pSessionContext will be freed on object destruction; default=true More...
 
size_t m_WorkerId
 local worker-thread ID (default=0) More...
 
CQueryCompilerm_pQueryCompiler
 current query compiler, for compilation & evaluation of input queries. More...
 
DDCRandomm_pRandom
 pseudo-random number generator More...
 
time_t m_QueryEndTime
 how much time a query can be processed, by default unlimited (-1) More...
 
const ddcBreakVectorm_pBreaks
 a pointer to the current hits collection More...
 
DDCFormatTypeEnum m_ResultFormat
 the format of query result More...
 
High-level data
unsigned int m_RandomSeed
 initial random-state components for m_pRandom More...
 
CShortOccurCacheMap m_ShortOccurCaches
 a cache for short occurrence lists which is used during iterating through corpus periods and evaluating of the same query More...
 
string m_QueryResultStr
 the result of the query (its format depends upon m_ResultFormat) More...
 
string m_ErrorStr
 most recent error message (if applicable) More...
 
CConcordancem_pConcordance
 m_pConcordance is the main (and the only) pointer to corpus indices and break collections. During the querying this pointer is used as a constant. Class CConcSession's original name "CConcHolder" was chosen because the class "holds" this pointer. More...
 
size_t m_ResultOffset
 
size_t m_ResultLimit
 
string m_ResultMinKey
 
string m_RequestPath
 full request path leading to this session (used by CDDCLeafServer) More...
 
size_t m_CurrentSearchPeriodNo
 The index of the current subcorpora, which is now being processed. More...
 
string m_AdditionalHitDelimiter
 a delimiter which should be used between hits in m_QueryResultStr in the distributed model More...
 
- Public Attributes inherited from ConcIndexatorInvoker
bool m_bStoppedByUser
 if true, CConcIndexatorInvoker tries to stop indexing More...
 
bool m_bOnlyReindexMorphology
 if true, then BuildIndex should only rebuild MorphPattern index More...
 
bool m_bSkipInitialFileChecking
 if true, then there is no initial checking whether the source files exist More...
 
string m_CurrMessage
 the last message from indexing process More...
 
bool m_bStdout
 should DDC send all messages to stdout More...
 
int m_CurrentSourceFileNo
 the index of the currently processing source file More...
 
int m_SourceFilesNumber
 the number of files to index More...
 
string m_CurrentSourceFileName
 the name of file More...
 
CMyTimeSpanHolder m_Profiler
 a slot to gather profiling information for loading stage More...
 
- Public Attributes inherited from CQueryResult
vector< CHitm_Hits
 found hits (not more than m_pConcordance->m_MaxCachedHitsCount). More...
 
vector< CTokenNom_HighlightOccurs
 words that should be highlighted in hits; m_HighlightOccurs is the concatenation of CQueryNode::m_Occurrences for all subcorpora More...
 
vector< BYTEm_HighlightIds
 highlighting match-ids for m_HighlightOccurs More...
 
size_t m_AllHitsCount
 the number of all found hits (if m_AllHitsCount < m_pConcordance->m_MaxCachedHitsCount, then m_Hits.size() == m_AllHitsCount) More...
 
size_t m_RelevantDocumentCount
 the number of documents, where at least one hit is found More...
 
bool m_bSortByString: 1
 whether to sort by string-value More...
 
bool m_bPrune: 1
 whether primary sort is a prune-sort More...
 
HitSortOrderEnum m_SortOrder: 4
 hit sort order More...
 
vector< BYTEm_DebugInfo
 ? More...
 

High-level API (public)

const ddcBreakVectorGetBreaks () const
 GetBreaks returns the vector of current breaks (by m_pBreaks). More...
 
DDCFormatTypeEnum GetResultFormat () const
 return the current format of hit More...
 
string GetResultFormatStr () const
 return string representation of m_ResultFormat More...
 
void SetResultFormat (string ResultTypeStr)
 set the current format of hit More...
 
DDCErrorEnum GetOccurrences (const string &Query, int ContextSize, SaveTriggerType SaveTrigger, DWORD LParam)
 Finds all occurrences of Query(only occurrences , not hits!), if Query is an atomic query (CQueryNode::m_bAtomic), For each found occurrence it calls SaveTrigger, which normally should save all occurrences to a file. This function is called in application ConcordPattern. More...
 
DDCErrorEnum SimpleQuery (const string &Query, DWORD &EndHitNo, DWORD &HitsCount)
 SimpleQuery finds hits by the given query. EndHitNo is used as an input/output parameter. More...
 
DDCErrorEnum GetHits (const string &QueryStr, DWORD &EndHitNo)
 
DDCErrorEnum GetHits (CQuery *QueryRoot, DWORD &EndHitNo)
 
DDCErrorEnum GetHits (CQuery *QueryRoot, DWORD &EndHitNo, const string &QueryStr)
 
DDCErrorEnum GenerateHitStrings (const int StartHitNo, bool UseAdditionalHitDelimiter=true)
 
DDCErrorEnum GenerateCountStrings (const int StartHitNo, bool UseAdditionalHitDelimiter=true)
 
size_t GetOffsetHint (const size_t StartHitNo) const
 get offset-hint appropriate for next page (after GenerateHitStrings()); used by CDDCLeafServer More...
 
string GetSortKeyHint (const size_t StartHitNo) const
 get sortkey-hint appropriate for next page (after GenerateHitStrings()); used by CDDCLeafServer More...
 
string GetHitIds () const
 
string GetCountIds () const
 
HitSortOrderEnum HitSortOrder () const
 get logical hit sort order; replaces HitsShouldBeSorted() More...
 
void SetTimeOut (int TimeOut)
 sets timeout for query processing More...
 
void ClearQuery ()
 clears the current parsed query (if any) More...
 
int GetTextArea () const
 return the text area to be be searched More...
 
void ClearQueryResults ()
 clears CQueryResult fields, also m_ErrorStr and m_ResultOffset More...
 
bool HasRankOrderOperator () const
 
bool HasMatchIdOperator () const
 
int GetBreakStarterLength () const
 return the length of break prefix, where DDC should search (#within[sentence, 10]) More...
 
string BuildJsonContextString (const vector< COutputToken > &Tokens, bool doHighlight=true) const
 moo: build a json context string by parsing delimited token data More...
 
string CanonicalQueryString (const string &Query)
 moo: return a canonical representation of the query string Query (implicitly parses) More...
 
string JsonQueryString (const string &Query)
 moo: return a JSONr epresentation of the query string Query (implicitly parses) More...
 
void SetRandomSeed (unsigned int seed1=0) const
 moo: set internal random seed to m_RandomSeed+seed1 More...
 
TxDispatcherGetTxDispatcher () const
 moo: get term-expansion dispatcher for this object (wrapper for &m_pConcordance.m_Txd) More...
 
static DDCFormatTypeEnum GetResultFormatByString (const string &ResultTypeStr)
 converts a string to a FormatTypeEnum More...
 
static void DecorateQueryResults (const string &ResultTypeStr, string &QueryResultString)
 adds header and footer to QueryResultStr according to format ResultTypeStr More...
 

Detailed Description

class for a single (thread-local) DDC query session; formerly CConcHolder An instance of CConcSession is created for each thread querying a corpus. It contains all user options for query processing such as m_ResultLimit (maximal number of hits to output) or m_QueryResultStr (the string representation of the query result).

As of v2.1.0, data to be shared between multiple threads (e.g. cache) lives in CConcSessionContext, which see for details.

Constructor & Destructor Documentation

◆ CConcSession()

CConcSession::CConcSession ( CConcSessionContext SessionContext = NULL)

Default constructor

Parameters
SessionContextshared context for this session; if unspecified or NULL, a new local CConcSessionContext will be created and freed when the CConcSession object itself is destroyed; otherwise, user is responsible for freeing SessionContext.

References DDC_ResultText, hsoNone, SIZE_MAX, and TheEndOfTheWorld.

◆ ~CConcSession()

CConcSession::~CConcSession ( )

Default destructor

Member Function Documentation

◆ AddFileReference()

void CConcSession::AddFileReference ( const long  FileNo)

add a reference to FileNo according to m_ResultFormat

References DDC_ResultHTML, DDC_ResultTable, and DDC_ResultText.

◆ ShowBibliographyForTextOrHtml()

void CConcSession::ShowBibliographyForTextOrHtml ( const CHit Hit,
DWORD  PageNumber 
)

◆ ShowBibliographyForTable()

bool CConcSession::ShowBibliographyForTable ( DWORD  PageNumber,
const CHit Hit,
const vector< COutputToken > &  Tokens 
)

◆ GenerateOneHitString()

bool CConcSession::GenerateOneHitString ( DWORD  PageNumber,
const CHit Hit,
const vector< COutputToken > &  Tokens 
)

◆ GenerateOneHitStringJson()

bool CConcSession::GenerateOneHitStringJson ( DWORD  PageNumber,
const CHit Hit,
const vector< COutputToken > &  Tokens 
)

◆ GetContext()

bool CConcSession::GetContext ( int  StartBreakNo,
int  EndBreakNo,
const DWORD  CurrFileNo,
const bool  bConvertASCIIToHtmlSymbols,
string &  Result 
) const

add hit strings [StartBreakNo, EndBreakNo) without highlighting to m_QueryResultStr

References BuildHtmlHitStrWithHighlighting(), DDC_ResultTable, ErrorMessage(), Format(), PredefinedFileBreakName, and ddcVecFile< T >::size().

Here is the call graph for this function:

◆ GetContextJson()

bool CConcSession::GetContextJson ( int  StartBreakNo,
int  EndBreakNo,
const DWORD  CurrFileNo,
string &  js 
) const

append json hit strings [StartBreakNo, EndBreakNo) without highlighting to js

defined(DDC_JSON_DEEP_CONTEXT)

References ErrorMessage(), errOther, Format(), PredefinedFileBreakName, and ddcVecFile< T >::size().

Here is the call graph for this function:

◆ GetAllHits() [1/2]

DDCErrorEnum CConcSession::GetAllHits ( const string &  Query,
size_t  Start,
size_t  Limit 
)

evaluate query on the corpus and initialize slots from CQueryResult

  • backwards-compatible version assuming Query was already have been parsed

◆ GetAllHits() [2/2]

DDCErrorEnum CConcSession::GetAllHits ( CQuery QueryRoot,
size_t  Start,
size_t  Limit 
)

◆ IsUniversalCountQuery()

bool CConcSession::IsUniversalCountQuery ( CQuery QueryRoot) const

check if CountQuery is a count(*) query suitable for use with GetUniversalCounts()

◆ TryToGetFromCache()

bool CConcSession::TryToGetFromCache ( const string &  Query,
DWORD EndHitNo 
)

checks if Query si already in the cache, and if true, it returns its hit results from the cache

◆ SaveToCache()

void CConcSession::SaveToCache ( const string &  Query,
vector< size_t >::const_iterator  start,
vector< size_t >::const_iterator  end 
)

stores Query to the cache

◆ SetHitType()

void CConcSession::SetHitType ( )

sets hit type, initializing m_pBreaks

References PredefinedTextAreaBreakName, and UnknownTextAreaNo.

◆ GetFileSnippets()

bool CConcSession::GetFileSnippets ( const int  HitNo,
vector< COutputToken > &  Tokens 
) const

creates snippets, concatenating contexts of found words

References errReadSourceFile.

◆ SaveOccurrences()

bool CConcSession::SaveOccurrences ( const vector< DWORD > &  ChunkLengths,
int  ContextSize,
const vector< CTokenNo > &  Occurrences,
const vector< CHit > &  Hits,
SaveTriggerType  SaveTrigger,
DWORD  LParam 
)

saves current found hits using SaveTrigger, this function is only called from GetOccurrences

References concord_daemon_log(), DDC_STATIC_BUFLEN, and Format().

Here is the call graph for this function:

◆ GetTokensFromStorageByBreak()

bool CConcSession::GetTokensFromStorageByBreak ( size_t  IndexNo,
size_t  BreakNo,
vector< COutputToken > &  Tokens 
) const

initializes Tokens with words of hit BreakNo

References errReadSourceFile, CStringIndexSet::GetTokensFromStorage(), and CStringIndexSet::m_Name.

Here is the call graph for this function:

◆ InitFileReferences()

void CConcSession::InitFileReferences ( vector< CHit > &  Hits) const

◆ InitSortKeyForHits()

void CConcSession::InitSortKeyForHits ( const CQuery pQuery,
const CDDCFilterWithBounds Filter,
vector< size_t > &  PeriodHitsIndex 
)

◆ InitSortByRank()

void CConcSession::InitSortByRank ( const CQuery pQuery) const

◆ InitSortBySize()

void CConcSession::InitSortBySize ( const CQuery pQuery) const

◆ InitSortByRandom()

void CConcSession::InitSortByRandom ( const CQuery pQuery) const

◆ InitSortByContext()

void CConcSession::InitSortByContext ( const CQuery pQuery,
const CDDCFilterWithBounds Filter 
) const

◆ SortKeyLB()

void CConcSession::SortKeyLB ( CHitSortKey key,
const CDDCFilterWithBounds Filter 
)

initialize a CHitSortKey integer lower-bound for its string key with respect to Filter

  • basically the inverse of InitSortKeyForHits()
  • used for m_ResultMinKey-based pruning
    Parameters
    Key(input/output)
  • on input, Key.s is a key-string as reported by GetHitIds()
  • on return on return, Key.i is a lower bound for Key.s with respect to Filter
    Parameters
    Filter(input) filter with respect to which key is to be initialized

References ddcLogWarn, errOther, Format(), CFreeBiblIndexInterface::GetIntegerLowerBound(), CStringIndexSet::GetTypeIndexIdLowerBound(), GreaterByFreeBiblField, GreaterByLeftContext, GreaterByMiddleContext, GreaterByPruneKey, GreaterByRightContext, hex2int(), HitSortEnumStrings, CHitSortKey::i, LessByFreeBiblField, LessByLeftContext, LessByMiddleContext, LessByPruneKey, LessByRightContext, CDDCFilterWithBounds::m_AttrName, CDDCFilterWithBounds::m_BiblIndex, CDDCFilterWithBounds::m_FilterType, NoSort, and CHitSortKey::s.

Here is the call graph for this function:

◆ WorkerClone()

CConcSession * CConcSession::WorkerClone ( size_t  WorkerId)

create a minimal copy of this object for use by a worker thread

!!!!!!! hic sunt dracones !!!!!!!

References concord_daemon_log(), Format(), m_AdditionalHitDelimiter, m_pBreaks, m_pConcordance, m_pRandom, m_pSessionContext, m_RandomSeed, m_WorkerId, and DDCRandom::set_seed().

Referenced by CDDCLeafServer::WorkerCloneInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WorkerCloneFree()

void CConcSession::WorkerCloneFree ( )

perform local cleanup of a worker clone prior to deletion

Referenced by CDDCLeafServer::WorkerCloneFree().

Here is the caller graph for this function:

◆ LockSessionContext()

int CConcSession::LockSessionContext ( )

lock session context

◆ UnlockSessionContext()

int CConcSession::UnlockSessionContext ( )

unlock session context

◆ ClearQueryCache()

void CConcSession::ClearQueryCache ( )

clears the shared query cache

Referenced by CDDCLeafServer::handle__clear_cache().

Here is the caller graph for this function:

◆ CacheSize()

size_t CConcSession::CacheSize ( void  ) const

return shared query cache size

Referenced by CDDCLeafServer::handle__status().

Here is the caller graph for this function:

◆ GetBreaks()

const ddcBreakVector & CConcSession::GetBreaks ( ) const

GetBreaks returns the vector of current breaks (by m_pBreaks).

Referenced by CQueryNode::ConvertOccurrencesToHits(), CQueryNode::ConvertOccurrencesToHitsForPatterns(), and CQCountKeyExprToken::Evaluate().

Here is the caller graph for this function:

◆ GetResultFormat()

DDCFormatTypeEnum CConcSession::GetResultFormat ( ) const
inline

◆ GetResultFormatStr()

string CConcSession::GetResultFormatStr ( ) const

return string representation of m_ResultFormat

References DDC_ResultDocIds, DDC_ResultHTML, DDC_ResultJson, and DDC_ResultTable.

Referenced by GetResultFormat(), CDDCLeafServer::handle__get_hit_strings(), and CDDCLeafServer::handle__run_query().

Here is the caller graph for this function:

◆ SetResultFormat()

void CConcSession::SetResultFormat ( string  ResultTypeStr)

set the current format of hit

Referenced by GetResultFormat(), CDDCLeafServer::handle__get_hit_strings(), and CDDCLeafServer::handle__run_query().

Here is the caller graph for this function:

◆ GetOccurrences()

DDCErrorEnum CConcSession::GetOccurrences ( const string &  Query,
int  ContextSize,
SaveTriggerType  SaveTrigger,
DWORD  LParam 
)

Finds all occurrences of Query(only occurrences , not hits!), if Query is an atomic query (CQueryNode::m_bAtomic), For each found occurrence it calls SaveTrigger, which normally should save all occurrences to a file. This function is called in application ConcordPattern.

References CQueryNode::ConvertOccurrencesToHitsForPatterns(), ddcLogError, errNone, ErrorMessage(), errParseError, CQueryNode::EvaluateWithoutHits(), CQueryNode::m_ChunkLengths, CExpc::m_ErrorCode, CQueryNode::m_Hits, CQueryNode::m_Occurrences, and CExpc::m_strCause.

Referenced by GetResultFormat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SimpleQuery()

DDCErrorEnum CConcSession::SimpleQuery ( const string &  Query,
DWORD EndHitNo,
DWORD HitsCount 
)

SimpleQuery finds hits by the given query. EndHitNo is used as an input/output parameter.

Let H0...Hn be all hits which match the Query. Then EndHitNo must be 0<= EndHitNo<=n. Let S be min (n, EndHitNo+m_ResultLimit-1). The function saves hits [EndHitNo, EndHitNo+1,... EndHitNo+s] to result strings. After this it makes EndHitNo equal to s+1. The function returns errNone, if there is no parse error in the given query.

(moo) put simply:

  • as an INPUT parameter, EndHitNo is the offset of the FIRST hit to return
  • as an OUTPUT parameter, EndHitNo is the offset of the offset of the first hit NOT returned (= upper bound; last hit returned + 1)

References DDC_ResultHTML, ddcLogError, errNone, ErrorMessage(), Format(), and CExpc::m_strCause.

Referenced by GetResultFormat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHits() [1/3]

DDCErrorEnum CConcSession::GetHits ( const string &  QueryStr,
DWORD EndHitNo 
)

GetHits does the same as SimpleQuery does, but without GenerateHitStrings()

References errParseError.

Referenced by CQKeys::Compile(), GetResultFormat(), CDDCLeafServer::handle__get_first_hits(), and CDDCLeafServer::handle__run_query().

Here is the caller graph for this function:

◆ GetHits() [2/3]

DDCErrorEnum CConcSession::GetHits ( CQuery QueryRoot,
DWORD EndHitNo 
)

GetHits() variant for pre-parsed queries, cache key is generated as QueryRoot->toString() + QueryRoot->optionsToString()

References CQuery::optionsToString(), and CQuery::toString().

Here is the call graph for this function:

◆ GetHits() [3/3]

DDCErrorEnum CConcSession::GetHits ( CQuery QueryRoot,
DWORD EndHitNo,
const string &  QueryStr 
)

GetHits() guts: pre-parsed QueryRoot and given string cache-key QueryStr

  • see SimpleQuery() for semantics of EndHitNo
  • may set m_ResultOffset and trim m_Hits[] accordingly (ddc >= v2.1.9)

References CQueryResultIndex::Apply(), ddcLogDebug, ddcLogError, dumpHits(), errNone, ErrorMessage(), errParseError, errRuntime, Format(), HIT_SORT_DEBUG, HIT_TRIM_DEBUG, IsLessByHitSortKey::IsLessByHitSortKey(), CQueryCompiler::m_bSatisfiable, CQuery::m_Compiler, and CExpc::m_strCause.

Here is the call graph for this function:

◆ GenerateHitStrings()

DDCErrorEnum CConcSession::GenerateHitStrings ( const int  StartHitNo,
bool  UseAdditionalHitDelimiter = true 
)

initializes m_QueryResultStr using current m_Hits and m_HighlightOccurs (for context-queries)

  • respects m_ResultOffset (generates strings for m_Hits[StartHitNo-m_ResultOffset .. StartHitNo-m_ResultOffset+m_ResultLimit-1])
    Parameters
    StartHitNological offset of 1st hit

References DDC_ResultHTML, DDC_ResultJson, errNone, errReadSourceFile, errRuntime, IsCountSort(), and PredefinedFileBreakName.

Referenced by GetResultFormat(), CDDCLeafServer::handle__get_hit_strings(), and CDDCLeafServer::handle__run_query().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GenerateCountStrings()

DDCErrorEnum CConcSession::GenerateCountStrings ( const int  StartHitNo,
bool  UseAdditionalHitDelimiter = true 
)

initializes m_QueryResultStr using current m_Hits (for count-queries)

  • respects m_ResultOffset (generates strings for m_Hits[StartHitNo-m_ResultOffset .. StartHitNo-m_ResultOffset+m_ResultLimit-1])
    Parameters
    StartHitNological offset of 1st count-hit

References DDC_ResultJson, ddcLogDebug, dumpHits(), errNone, Format(), GenerateCountString(), and HIT_SORT_DEBUG.

Referenced by GetResultFormat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetOffsetHint()

size_t CConcSession::GetOffsetHint ( const size_t  StartHitNo) const

get offset-hint appropriate for next page (after GenerateHitStrings()); used by CDDCLeafServer

Referenced by GetResultFormat(), CDDCLeafServer::handle__get_hit_strings(), and CDDCLeafServer::handle__run_query().

Here is the caller graph for this function:

◆ GetSortKeyHint()

string CConcSession::GetSortKeyHint ( const size_t  StartHitNo) const

get sortkey-hint appropriate for next page (after GenerateHitStrings()); used by CDDCLeafServer

References int2hex(), and IsCountSort().

Referenced by GetResultFormat(), and CDDCLeafServer::handle__run_query().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHitIds()

string CConcSession::GetHitIds ( ) const

stores sort-keys (CHit::m_SortKey) of current m_Hits to a string

  • adds m_ResultOffset to reported (logical) hit offsets

References DDC_SORTKEY_MAXLEN, Format(), int2hex(), IsCountSort(), CHit::m_SortKey, and CHitSortKey::s.

Referenced by GetResultFormat(), and CDDCLeafServer::handle__get_first_hits().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCountIds()

string CConcSession::GetCountIds ( ) const

GetHidIds() variant for count-queries; returns count-IDs of all hits in m_Hits[]

  • m_ResultOffset is not relevant here, since hit offsets are not reported

References DDC_SORTKEY_MAXLEN, and Format().

Referenced by GetResultFormat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HitSortOrder()

HitSortOrderEnum CConcSession::HitSortOrder ( ) const

get logical hit sort order; replaces HitsShouldBeSorted()

Referenced by GetResultFormat(), CDDCLeafServer::handle__get_first_hits(), and CDDCLeafServer::handle__run_query().

Here is the caller graph for this function:

◆ SetTimeOut()

void CConcSession::SetTimeOut ( int  TimeOut)

sets timeout for query processing

References TheEndOfTheWorld.

Referenced by GetResultFormat(), CDDCLeafServer::handle__expand_terms(), CDDCLeafServer::handle__get_first_hits(), and CDDCLeafServer::handle__run_query().

Here is the caller graph for this function:

◆ ClearQuery()

void CConcSession::ClearQuery ( )

clears the current parsed query (if any)

Referenced by CDDCLeafServer::Close(), and GetResultFormat().

Here is the caller graph for this function:

◆ GetTextArea()

int CConcSession::GetTextArea ( ) const

return the text area to be be searched

Referenced by CQueryNode::ConvertOccurrencesToHits(), CQueryNode::ConvertOccurrencesToHitsForPatterns(), and GetResultFormat().

Here is the caller graph for this function:

◆ ClearQueryResults()

void CConcSession::ClearQueryResults ( )

clears CQueryResult fields, also m_ErrorStr and m_ResultOffset

References CQueryResult::ClearQueryResults(), and ClearString().

Referenced by CConcSessionContext::CacheGet(), CDDCLeafServer::Close(), CQKeys::Compile(), and GetResultFormat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetResultFormatByString()

DDCFormatTypeEnum CConcSession::GetResultFormatByString ( const string &  ResultTypeStr)
static

converts a string to a FormatTypeEnum

References DDC_ResultDocIds, DDC_ResultHTML, DDC_ResultJson, DDC_ResultTable, DDC_ResultText, and EngMakeUpper().

Referenced by GetResultFormat(), CDDCBranchServer::handle__get_hit_strings(), CDDCLeafServer::handle__run_query(), CDDCBranchServer::RunDistributed(), and CRunQueryData::toString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DecorateQueryResults()

void CConcSession::DecorateQueryResults ( const string &  ResultTypeStr,
string &  QueryResultString 
)
static

adds header and footer to QueryResultStr according to format ResultTypeStr

References DDC_ResultHTML.

Referenced by GetResultFormat(), and CDDCBranchServer::RunDistributed().

Here is the caller graph for this function:

◆ HasRankOrderOperator()

bool CConcSession::HasRankOrderOperator ( ) const

return true, if the input query contains #less_by_rank or #greater_by_rank moo: sick, bad, ugly, and wrong!

References GreaterByRank, LessByRank, and CDDCFilterWithBounds::m_FilterType.

Referenced by GetResultFormat(), and CQueryNode::SetHolder().

Here is the caller graph for this function:

◆ HasMatchIdOperator()

bool CConcSession::HasMatchIdOperator ( ) const

return true iff the input query contains a match-id operator (=ID) moo: sicker, badder, uglier, and wronger!

Referenced by GetResultFormat(), and CQueryNode::SetHolder().

Here is the caller graph for this function:

◆ GetBreakStarterLength()

int CConcSession::GetBreakStarterLength ( ) const

return the length of break prefix, where DDC should search (#within[sentence, 10])

Referenced by GetResultFormat().

Here is the caller graph for this function:

◆ BuildJsonContextString()

string CConcSession::BuildJsonContextString ( const vector< COutputToken > &  Tokens,
bool  doHighlight = true 
) const

moo: build a json context string by parsing delimited token data

References jsonStr(), and CStringIndexSet::m_ShortName.

Referenced by GetResultFormat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CanonicalQueryString()

string CConcSession::CanonicalQueryString ( const string &  Query)

moo: return a canonical representation of the query string Query (implicitly parses)

Referenced by GetResultFormat().

Here is the caller graph for this function:

◆ JsonQueryString()

string CConcSession::JsonQueryString ( const string &  Query)

moo: return a JSONr epresentation of the query string Query (implicitly parses)

Referenced by GetResultFormat().

Here is the caller graph for this function:

◆ SetRandomSeed()

void CConcSession::SetRandomSeed ( unsigned int  seed1 = 0) const

moo: set internal random seed to m_RandomSeed+seed1

Referenced by CQFRandomSort::Compile(), and GetResultFormat().

Here is the caller graph for this function:

◆ GetTxDispatcher()

TxDispatcher* CConcSession::GetTxDispatcher ( ) const
inline

moo: get term-expansion dispatcher for this object (wrapper for &m_pConcordance.m_Txd)

References CConcordance::m_Txd.

Referenced by CQTokInfl::GetChain(), CDDCLeafServer::handle__expand_terms(), and CDDCLeafServer::handle__info().

Here is the caller graph for this function:

Member Data Documentation

◆ m_pSessionContext

CConcSessionContext* CConcSession::m_pSessionContext

shared session data (cache, etc.)

Referenced by WorkerClone().

◆ m_bSessionMaster

bool CConcSession::m_bSessionMaster

are we acting as a session master? if false, m_pSessionContext will be freed on object destruction; default=true

◆ m_WorkerId

size_t CConcSession::m_WorkerId

local worker-thread ID (default=0)

Referenced by WorkerClone().

◆ m_pQueryCompiler

CQueryCompiler* CConcSession::m_pQueryCompiler

current query compiler, for compilation & evaluation of input queries.

◆ m_pRandom

DDCRandom* CConcSession::m_pRandom

pseudo-random number generator

Referenced by WorkerClone().

◆ m_QueryEndTime

time_t CConcSession::m_QueryEndTime

how much time a query can be processed, by default unlimited (-1)

◆ m_pBreaks

const ddcBreakVector* CConcSession::m_pBreaks

a pointer to the current hits collection

Referenced by WorkerClone().

◆ m_ResultFormat

DDCFormatTypeEnum CConcSession::m_ResultFormat

the format of query result

Referenced by GetResultFormat().

◆ m_RandomSeed

unsigned int CConcSession::m_RandomSeed

initial random-state components for m_pRandom

Referenced by WorkerClone().

◆ m_ShortOccurCaches

CShortOccurCacheMap CConcSession::m_ShortOccurCaches
mutable

a cache for short occurrence lists which is used during iterating through corpus periods and evaluating of the same query

Referenced by CDDCLeafServer::Close(), and CQueryTokenNode::EvaluateWithoutHits().

◆ m_QueryResultStr

string CConcSession::m_QueryResultStr

the result of the query (its format depends upon m_ResultFormat)

Referenced by CDDCLeafServer::GetHitContexts(), CDDCLeafServer::GetHitCounts(), CDDCLeafServer::handle__get_hit_strings(), and CDDCLeafServer::handle__run_query().

◆ m_ErrorStr

string CConcSession::m_ErrorStr

◆ m_pConcordance

CConcordance* CConcSession::m_pConcordance

◆ m_ResultOffset

size_t CConcSession::m_ResultOffset

actual logical offset (starting from zero) of the first returnable hit in m_Hits[] (~ StartHitNo)

  • maintained by DDC (requested StartHitNo is passed in as EndHitNo rsp. StartHitNo rsp. Start)
  • this is actually the number of computed hits which have been trimmed off the front of m_Hits[]
  • alternate formulation: m_ResultOffset is the logical offset (original index) of m_Hits[0]

Referenced by CConcSessionContext::CacheGet().

◆ m_ResultLimit

size_t CConcSession::m_ResultLimit

the maximal number of hits to be returned by the current query operation

  • assumed to be set explicitly by user

Referenced by CConcSessionContext::CacheGet(), CQKeys::Compile(), CDDCLeafServer::handle__get_first_hits(), CDDCLeafServer::handle__get_hit_strings(), and CDDCLeafServer::handle__run_query().

◆ m_ResultMinKey

string CConcSession::m_ResultMinKey

minimum final sort-key of hits to be retrieved by GetAllHits()

  • applied independently for each corpus period to save memory
  • assumed to be set explicitly by user

Referenced by CDDCLeafServer::handle__get_first_hits(), and CDDCLeafServer::handle__run_query().

◆ m_RequestPath

string CConcSession::m_RequestPath

◆ m_CurrentSearchPeriodNo

size_t CConcSession::m_CurrentSearchPeriodNo

The index of the current subcorpora, which is now being processed.

Referenced by CQueryTokenNode::EvaluateWithoutHits().

◆ m_AdditionalHitDelimiter

string CConcSession::m_AdditionalHitDelimiter

a delimiter which should be used between hits in m_QueryResultStr in the distributed model

Referenced by WorkerClone().


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