strus  0.17
documentTermIteratorInterface.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
10 #ifndef _STRUS_DOCUMENT_TERM_OCCURRENCE_ITERATOR_INTERFACE_HPP_INCLUDED
11 #define _STRUS_DOCUMENT_TERM_OCCURRENCE_ITERATOR_INTERFACE_HPP_INCLUDED
12 #include "strus/index.hpp"
13 #include <vector>
14 #include <string>
15 
16 namespace strus
17 {
18 
22 {
23 public:
24  struct Term
25  {
29 
31  Term()
32  :tf(0),firstpos(0),termno(0){}
37  Term( Index tf_, Index firstpos_, Index termno_)
38  :tf(tf_),firstpos(firstpos_),termno(termno_){}
40  Term( const Term& o)
41  :tf(o.tf),firstpos(o.firstpos),termno(o.termno){}
43  void init( Index tf_, Index firstpos_, Index termno_)
44  {tf=tf_; firstpos=firstpos_; termno=termno_;}
45  };
48 
52  virtual Index skipDoc( const Index& docno)=0;
53 
58  virtual bool nextTerm( Term& value)=0;
59 
63  virtual unsigned int termDocumentFrequency( const Index& termno) const=0;
64 
68  virtual std::string termValue( const Index& termno) const=0;
69 };
70 
71 }//namespace
72 #endif
73 
74 
void init(Index tf_, Index firstpos_, Index termno_)
Initialization.
Definition: documentTermIteratorInterface.hpp:43
Index firstpos
first occurrence term position in the document
Definition: documentTermIteratorInterface.hpp:27
int32_t Index
Number type generally used for locally counted indices.
Definition: index.hpp:29
Index tf
term frequency in the document
Definition: documentTermIteratorInterface.hpp:26
Term()
Default contructor.
Definition: documentTermIteratorInterface.hpp:31
Numeric types used for local and global indices.
virtual ~DocumentTermIteratorInterface()
Destructor.
Definition: documentTermIteratorInterface.hpp:47
Term(const Term &o)
Copy contructor.
Definition: documentTermIteratorInterface.hpp:40
virtual bool nextTerm(Term &value)=0
Get the next term.
Term(Index tf_, Index firstpos_, Index termno_)
Contructor.
Definition: documentTermIteratorInterface.hpp:37
virtual unsigned int termDocumentFrequency(const Index &termno) const =0
Get the local document frequency of a term.
Definition: documentTermIteratorInterface.hpp:24
virtual Index skipDoc(const Index &docno)=0
Skip to the next document.
Index termno
internal term number (only valid in local server context, use the method DocumentTermIteratorInterfac...
Definition: documentTermIteratorInterface.hpp:28
Structure that allows to iterate on document term occurrencies.
Definition: documentTermIteratorInterface.hpp:21
virtual std::string termValue(const Index &termno) const =0
Get string representation of a term.