ddc
Public Member Functions | Public Attributes | List of all members
CQuerySequenceNode Class Reference

CQuerySequenceNode is an implementation of sequence operator, for example, "Mother and father". This class holds a sequence of nodes of type CQueryTokenNode (slot m_Items). Between m_Items[i] and m_Items[i+1] must be no more than m_Distances[i] tokens. More...

#include <QueryNode.h>

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

Public Member Functions

bool AddDistance (const string &s, char op='<')
 
 CQuerySequenceNode ()
 
virtual ~CQuerySequenceNode ()
 
bool Create (const CConcHolder *pHolder, const vector< const CQueryNode *> &SequenceObj, const vector< string > &DistanceStrings)
 
bool Create (const CConcHolder *pHolder, const vector< CQueryTokenNode *> &Items, const vector< BYTE > &Distances, const vector< BYTE > &DistanceOps)
 moo: create the node after initial parsing (compile-time) More...
 
void EvaluateWithoutHits ()
 initial-stage query evaluation EvaluateWithoutHits is the first stage of the evaluation of one query. The main task it to build CQueryNode::m_Occurrences, which is written by chunks, sorted by the first item of a chunk. More...
 
void Evaluate (bool bSeparateHits=false)
 
size_t GetNodeFrequencyByNodeIndex (size_t NodeIndex) const
 get occurrence count by query-node index; used by rank-sort operator. default implementation in CQueryNode just chokes. More...
 
- Public Member Functions inherited from CQueryNode
 CQueryNode (bool bUseNodeIndices=false, bool bUseMatchIds=false, const CConcHolder *holder=NULL)
 Constructor. More...
 
virtual ~CQueryNode ()
 Destructor. More...
 
void SetNegation (bool Value)
 set m_bNegated More...
 
bool GetNegation () const
 get m_bNegated More...
 
void AddOccurrence (const CQueryNode &FromNode, int FromOcc)
 insers a single occurrence FromNode.m_Occurrences[occ] More...
 
void AddOccurrences (const CQueryNode &FromNode, int start, int end)
 inserts occurrences [FromNode.m_Occurrences.begin()+start, FromNode.m_Occurrences.begin()+end) into m_Occurrences[] (and m_OccurrenceNodeIndices if appropriate) More...
 
void AddOccurrences2 (const CQueryNode &FromNode1, int start1, int end1, const CQueryNode &FromNode2, int start2, int end2)
 appends occurrences from both FromNode1 and FromNode2, maintaining sort-order and respecting both m_bUseNodeIndices and m_bUseMatchIds More...
 
void AddOccurrences3 (const CQueryNode &FromNode1, int start1, int end1, const CQueryNode &FromNode2, int start2, int end2, const CQueryNode &FromNode3, int start3, int end3)
 appends occurrences from FromNode1, FromNode2, and FromNode3 maintaining sort-order and respecting both m_bUseNodeIndices and m_bUseMatchIds More...
 
void ClearAndReserveOccurrences (int size)
 
void SwapOccurrences (CQueryNode &Node, bool swapChunkLengths=false)
 swaps m_Occurrences[], m_OccurrenceNodeIndices[], and m_OccurrenceMatchIds[] between caller object and Node More...
 
void ConvertOccurrencesToHits (bool bSeparateHits)
 convert occurrences to hits using m_pHolder->GetBreaks() More...
 
void ConvertOccurrencesToHitsForPatterns (bool bSeparateHits)
 convert occurrences to hits for pattern query construction (like "mother likes father") More...
 
void EnsureChunkOffsets ()
 ensure m_ChunkOffsets[] is populated More...
 
void SetHolder (const CConcHolder *pHolder)
 set m_pHolder dependent properties m_bUseNodeIndices, m_bUseMatchIds More...
 
virtual bool IsUniversalWildcard () const
 return true iff this is a universal wildcard query (*); default returns false More...
 
DWORD HitOccurrencesBegin (DWORD HitNo) const
 get the index of the first occurrence in m_Occurrences[] for hit number HitNo More...
 
DWORD HitOccurrencesEnd (DWORD HitNo) const
 get the index of the first occurrence in m_Occurrences[] after hit number HitNo More...
 
DWORD GetFirstOccurrenceInHit (DWORD HitNo, BYTE MatchId) const
 
DWORD GetLastOccurrenceInHit (DWORD HitNo, BYTE MatchId) const
 
DWORD GetMiddleOccurrenceInHit (DWORD HitNo, BYTE MatchId) const
 
DWORD BreakStride () const
 get average size of gap between breaks in m_Hits[]; returned value is always >= 1 More...
 

Public Attributes

vector< BYTEm_DistanceOps
 
vector< BYTEm_Distances
 
vector< CQueryTokenNode * > m_Items
 
- Public Attributes inherited from CQueryNode
bool m_bAtomic
 true if this node is a description of one token or a sequence of adjacent tokens More...
 
bool m_bNegated
 is the node negated? More...
 
string m_Source
 the string from which this node was created More...
 
vector< CTokenNom_Occurrences
 all occurrences of this node in the current subcorpus, which should be highlighted More...
 
bool m_bUseNodeIndices
 should DDC uses m_OccurrenceNodeIndices (m_OccurrenceNodeIndices is necessary only for #less_by_rank) More...
 
vector< BYTEm_OccurrenceNodeIndices
 query node indices for each occurrence (the origin for each occurrence) More...
 
bool m_bUseMatchIds
 should DDC use m_OccurrenceMatchIds to track match-ids? More...
 
vector< BYTEm_OccurrenceMatchIds
 match-ids for each occurrence in m_Occurrences (only if m_bUseMatchIds is true) More...
 
vector< CHitm_Hits
 all hits of this node in the current subcorpora More...
 
const CConcHolderm_pHolder
 a reference to the parent holder (moo: should be unused until evaluation time, but isn't!) More...
 
vector< DWORDm_ChunkLengths
 
vector< DWORDm_ChunkOffsets
 
vector< int > m_CacheIds
 ??? More...
 

Detailed Description

CQuerySequenceNode is an implementation of sequence operator, for example, "Mother and father". This class holds a sequence of nodes of type CQueryTokenNode (slot m_Items). Between m_Items[i] and m_Items[i+1] must be no more than m_Distances[i] tokens.

Constructor & Destructor Documentation

◆ CQuerySequenceNode()

CQuerySequenceNode::CQuerySequenceNode ( )

References CQueryNode::m_bAtomic.

◆ ~CQuerySequenceNode()

CQuerySequenceNode::~CQuerySequenceNode ( )
virtual

References m_Items.

Member Function Documentation

◆ AddDistance()

bool CQuerySequenceNode::AddDistance ( const string &  s,
char  op = '<' 
)

add a distance to m_Distances, return false if the value is too large

Deprecated:

References m_DistanceOps, m_Distances, and MaxDistanceForNear.

Referenced by Create().

Here is the caller graph for this function:

◆ Create() [1/2]

bool CQuerySequenceNode::Create ( const CConcHolder pHolder,
const vector< const CQueryNode *> &  SequenceObj,
const vector< string > &  DistanceStrings 
)

create the node during yacc parsing

Deprecated:
in favor of second form Create(const CConcHolder* pHolder, const vector<const CQueryTokenNode*>& Items, const vector<BYTE>& Distances);

References AddDistance(), m_Items, and CQueryNode::SetHolder().

Referenced by CQSeq::Compile().

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

◆ Create() [2/2]

bool CQuerySequenceNode::Create ( const CConcHolder pHolder,
const vector< CQueryTokenNode *> &  Items,
const vector< BYTE > &  Distances,
const vector< BYTE > &  DistanceOps 
)

moo: create the node after initial parsing (compile-time)

References m_DistanceOps, m_Distances, m_Items, and CQueryNode::SetHolder().

Here is the call graph for this function:

◆ EvaluateWithoutHits()

void CQuerySequenceNode::EvaluateWithoutHits ( )
virtual

initial-stage query evaluation EvaluateWithoutHits is the first stage of the evaluation of one query. The main task it to build CQueryNode::m_Occurrences, which is written by chunks, sorted by the first item of a chunk.

Reimplemented from CQueryNode.

References CQueryNode::AddOccurrences(), CQueryNode::ClearAndReserveOccurrences(), GetOccurrencesSize, CQueryNode::IsUniversalWildcard(), CQueryNode::m_ChunkLengths, m_DistanceOps, m_Distances, m_Items, CQueryNode::m_Occurrences, and MaxDistanceForNear.

Referenced by Evaluate().

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

◆ Evaluate()

void CQuerySequenceNode::Evaluate ( bool  bSeparateHits = false)
virtual

evaluate query node with respect to m_pHolder , populating m_Hits[] attributes m_BreakNo, m_HighlightOcurrencesEnd . If bSeparateHits is false (default), hits in m_Hits[] will by aggregated by m_BreakNo (i.e. at most one instance of any m_BreakNo value in m_Hits[])

Reimplemented from CQueryNode.

References CQueryNode::ConvertOccurrencesToHitsForPatterns(), and EvaluateWithoutHits().

Here is the call graph for this function:

◆ GetNodeFrequencyByNodeIndex()

size_t CQuerySequenceNode::GetNodeFrequencyByNodeIndex ( size_t  NodeIndex) const
virtual

get occurrence count by query-node index; used by rank-sort operator. default implementation in CQueryNode just chokes.

Reimplemented from CQueryNode.

References m_Items.

Member Data Documentation

◆ m_DistanceOps

vector<BYTE> CQuerySequenceNode::m_DistanceOps

◆ m_Distances

vector<BYTE> CQuerySequenceNode::m_Distances

◆ m_Items

vector<CQueryTokenNode*> CQuerySequenceNode::m_Items

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