Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

CConcHolder Class Reference

#include <ConcHolder.h>

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

List of all members.

Public Types

Public Member Functions

Static Public Member Functions

Public Attributes

Private Member Functions

Private Attributes


Detailed Description

Class CConcHolder is created for querying a corpus. It contains all user options for the query process like m_ResultLimit (the maximal number of hits, which should be output) or m_QueryResultStr(the string representation of the query result).


Member Enumeration Documentation

FormatTypeEnum defines the format of output hits:

  • DDC_ResultHTML - output hits should be written in HTML-format; the tags "<STRONG><FONT COLOR=red>" are used for highlighting.
  • DDC_ResultText - output hits should be written in plain-format; the string "&&" is used to select the first highlighting position, "_" for the following positions are used for higlighting.
  • DDC_ResultTable - output hits should be written in table-format; there is no highlighting in the string at all, instead of this highligted words are written after the string
  • DDC_ResultJson - output hits should be written in json format.

Enumerator:
DDC_ResultHTML 
DDC_ResultText 
DDC_ResultTable 
DDC_ResultDocIds 
DDC_ResultJson 

Constructor & Destructor Documentation

CConcHolder::CConcHolder (  ) 
CConcHolder::~CConcHolder (  ) 

References m_pQueryEvaluator.


Member Function Documentation

void CConcHolder::AddFileReference ( const long  FileNo  )  [private]

add a reference to FileNo according to m_ResultFormat

References DDC_ResultHTML, DDC_ResultTable, DDC_ResultText, CConcIndexator::GetHtmlReference(), CConcIndexator::GetShortFilename(), m_pIndexator, m_QueryResultStr, and m_ResultFormat.

Referenced by GenerateOneHitString().

Here is the call graph for this function:

Here is the caller graph for this function:

void CConcHolder::ShowBibliographyForTextOrHtml ( const CHit Hit,
DWORD  PageNumber 
) [private]
bool CConcHolder::ShowBibliographyForTable ( DWORD  PageNumber,
const CHit Hit,
const vector< COutputToken > &  Tokens 
) [private]
bool CConcHolder::GenerateOneHitString ( DWORD  PageNumber,
const CHit Hit,
const vector< COutputToken > &  Tokens 
) [private]
bool CConcHolder::GenerateOneHitStringJson ( DWORD  PageNumber,
const CHit Hit,
const vector< COutputToken > &  Tokens 
) [private]
bool CConcHolder::GetContext ( int  StartBreakNo,
int  EndBreakNo,
const DWORD  CurrFileNo,
const bool  bConvertASCIIToHtmlSymbols,
string &  Result 
) const [private]
bool CConcHolder::GetContextJson ( int  StartBreakNo,
int  EndBreakNo,
const DWORD  CurrFileNo,
string &  js 
) const [private]

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

References BuildJsonContextString(), ErrorMessage(), Format(), GetBreaks(), CHitBorders::GetFileBreaks(), CHitBorders::GetFileStartTokenNo(), GetTokensFromStorageByBreak(), CQueryParser::m_HitTypeStr, CConcIndexator::m_IndicesToShow, m_pIndexator, m_pQueryEvaluator, and PredefinedFileBreakName.

Referenced by GenerateOneHitStringJson().

Here is the call graph for this function:

Here is the caller graph for this function:

DDCErrorEnum CConcHolder::GetAllHits ( string  Query,
size_t  Limit 
) [private]
bool CConcHolder::TryToGetFromCache ( string  Query,
DWORD EndHitNo 
) [private]

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

References CQueryResult::ClearQueryResults(), CQueryResult::m_AllHitsCount, CQueryResult::m_DebugInfo, CQueryResult::m_HighlightOccurs, CQueryResult::m_Hits, m_QueryCache, CQueryResult::m_RelevantDocumentCount, m_ResultLimit, and MaxCachedHitsCount.

Referenced by GetHits().

Here is the call graph for this function:

Here is the caller graph for this function:

void CConcHolder::SaveToCache ( string &  Query,
vector< size_t >::const_iterator  start,
vector< size_t >::const_iterator  end 
) [private]
void CConcHolder::SetHitType (  )  [private]

sets hit type, initializing m_pBreaks

References CHitBorders::GetBreaksByName(), CQueryParser::m_HitTypeStr, m_pBreaks, m_pIndexator, m_pQueryEvaluator, CQueryParser::m_TextAreaNo, PredefinedTextAreaBreakName, and UnknownTextAreaNo.

Referenced by GetHits(), and GetOccurrences().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CConcHolder::GetFileSnippets ( const int  HitNo,
vector< COutputToken > &  Tokens 
) const [private]
bool CConcHolder::SaveOccurrences ( const vector< size_t > &  ChunkLengths,
int  ContextSize,
const vector< CTokenNo > &  Occurrences,
const vector< CHit > &  Hits,
SaveTriggerType  SaveTrigger,
DWORD  LParam 
) [private]

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

References concord_daemon_log(), Format(), GetBreaks(), CStringIndexator::GetTokenIndex(), CStringIndexSet::GetTokensFromStorage(), CStringIndexator::m_Indices, m_pIndexator, and SaveTrigger().

Referenced by GetOccurrences().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CConcHolder::GetTokensFromStorageByBreak ( size_t  IndexNo,
size_t  BreakNo,
vector< COutputToken > &  Tokens 
) const [private]

initializes Tokens with words of hit BreakNo

References concord_daemon_log(), Format(), GetBreaks(), CStringIndexSet::GetTokensFromStorage(), CStringIndexator::m_Indices, and m_pIndexator.

Referenced by GenerateHitStrings(), GetContext(), and GetContextJson().

Here is the call graph for this function:

Here is the caller graph for this function:

void CConcHolder::InitFileReferences ( vector< CHit > &  Hits  )  const [private]

initializes CHit::m_FileNo for each hit of Hits

References GetBreaks(), CHitBorders::GetFileBreaks(), CHit::m_BreakNo, CHit::m_FileNo, CHit::m_OrderId, and m_pIndexator.

Referenced by GetAllHits().

Here is the call graph for this function:

Here is the caller graph for this function:

void CConcHolder::InitOrderIDForHits ( const CDDCFilterWithBounds Filter  )  const [private]
void CConcHolder::InitLessByRank (  )  const [private]
void CConcHolder::InitGreaterByRank (  )  const [private]

References InitLessByRank(), CQueryNode::m_Hits, m_pQueryEvaluator, and CQueryParser::m_pQueryTree.

Referenced by InitOrderIDForHits().

Here is the call graph for this function:

Here is the caller graph for this function:

void CConcHolder::InitLessBySize (  )  const [private]

References GetBreaks(), CHit::m_BreakNo, CQueryNode::m_Hits, CHit::m_OrderId, m_pQueryEvaluator, and CQueryParser::m_pQueryTree.

Referenced by InitOrderIDForHits().

Here is the call graph for this function:

Here is the caller graph for this function:

void CConcHolder::InitGreaterBySize (  )  const [private]

References GetBreaks(), CHit::m_BreakNo, CQueryNode::m_Hits, CHit::m_OrderId, m_pQueryEvaluator, and CQueryParser::m_pQueryTree.

Referenced by InitOrderIDForHits().

Here is the call graph for this function:

Here is the caller graph for this function:

void CConcHolder::InitLessByBigrams (  )  const [private]

References GetBreaks(), CQueryNode::m_Hits, CQueryNode::m_OccurrenceTokenIdxs, CHit::m_OrderId, m_pQueryEvaluator, and CQueryParser::m_pQueryTree.

Referenced by GetAllHits(), and InitOrderIDForHits().

Here is the call graph for this function:

Here is the caller graph for this function:

const vector< CTokenNo > & CConcHolder::GetBreaks (  )  const
FormatTypeEnum CConcHolder::GetResultFormat (  )  const [inline]

return the current format of hit

References m_ResultFormat.

string CConcHolder::GetResultFormatStr (  )  const

return string representation of m_ResultFormat

References DDC_ResultDocIds, DDC_ResultHTML, DDC_ResultJson, DDC_ResultTable, and m_ResultFormat.

Referenced by CDDCCorpusListenHost::ProcessSocketString(), and SimpleQuery().

Here is the caller graph for this function:

void CConcHolder::SetResultFormat ( string  ResultTypeStr  ) 

set the current format of hit

References GetResultFormatByString(), and m_ResultFormat.

Referenced by CDDCCorpusListenHost::ProcessSocketString().

Here is the call graph for this function:

Here is the caller graph for this function:

DDCErrorEnum CConcHolder::GetOccurrences ( 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 concord_daemon_log(), CQueryNode::ConvertOccurrencesToHitsForPatterns(), CQueryParser::DeleteTree(), ErrorMessage(), CQueryNode::EvaluateWithoutHits(), CStringIndexator::GetSearchPeriodsCount(), CQueryNode::m_bAtomic, CConcIndexatorInvoker::m_bStdout, CQueryNode::m_ChunkLengths, m_CurrentSearchPeriodNo, CExpc::m_ErrorCode, CQueryNode::m_Hits, CQueryNode::m_Occurrences, m_pIndexator, m_pQueryEvaluator, CQueryParser::m_pQueryTree, CExpc::m_strCause, CQueryParser::ParseQuery(), SaveOccurrences(), and SetHitType().

Here is the call graph for this function:

DDCErrorEnum CConcHolder::SimpleQuery ( 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 errUnknown, if there is no parse error in the given query.

References concord_daemon_log(), DDC_ResultHTML, DecorateQueryResults(), ErrorMessage(), errUnknown, Format(), GenerateHitStrings(), GetHits(), GetResultFormatStr(), CQueryResult::m_AllHitsCount, CConcIndexator::m_bShowNumberOfRelevantDocuments, CExpc::m_ErrorCode, m_pIndexator, m_QueryResultStr, CQueryResult::m_RelevantDocumentCount, m_ResultFormat, and CExpc::m_strCause.

Here is the call graph for this function:

DDCErrorEnum CConcHolder::GetHits ( string  Query,
DWORD EndHitNo 
)
DDCErrorEnum CConcHolder::GenerateHitStrings ( const int  StartHitNo  ) 
string CConcHolder::GetHitIds (  )  const

stores order ids (CHit::m_OrderId) of current m_Hits to a string

References bdDontUseBigrams, Format(), GetBigramsToOrder(), CStringIndexSet::GetIndexItemStr(), CStringIndexator::GetTokenIndex(), CQueryResult::m_Hits, CIndexSetForQueryingStage::m_Index, and m_pIndexator.

Referenced by CDDCCorpusListenHost::ProcessSocketString().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CConcHolder::HitsShouldBeSorted (  )  const

return true, if the resulting hits should be ordered somehow

References CQueryParser::m_Filters, and m_pQueryEvaluator.

Referenced by CDDCCorpusListenHost::ProcessSocketString().

Here is the caller graph for this function:

void CConcHolder::SetTimeOut ( int  TimeOut  ) 

sets timeout for query processing

References m_QueryEndTime, and TheEndOfTheWorld.

Referenced by CDDCCorpusListenHost::ProcessSocketString().

Here is the caller graph for this function:

void CConcHolder::ClearQueryCache (  ) 

clears the query cache

References m_Queries, and m_QueryCache.

Referenced by CConcordance::LoadProject().

Here is the caller graph for this function:

int CConcHolder::GetTextArea (  )  const

return the text area to be be searched

References m_pQueryEvaluator, and CQueryParser::m_TextAreaNo.

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

Here is the caller graph for this function:

CConcHolder::FormatTypeEnum CConcHolder::GetResultFormatByString ( const string &  ResultTypeStr  )  [static]

converts a string to a FormatTypeEnum

References EngMakeUpper().

Referenced by DecorateQueryResults(), CDDCServerListenHost::ProcessSocketString(), CDDCServerListenHost::RunDistributed(), and SetResultFormat().

Here is the call graph for this function:

Here is the caller graph for this function:

void CConcHolder::DecorateQueryResults ( const string &  ResultTypeStr,
string &  QueryResultString 
) [static]

adds header and footer to QueryResultStr according to format ResultTypeStr

References DDC_ResultHTML, and GetResultFormatByString().

Referenced by CDDCServerListenHost::RunDistributed(), and SimpleQuery().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CConcHolder::HasRankOrderOperator (  )  const

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

References LessByRank, CQueryParser::m_Filters, CDDCFilterWithBounds::m_FilterType, and m_pQueryEvaluator.

Referenced by GenerateOneHitString(), GenerateOneHitStringJson(), and CQueryNode::SetHolder().

Here is the caller graph for this function:

int CConcHolder::GetBreakStarterLength (  )  const

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

BigramDirectionEnum CConcHolder::GetBigramsToOrder (  )  const

true, if left or right operator

References CQueryParser::m_BigramsUse, and m_pQueryEvaluator.

Referenced by CQueryTokenNode::EvaluateWithoutHits(), GetAllHits(), GetHitIds(), and CQueryNode::SetHolder().

Here is the caller graph for this function:

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

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

References CConcIndexator::GetTokenFields(), jsonStr(), CStringIndexator::m_Indices, CConcIndexator::m_IndicesToShow, m_pIndexator, CStringIndexSet::m_ShortName, and CConcIndexator::m_Utf8.

Referenced by GenerateOneHitStringJson(), and GetContextJson().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

map<string, CQueryResult> CConcHolder::m_QueryCache [private]

hit results for the last MaxQueryCacheSize queries

Referenced by ClearQueryCache(), SaveToCache(), and TryToGetFromCache().

deque<string> CConcHolder::m_Queries [private]

a deque for last MaxQueryCacheSize queries; m_Queries.last() is the last given query

Referenced by ClearQueryCache(), and SaveToCache().

time_t CConcHolder::m_QueryEndTime [private]

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

Referenced by CConcHolder(), GetAllHits(), and SetTimeOut().

const vector<CTokenNo>* CConcHolder::m_pBreaks [private]

a pointer to the current hits collection

Referenced by CConcHolder(), GetBreaks(), and SetHitType().

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

Referenced by CQueryTokenNode::EvaluateWithoutHits(), and GetAllHits().

the maximal number of hits, which should be output to m_HtmlResult and to m_PlainResult.

Referenced by CConcHolder(), GenerateHitStrings(), GetHits(), CDDCCorpusListenHost::ProcessSocketString(), and TryToGetFromCache().

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

Referenced by CQueryTokenNode::EvaluateWithoutHits(), GetAllHits(), and GetOccurrences().

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

Referenced by GenerateHitStrings(), and CDDCCorpusListenHost::LoadHolder().


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