#include <QueryParser.h>
CQueryParser is a class fo the parse tree of the input query and its general properties. Rewritten (Tue, 17 May 2011 11:48:20 +0200 moo) to use C-style flex reentrant scanner.
Formerly descended from FlexLexer (abstract class of flex tool), so it should implement also flex parser's functionality (DDC uses YACC in thread-safe mode)
CQueryParser::CQueryParser | ( | const CConcHolder * | pHolder | ) |
default constructor
References m_bDebugRank, m_bEnableBibliographyForThisQuery, m_ContextSentencesCount, m_CurrentNodeIndex, and m_pHolder.
CQueryParser::~CQueryParser | ( | ) | [virtual] |
void CQueryParser::CleanParser | ( | ) |
make this parse ready for the new call of CQueryParser::ParseQuery
References DeleteTree(), m_CurrDistances, m_CurrentNodeIndex, m_CurrSequenceObj, m_Filters, and m_Labels.
Referenced by ParseQuery(), and ~CQueryParser().
bool CQueryParser::ParseQueryOperators | ( | const string & | OperatorName, | |
const string & | Arguments, | |||
CDDCFilterWithBounds & | Filter | |||
) |
parse a level value for a DDC filter
References CBibliography::ConvertDateToInt(), CConcIndexator::GetRegexOptions(), CConcXml::GetValueFromBiblSet(), GreaterByFreeBiblField, CConcIndexator::m_Bibl, m_BigramsUse, CBibliography::m_DateStr, CDDCFilterWithBounds::m_FilterType, CDDCFilterWithBounds::m_FreeBiblAttribName, CDDCFilterWithBounds::m_LevelEnd, CDDCFilterWithBounds::m_LevelStart, m_pHolder, CConcHolder::m_pIndexator, CDDCFilterWithBounds::m_SatisfiedValues, and Trim().
Referenced by ParseSortAndFilterOperators().
bool CQueryParser::ParseSortAndFilterOperators | ( | string & | QueryStr | ) |
parse sort and filter operators from QueryStr (and delete these operators)
References m_BigramsUse, m_Filters, NoSort, ParseQueryOperators(), SortOperators, SortOperatorsCount, and Trim().
Referenced by ParseQuery().
int CQueryParser::yyqlex | ( | void * | valp | ) |
wrapper for yywrap() [required]
wrapper for underlying flex scanner yylex() : do NOT declare this here: it's already declared in FlexLexer.h ! wrapper for yylex() as called from bison parser (valp is a YYSTYPE*)
References m_Labels, REGEX, SYMBOL, yyleng(), yylex, and yytext().
Referenced by yyqlex().
const char* CQueryParser::yytext | ( | void | ) | const [inline] |
int CQueryParser::yyleng | ( | void | ) | const [inline] |
void CQueryParser::DeleteTree | ( | ) |
delete parse tree ( CQueryParser::m_pQueryTree )
References m_pQueryTree.
Referenced by CleanParser(), CConcHolder::GetAllHits(), and CConcHolder::GetOccurrences().
bool CQueryParser::ParseQuery | ( | const char * | query_src | ) |
parse "query_src" and build a parse tree for it
References CleanParser(), ContextStarter, ContextStarterLower, CConcIndexator::HasContextOperator(), m_bDebugRank, m_bEnableBibliographyForThisQuery, CConcIndexator::m_Bibl, m_ContextSentencesCount, m_HitTypeStr, m_pHolder, CConcHolder::m_pIndexator, m_TextAreaNo, ParseSortAndFilterOperators(), CHitBorders::ProcessHitTypeStrInQueryStr(), CConcXml::ProcessTextAreaNoInQueryStr(), Trim(), yyqdebug, and yyqparse().
Referenced by CConcHolder::GetHits(), and CConcHolder::GetOccurrences().
bool CQueryParser::Evaluate | ( | ) |
evaluate parse tree bottom-up
References CQueryNode::Evaluate(), and m_pQueryTree.
Referenced by CConcHolder::GetAllHits().
int CQueryParser::GetNewNodeIndex | ( | ) |
References m_CurrentNodeIndex.
size_t CQueryParser::GetNodeIndicesCount | ( | ) | const |
References m_CurrentNodeIndex.
Referenced by CConcHolder::InitLessByRank().
Referenced by CleanParser(), CQueryParser(), GetNewNodeIndex(), and GetNodeIndicesCount().
string CQueryParser::m_HitTypeStr |
the break collection name which should be used while querying
Referenced by CConcHolder::GenerateHitStrings(), CConcHolder::GetContext(), CConcHolder::GetContextJson(), ParseQuery(), and CConcHolder::SetHitType().
the index of text area where DDC should perform the input query
Referenced by CConcHolder::GetTextArea(), ParseQuery(), and CConcHolder::SetHitType().
filters and sort operators which should be applied to the resulted hit set
Referenced by CleanParser(), CConcHolder::GetAllHits(), CConcHolder::HasRankOrderOperator(), CConcHolder::HitsShouldBeSorted(), and ParseSortAndFilterOperators().
how many hits of the left and right context should be output
Referenced by CQueryParser(), CConcHolder::GenerateOneHitString(), CConcHolder::GenerateOneHitStringJson(), and ParseQuery().
the top of the parse tree
Referenced by DeleteTree(), Evaluate(), CConcHolder::GetAllHits(), CConcHolder::GetOccurrences(), CConcHolder::InitGreaterByRank(), CConcHolder::InitGreaterBySize(), CConcHolder::InitLessByBigrams(), CConcHolder::InitLessByRank(), CConcHolder::InitLessBySize(), and CConcHolder::InitOrderIDForHits().
a reference to the holder, for which this query is parsed
Referenced by CQueryParser(), ParseQuery(), and ParseQueryOperators().
list<string> CQueryParser::m_Labels |
a special slot for YACC (which contains all string leaves of the parse tree)
Referenced by CleanParser(), and yyqlex().
vector<const CQueryNode*> CQueryParser::m_CurrSequenceObj |
a special slot for YACC (which contains the current queue of nodes inside a sequence operator )
Referenced by CleanParser().
vector<string> CQueryParser::m_CurrDistances |
a special slot for YACC (which contains the current queue of text distances between nodes inside a sequence operator )
Referenced by CleanParser().
Referenced by CQueryParser(), CConcHolder::GenerateOneHitString(), and ParseQuery().
if left is specified, then m_BigramsUse is bdLeftBigram, if right, then m_BigramsUse is bdRightBigram, otherwize bdDontUseBigrams
Referenced by CConcHolder::GetBigramsToOrder(), ParseQueryOperators(), and ParseSortAndFilterOperators().