ddc
QueryNode.h
Go to the documentation of this file.
1 //-*- Mode: C++ -*-
2 // DDC originally by Alexey Sokirko
3 // Changes and modifications 2011-2020 by Bryan Jurish
4 //
5 // This file is part of DDC.
6 //
7 // DDC is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // DDC is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Lesser General Public License for more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with DDC. If not, see <http://www.gnu.org/licenses/>.
19 //
20 // QNode.h: interface for the CQNode class.
21 //
23 
24 #ifndef QUERY_NODE_H
25 #define QUERY_NODE_H
26 
27 #include "ConcHolder.h"
28 
29 extern const size_t MaxDistanceForNear;
30 
31 //----------------------------------------------------------------------
42 class CQueryNode
43 {
44 public:
46  bool m_bAtomic;
47 
49  bool m_bNegated;
50 
52  string m_Source;
53 
55  vector<CTokenNo> m_Occurrences;
56 
59 
62 
65 
67  vector<BYTE> m_OccurrenceMatchIds;
68 
70  vector<CHit> m_Hits;
71 
74 
77  vector<DWORD> m_ChunkLengths;
78 
81  vector<DWORD> m_ChunkOffsets;
82 
84  vector<int> m_CacheIds;
85 
86 
88  CQueryNode(bool bUseNodeIndices=false, bool bUseMatchIds=false, const CConcHolder *holder=NULL)
89  : m_bAtomic(false),
90  m_bNegated(false),
91  m_bUseNodeIndices(bUseNodeIndices),
92  m_bUseMatchIds(bUseMatchIds),
93  m_pHolder(holder)
94  {};
95 
97  virtual ~CQueryNode();
98 
101  virtual void Evaluate(bool bSeparateHits=false);
102 
108  virtual void EvaluateWithoutHits();
109 
111  void SetNegation(bool Value);
112 
114  bool GetNegation() const;
115 
117  inline void AddOccurrence(const CQueryNode& FromNode, int FromOcc)
118  {
119  m_Occurrences.push_back(FromNode.m_Occurrences[FromOcc]);
120  if (m_bUseNodeIndices)
121  m_OccurrenceNodeIndices.push_back(FromNode.m_OccurrenceNodeIndices[FromOcc]);
122  if (m_bUseMatchIds)
123  m_OccurrenceMatchIds.push_back(FromNode.m_OccurrenceMatchIds[FromOcc]);
124  };
125 
127  void AddOccurrences(const CQueryNode& FromNode, int start, int end);
128 
130  void AddOccurrences2(const CQueryNode& FromNode1, int start1, int end1,
131  const CQueryNode& FromNode2, int start2, int end2);
132 
134  void AddOccurrences3(const CQueryNode& FromNode1, int start1, int end1,
135  const CQueryNode& FromNode2, int start2, int end2,
136  const CQueryNode& FromNode3, int start3, int end3);
137 
140  void ClearAndReserveOccurrences(int size);
141 
143  void SwapOccurrences(CQueryNode& Node, bool swapChunkLengths=false);
144 
146  void ConvertOccurrencesToHits (bool bSeparateHits);
147 
149  void ConvertOccurrencesToHitsForPatterns (bool bSeparateHits);
150 
152  void EnsureChunkOffsets();
153 
155  void SetHolder(const CConcHolder* pHolder);
156 
158  virtual bool IsUniversalWildcard() const;
159 
161  virtual size_t GetNodeFrequencyByNodeIndex(size_t NodeIndex) const;
162 
164  inline DWORD HitOccurrencesBegin(DWORD HitNo) const
165  { return (HitNo == 0) ? 0 : m_Hits[HitNo-1].m_HighlightOccurrenceEnd; };
166 
168  inline DWORD HitOccurrencesEnd(DWORD HitNo) const
169  { return m_Hits[HitNo].m_HighlightOccurrenceEnd >= m_Occurrences.size() ? m_Occurrences.size() : m_Hits[HitNo].m_HighlightOccurrenceEnd; };
170 
173  DWORD GetFirstOccurrenceInHit(DWORD HitNo, BYTE MatchId) const;
174 
177  DWORD GetLastOccurrenceInHit(DWORD HitNo, BYTE MatchId) const;
178 
181  DWORD GetMiddleOccurrenceInHit(DWORD HitNo, BYTE MatchId) const;
182 
184  inline DWORD BreakStride() const
185  { return m_Hits.empty() ? 1 : max((size_t)1, (m_Hits.back().m_BreakNo-m_Hits.front().m_BreakNo)/m_Hits.size()); };
186 };
187 
188 //----------------------------------------------------------------------
195 {
197  void hits_add(const CQueryNode& NodeFrom, vector<CHit>::const_iterator First);
198 
199 public:
202 
205 
206 public:
207  CQueryBinaryOperationNode() : m_pChild1(NULL), m_pChild2(NULL)
208  {};
209 
211  : CQueryNode(false), m_pChild1(dtr1), m_pChild2(dtr2)
212  {};
213 
214  void Create(const CConcHolder* pHolder, CQueryNode* child1, CQueryNode* child2, string Operation);
215 
216  virtual ~CQueryBinaryOperationNode();
217 
221  inline void pushHit(DWORD BreakNo)
222  {
223  CHit H(BreakNo);
225  m_Hits.push_back(H);
226  };
227 
230  void hits_and_positions_assign(const CQueryNode &NodeFrom);
231 
233  void hits_and_positions_swap(CQueryNode &NodeFrom);
234 
237  void hits_and_positions_union(bool bSeparateHits=false);
238 
241  void hits_and_positions_intersection(bool bSeparateHits=false);
242 
245  void hits_and_positions_difference(bool bSeparateHits=false);
246 
248  size_t GetNodeFrequencyByNodeIndex(size_t NodeIndex) const;
249 };
250 
251 //----------------------------------------------------------------------
254 {
255 public:
257  virtual ~CQueryAndOperation() {};
258  void Evaluate(bool bSeparateHits=false);
259 };
260 
261 //----------------------------------------------------------------------
264 {
265 public:
267  virtual ~CQueryOrOperation() {};
268  void Evaluate(bool bSeparateHits=false);
269 };
270 
271 //----------------------------------------------------------------------
274 {
275 public:
277  vector<DWORD> m_IndexItems;
278 
280  string m_IndexName;
281 
283  bool m_bChunk;
284 
286  bool m_bAnchor;
287 
289  bool m_bAny;
290 
293 
294 public:
297 
300 
301  CQueryTokenNode(int NodeIndex, BYTE MatchId=0);
302  virtual ~CQueryTokenNode();
303 
305  void SetMatchId(BYTE MatchId);
306 
308  virtual bool IsUniversalWildcard() const;
309 
311  CStringIndexSet* GetIndex(const CConcHolder* pHolder, const string &IndexName);
312 
314  void MakeUnique(void);
315 
317  bool CreateStringPattern(const CConcHolder* pHolder, const string& IndexName, const string& Value);
318 
320  bool CreateRegexPattern(const CConcHolder* pHolder, const string& IndexName, const string& Regex, bool negated=false);
321 
323  bool CreateSetPattern(const CConcHolder* pHolder, const string& IndexName, const set<string>& Values);
324 
326  bool CreatePrefixSetPattern(const CConcHolder* pHolder, const string& IndexName, const set<string>& Prefixes);
327 
329  bool CreatePrefixPattern(const CConcHolder* pHolder, const string& IndexName, const string& Prefix);
330 
332  bool CreateSuffixSetPattern(const CConcHolder* pHolder, const string& IndexName, const set<string>& Suffixes);
333 
335  bool CreateSuffixPattern(const CConcHolder* pHolder, const string& IndexName, const string& Suffix);
336 
338  bool CreateInfixSetPattern(const CConcHolder* pHolder, const string& IndexName, const set<string>& Infixes);
339 
341  bool CreateInfixPattern(const CConcHolder* pHolder, const string& IndexName, const string& Infix);
342 
344  bool CreateUniversalPattern(const CConcHolder *pHolder, const string& SourceStr="*");
345 
347  bool CreateNullPattern(const CConcHolder *pHolder, const string& IndexName="Token");
348 
350  bool CreateLemmaPattern(const CConcHolder* pHolder, const string& Value);
351 
353  bool CreateThesPattern(const CConcHolder* pHolder, const string& IndexName, const string& src);
354 
356  bool CreateMorphAnnotationPattern(const CConcHolder* pHolder, const string& IndexName, const vector<string> &Items);
357 
359  bool CreateFileList(const CConcHolder* pHolder, const string &IndexName, const string& FileName);
360 
362  bool CreateChunkPattern(const CConcHolder* pHolder, const string& IndexName, const string& ChunkTypeStr);
363 
365  bool CreateAnchorPattern(const CConcHolder *pHolder, const string& BreakName, int anchor);
366 
368  bool BuildRegExp(string RegExpStr, vector<DWORD>& IndexItems, bool negated=false);
369 
370  void EvaluateWithoutHits();
371  void Evaluate(bool bSeparateHits=false);
372  size_t GetNodeFrequencyByNodeIndex(size_t NodeIndex) const;
373 
374 };
375 
376 
377 //----------------------------------------------------------------------
384 {
385 public:
386  vector<BYTE> m_DistanceOps;
387  vector<BYTE> m_Distances;
388  vector<CQueryTokenNode*> m_Items;
389 
392  bool AddDistance(const string& s, char op='<');
393 
394 public:
395 
397  virtual ~CQuerySequenceNode();
398 
401  bool Create(const CConcHolder* pHolder, const vector<const CQueryNode*>& SequenceObj, const vector<string>& DistanceStrings);
402 
404  bool Create(const CConcHolder* pHolder, const vector<CQueryTokenNode*>& Items, const vector<BYTE>& Distances, const vector<BYTE>& DistanceOps);
405 
406  void EvaluateWithoutHits();
407  void Evaluate(bool bSeparateHits=false);
408  size_t GetNodeFrequencyByNodeIndex(size_t NodeIndex) const;
409 };
410 
411 //----------------------------------------------------------------------
419 class CQueryNearNode : public CQueryNode
420 {
421 public:
424 
427 
430 
433 
434 public:
435  CQueryNearNode();
436  virtual ~CQueryNearNode();
437 
439  bool Create(const CConcHolder* pHolder, BYTE distance, CQueryNode* child1, CQueryNode* child2, CQueryNode* child3 = NULL);
440 
441  void FindOccurrences2();
442  void FindOccurrences3();
443  void Evaluate(bool bSeparateHits=false);
444  size_t GetNodeFrequencyByNodeIndex(size_t NodeIndex) const;
445 };
446 
447 //----------------------------------------------------------------------
453 {
454 public:
456 
457 public:
458  CQueryWithNode();
459  virtual ~CQueryWithNode() {};
460 
462  bool Create(const CConcHolder* pHolder, CQueryNode* child1, CQueryNode* child2, BYTE matchId=0);
463 
464  void EvaluateWithoutHits();
465  void Evaluate(bool bSeparateHits=false);
466 };
467 
468 //----------------------------------------------------------------------
473 {
474 public:
476  {};
477  virtual ~CQueryWithoutNode() {};
478 
480  bool Create(const CConcHolder* pHolder, CQueryNode* child1, CQueryNode* child2, BYTE matchId=0);
481 
482  void EvaluateWithoutHits();
483 };
484 
485 //----------------------------------------------------------------------
490 {
491 public:
493  {};
494  virtual ~CQueryWithorNode() {};
495 
497  bool Create(const CConcHolder* pHolder, CQueryNode* child1, CQueryNode* child2, BYTE matchId=0);
498 
499  void EvaluateWithoutHits();
500 };
501 
502 //----------------------------------------------------------------------
503 
504 
512  int cnt;
513  int cur;
515 
518  { assign(node_); };
519 
522  { operator=(b); };
523 
524  virtual ~CQOccurrenceIterator() {};
525 
536  void bind(CQueryTokenNode *node_, const CQOccurrenceIterator &src, int minOffset, int maxOffset);
537 
540  {
541  node = b.node;
542  cnt = b.cnt;
543  cur = b.cur;
544  chpos = b.chpos;
545  return *this;
546  };
547 
549  inline void assign(CQueryNode *node_)
550  {
551  node = node_;
552  cnt = 0;
553  cur = 0;
554  chpos = 0;
555  if (node) cnt = node->m_Occurrences.size();
556  };
557 
558  /* node-assignment operator; wraps assign() */
560  {
561  assign(node_);
562  return *this;
563  };
564 
566  inline bool valid() const
567  { return cur < cnt; };
568 
570  inline void invalidate()
571  { cur = cnt; };
572 
574  inline operator bool() const
575  { return valid(); };
576 
578  inline size_t chunksize() const
579  { return node->m_ChunkLengths[chpos]; };
580 
581  /* get token-id for occurrence-id \a occ */
582  inline CTokenNo tocc(DWORD occ) const
583  { return node->m_Occurrences[occ]; };
584 
585  /* get first token-id of current occurrence; assumes iterator is valid */
586  inline CTokenNo tmin() const
587  { return node->m_Occurrences[cur]; };
588 
589  /* get last token-id of current occurrence (inclusive); assumes iterator is valid */
590  inline CTokenNo tmax() const
591  { return node->m_Occurrences[cur + node->m_ChunkLengths[chpos] - 1]; };
592 
593  /* get last token-id of previous occurrence; assumes iterator is valid and cur>0 */
594  inline CTokenNo tmax_prev() const
595  { return node->m_Occurrences[cur-1]; };
596 
597  /* increment operator updates the iterator to point to the next available occurrence, or to an invalid state if no such occurrence exists */
598  inline void operator++()
599  {
600  if (!valid()) return;
601  cur += node->m_ChunkLengths[chpos];
602  chpos++;
603  };
604 
605  /* seek iterator to the first occurrence greater-than-or-equal-to Tok */
606  inline void seek(const CTokenNo Tok)
607  {
608  while (valid() && tmin() < Tok) operator++();
609  };
610 
611  /* equality operator tests whether calling object and argument \a b point to exactly the same tokens */
612  bool operator==(const CQOccurrenceIterator &b) const;
613 };
614 
623 #define DDC_OCCITER_LB_COEF 4
624 
632 {
634 
637  { assign(node_); };
638 
641  { operator=(b); };
642 
644 
655  void bind(CQueryTokenNode *node_, const CQTokenOccurrenceIterator &src, int minOffset, int maxOffset);
656 
659  {
661  stride = b.stride;
662  return *this;
663  };
664 
665 
667  inline void assign(CQueryNode *node_)
668  {
670  stride = node && cnt ? max((CTokenNo)1, (node->m_Occurrences.back()-node->m_Occurrences.front())/cnt) : 1;
671  };
672 
673  /* node-assignment operator; wraps assign() */
675  {
676  assign((CQueryNode*)node_);
677  return *this;
678  };
679 
680  //-- inherited
681  //inline bool valid() const
682  //inline operator bool() const
683 
685  inline size_t chunksize() const
686  { return 1; };
687 
688  //-- inherited
689  //inline CTokenNo tocc(DWORD occ) const
690 
691  //-- inherited
692  inline CTokenNo tmin() const
693  { return node->m_Occurrences[cur]; };
694 
695  /* get last token-id of current occurrence (inclusive); assumes iterator is valid: override just returns tmin() */
696  inline CTokenNo tmax() const
697  { return tmin(); };
698 
699  //-- inherited
700  //inline CTokenNo tmax_prev() const
701 
702  /* increment operator updates the iterator to point to the next available occurrence, or to an invalid state if no such occurrence exists */
703  inline void operator++()
704  {
705  if (!valid()) return;
706  ++cur;
707  };
708 
709  /* seek iterator to the first occurrence greater-than-or-equal-to Tok */
710  inline void seek(const CTokenNo Tok)
711  {
712  if (valid() && tmin() < Tok) {
713  if ((Tok-tmin())/stride > DDC_OCCITER_LB_COEF*log2u32(cnt-cur)) {
714  cur = lower_bound(node->m_Occurrences.begin()+cur, node->m_Occurrences.end(), Tok) - node->m_Occurrences.begin();
715  } else {
716  do { ++cur; } while (valid() && tmin() < Tok);
717  }
718  }
719  };
720 
721  /* equality operator tests whether calling object and argument \a b point to exactly the same tokens : override */
722  inline bool operator==(const CQTokenOccurrenceIterator &b) const
723  {
724  return node->m_Occurrences[cur] == b.node->m_Occurrences[b.cur];
725  };
726 };
727 
728 //----------------------------------------------------------------------
738 extern void GetWordForms (const MorphLanguageEnum Langua, const string& src, set<string>& WordForms);
739 
740 #endif /* QUERY_NODE_H */
741 
742 /*--- emacs style variables ---
743  * Local Variables:
744  * mode: C++
745  * c-file-style: "ellemtel"
746  * c-basic-offset: 4
747  * tab-width: 8
748  * indent-tabs-mode: nil
749  * End:
750  */
CQOccurrenceIterator(CQueryNode *node_=NULL)
Definition: QueryNode.h:517
CQOccurrenceIterator (formerly CQNearEvalItem) is used to iterate over query occurrences; used by nea...
Definition: QueryNode.h:510
bool m_bUseNodeIndices
should DDC uses m_OccurrenceNodeIndices (m_OccurrenceNodeIndices is necessary only for #less_by_rank)...
Definition: QueryNode.h:58
bool m_bChunk
true, if it is a chunk (NP, VP and so on)
Definition: QueryNode.h:283
vector< DWORD > m_ChunkOffsets
Definition: QueryNode.h:81
bool m_bUseMatchIds
should DDC use m_OccurrenceMatchIds to track match-ids?
Definition: QueryNode.h:64
void assign(CQueryNode *node_)
Definition: QueryNode.h:549
virtual ~CQueryNode()
Destructor.
Definition: QueryNode.cpp:41
DWORD m_HighlightOccurrenceEnd
the end offset of token occurrences to be highlighted in CQueryNode::m_Occurrences and later in CConc...
Definition: ConcCommon.h:443
CQuerySequenceNode is an implementation of sequence operator, for example, "Mother and father"...
Definition: QueryNode.h:383
CQueryOrOperation implements the hit union or "or" operator: for example, "Mother||father".
Definition: QueryNode.h:263
vector< BYTE > m_DistanceOps
Definition: QueryNode.h:386
uint32_t log2u32(uint32_t v)
Definition: utilit.h:438
CQOccurrenceIterator & operator=(CQueryNode *node_)
Definition: QueryNode.h:559
BYTE m_Distance
the distance between the first child and the second child
Definition: QueryNode.h:432
CTokenNo tmax() const
Definition: QueryNode.h:590
CTokenNo tmin() const
Definition: QueryNode.h:692
vector< CHit > m_Hits
all hits of this node in the current subcorpora
Definition: QueryNode.h:70
CQueryNode * m_pChild1
the first child
Definition: QueryNode.h:423
CTokenNo tmax_prev() const
Definition: QueryNode.h:594
#define DDC_OCCITER_LB_COEF
Definition: QueryNode.h:623
CQOccurrenceIterator(const CQOccurrenceIterator &b)
Definition: QueryNode.h:521
CQueryNode(bool bUseNodeIndices=false, bool bUseMatchIds=false, const CConcHolder *holder=NULL)
Constructor.
Definition: QueryNode.h:88
virtual void Evaluate(bool bSeparateHits=false)
Definition: QueryNode.cpp:70
DWORD GetFirstOccurrenceInHit(DWORD HitNo, BYTE MatchId) const
Definition: QueryNode.cpp:368
CQueryWithoutNode: (EXPR1 without EXPR2) behaves like (EXPR1 WITH !EXPR2)
Definition: QueryNode.h:472
CQTokenOccurrenceIterator(CQueryNode *node_=NULL)
Definition: QueryNode.h:636
virtual ~CQOccurrenceIterator()
Definition: QueryNode.h:524
void invalidate()
Definition: QueryNode.h:570
DWORD GetLastOccurrenceInHit(DWORD HitNo, BYTE MatchId) const
Definition: QueryNode.cpp:378
CQueryBinaryOperationNode(CQueryNode *dtr1, CQueryNode *dtr2)
Definition: QueryNode.h:210
DWORD chpos
index into node->m_ChunkLengths[] (match occurrence)
Definition: QueryNode.h:514
CQueryNode * m_pChild2
the second child
Definition: QueryNode.h:426
CQueryNearNode is a class which is used to search two or three child nodes, which are inside some tex...
Definition: QueryNode.h:419
vector< CQueryTokenNode * > m_Items
Definition: QueryNode.h:388
DWORD stride
average number of tokens between occurrences in node
Definition: QueryNode.h:633
void AddOccurrence(const CQueryNode &FromNode, int FromOcc)
insers a single occurrence FromNode.m_Occurrences[occ]
Definition: QueryNode.h:117
CQTokenOccurrenceIterator & operator=(CQueryTokenNode *node_)
Definition: QueryNode.h:674
CQueryNode is an abstract class for any node in a query parse tree. A parse tree is built by YACC dur...
Definition: QueryNode.h:42
CQOccurrenceIterator & operator=(const CQOccurrenceIterator &b)
Definition: QueryNode.h:539
int m_AnchorOffset
integer offset for break-anchor ($.) queries
Definition: QueryNode.h:292
const size_t MaxDistanceForNear
Definition: QueryNode.cpp:36
Definition: QueryNode.h:194
CQueryNode * m_pChild2
the second operation member
Definition: QueryNode.h:204
vector< BYTE > m_OccurrenceMatchIds
match-ids for each occurrence in m_Occurrences (only if m_bUseMatchIds is true)
Definition: QueryNode.h:67
CQueryTokenNode is a class which corresponds to one token or it&#39;s singular property (for example lemm...
Definition: QueryNode.h:273
void operator++()
Definition: QueryNode.h:703
vector< DWORD > m_IndexItems
find index items in the index which is called m_IndexName
Definition: QueryNode.h:277
class for a single (thread-local) DDC query session; formerly CConcHolder An instance of CConcSessio...
Definition: ConcSession.h:54
void operator++()
Definition: QueryNode.h:598
CQTokenOccurrenceIterator & operator=(const CQTokenOccurrenceIterator &b)
Definition: QueryNode.h:658
string m_IndexName
the name of index or break collection on which this node is built (see CQueryChunkNode and CQueryToke...
Definition: QueryNode.h:280
vector< BYTE > m_OccurrenceNodeIndices
query node indices for each occurrence (the origin for each occurrence)
Definition: QueryNode.h:61
CTokenNo tmin() const
Definition: QueryNode.h:586
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_b...
Definition: QueryNode.cpp:108
bool valid() const
Definition: QueryNode.h:566
virtual void EvaluateWithoutHits()
initial-stage query evaluation EvaluateWithoutHits is the first stage of the evaluation of one query...
Definition: QueryNode.cpp:66
CQueryWithorNode()
Definition: QueryNode.h:492
virtual ~CQueryWithNode()
Definition: QueryNode.h:459
virtual size_t GetNodeFrequencyByNodeIndex(size_t NodeIndex) const
get occurrence count by query-node index; used by rank-sort operator. default implementation in CQuer...
Definition: QueryNode.cpp:54
CQueryWithNode is a class which is used to search a node which simultaneously has two properties...
Definition: QueryNode.h:452
bool GetNegation() const
get m_bNegated
Definition: QueryNode.cpp:91
CQueryWithorNode: (EXPR1 withor EXPR2) behaves like (EXPR1 || EXPR2) under token-identity.
Definition: QueryNode.h:489
CQueryAndOperation implements the hit intersection or "and" operator: for example, "Mother&&father".
Definition: QueryNode.h:253
DWORD HitOccurrencesBegin(DWORD HitNo) const
get the index of the first occurrence in m_Occurrences[] for hit number HitNo
Definition: QueryNode.h:164
CQTokenOccurrenceIterator(const CQTokenOccurrenceIterator &b)
Definition: QueryNode.h:640
vector< CTokenNo > m_Occurrences
all occurrences of this node in the current subcorpus, which should be highlighted ...
Definition: QueryNode.h:55
BYTE m_MatchId
Definition: QueryNode.h:455
size_t chunksize() const
Definition: QueryNode.h:685
bool m_bAnchor
true iff this is an anchor query
Definition: QueryNode.h:286
virtual ~CQueryAndOperation()
Definition: QueryNode.h:257
const CConcHolder * m_pHolder
a reference to the parent holder (moo: should be unused until evaluation time, but isn&#39;t!) ...
Definition: QueryNode.h:73
DWORD GetMiddleOccurrenceInHit(DWORD HitNo, BYTE MatchId) const
Definition: QueryNode.cpp:388
void seek(const CTokenNo Tok)
Definition: QueryNode.h:710
vector< DWORD > m_ChunkLengths
Definition: QueryNode.h:77
BYTE m_NodeIndex
a unique index of the node in query tree (used by rank-sort operator)
Definition: QueryNode.h:296
virtual bool IsUniversalWildcard() const
return true iff this is a universal wildcard query (*); default returns false
Definition: QueryNode.cpp:208
CQTokenOccurrenceIterator (formerly CQNearEvalItem) is used to iterate over query occurrences;...
Definition: QueryNode.h:631
CQueryWithoutNode()
Definition: QueryNode.h:475
CTokenNo tocc(DWORD occ) const
Definition: QueryNode.h:582
CQueryBinaryOperationNode()
Definition: QueryNode.h:207
unsigned char BYTE
Definition: utilit.h:94
int cur
index into node->m_Occurrences[]
Definition: QueryNode.h:513
DWORD HitOccurrencesEnd(DWORD HitNo) const
get the index of the first occurrence in m_Occurrences[] after hit number HitNo
Definition: QueryNode.h:168
void ConvertOccurrencesToHitsForPatterns(bool bSeparateHits)
convert occurrences to hits for pattern query construction (like "mother likes father") ...
Definition: QueryNode.cpp:291
virtual ~CQueryOrOperation()
Definition: QueryNode.h:267
Definition: ConcCommon.h:438
bool operator==(const CQTokenOccurrenceIterator &b) const
Definition: QueryNode.h:722
int cnt
limit for node->m_Occurrences[]
Definition: QueryNode.h:512
void SetHolder(const CConcHolder *pHolder)
set m_pHolder dependent properties m_bUseNodeIndices, m_bUseMatchIds
Definition: QueryNode.cpp:213
virtual ~CQueryWithorNode()
Definition: QueryNode.h:494
DWORD BreakStride() const
get average size of gap between breaks in m_Hits[]; returned value is always >= 1 ...
Definition: QueryNode.h:184
BYTE m_MatchId
user-specified match-id (0 specifies default behavior, which is to use highlight-id=255) ...
Definition: QueryNode.h:299
void ConvertOccurrencesToHits(bool bSeparateHits)
convert occurrences to hits using m_pHolder->GetBreaks()
Definition: QueryNode.cpp:227
bool m_bAtomic
true if this node is a description of one token or a sequence of adjacent tokens
Definition: QueryNode.h:46
CQueryNode * node
(sub)query node
Definition: QueryNode.h:511
virtual ~CQTokenOccurrenceIterator()
Definition: QueryNode.h:643
void ClearAndReserveOccurrences(int size)
Definition: QueryNode.cpp:187
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)
Definition: QueryNode.cpp:97
CQueryNode * m_pChild3
the third child (may be NULL)
Definition: QueryNode.h:429
void pushHit(DWORD BreakNo)
Definition: QueryNode.h:221
DWORD CTokenNo
integer type CTokenNo is used to refer an index of a token in the corpus
Definition: ConcCommon.h:63
MorphLanguageEnum
Definition: utilit.h:162
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 bo...
Definition: QueryNode.cpp:142
CQueryNode * m_pChild1
the first operation member
Definition: QueryNode.h:201
uint32_t DWORD
Definition: utilit.h:105
void assign(CQueryNode *node_)
Definition: QueryNode.h:667
bool m_bAny
true iff this is a "universal wildcard" query
Definition: QueryNode.h:289
void EnsureChunkOffsets()
ensure m_ChunkOffsets[] is populated
Definition: QueryNode.cpp:75
Definition: IndexSet.h:57
vector< BYTE > m_Distances
Definition: QueryNode.h:387
bool m_bNegated
is the node negated?
Definition: QueryNode.h:49
vector< int > m_CacheIds
???
Definition: QueryNode.h:84
void GetWordForms(const MorphLanguageEnum Langua, const string &src, set< string > &WordForms)
Definition: graveyard.cc:110
void seek(const CTokenNo Tok)
Definition: QueryNode.h:606
void SetNegation(bool Value)
set m_bNegated
Definition: QueryNode.cpp:87
size_t chunksize() const
Definition: QueryNode.h:578
void SwapOccurrences(CQueryNode &Node, bool swapChunkLengths=false)
swaps m_Occurrences[], m_OccurrenceNodeIndices[], and m_OccurrenceMatchIds[] between caller object an...
Definition: QueryNode.cpp:200
virtual ~CQueryWithoutNode()
Definition: QueryNode.h:477
string m_Source
the string from which this node was created
Definition: QueryNode.h:52
CTokenNo tmax() const
Definition: QueryNode.h:696