strusJava  0.14
bindingObjects.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  */
8 #ifndef _STRUS_BINDING_OBJECTS_HPP_INCLUDED
9 #define _STRUS_BINDING_OBJECTS_HPP_INCLUDED
10 #include <limits>
11 #include <string>
12 #include <vector>
13 #include <map>
14 #include <cstring>
15 #include <stdexcept>
16 #include <boost/shared_ptr.hpp>
17 
18 #ifdef DOXYGEN_LANG
19 #include "swig.hpp"
20 // ... doxygen needs this for creating alternative interface descriptions for different languages
21 #if defined DOXYGEN_JAVA
22 namespace net {
23 namespace strus {
24 namespace api {
25 #elif defined DOXYGEN_PYTHON
26 namespace strus {
27 #endif
28 #elif (defined STRUS_BOOST_PYTHON)
29 typedef boost::python::api::object FunctionObject;
30 typedef boost::python::api::object DataBlob;
31 typedef boost::python::api::object StringObject;
32 typedef std::string String;
33 typedef std::wstring WString;
34 typedef std::vector<int> IndexVector;
35 typedef std::vector<double> FloatVector;
36 typedef std::vector<std::string> StringVector;
37 #else
38 #define String std::string
39 #define WString std::wstring
40 #define IndexVector std::vector<int>
41 #define StringVector std::vector<std::string>
42 #define FloatVector std::vector<double>
43 #if !defined DOXYGEN_PHP && !defined DOXYGEN_PYTHON
44 #define NormalizerVector std::vector<Normalizer>
45 #endif
46 #define TermVector std::vector<Term>
47 #define QueryTermVector std::vector<QueryTerm>
48 #define RankVector std::vector<Rank>
49 #define VecRankVector std::vector<VecRank>
50 #define SummaryElementVector std::vector<SummaryElement>
51 #define AttributeVector std::vector<Attribute>
52 #define MetaDataVector std::vector<MetaData>
53 #define DocumentFrequencyChangeVector std::vector<DocumentFrequencyChange>
54 #endif
55 typedef int Index;
56 typedef long GlobalCounter;
57 
58 #ifndef DOXYGEN_LANG
59 class Reference
61 {
62 public:
63 #ifdef STRUS_BOOST_PYTHON
64  Reference()
66  :m_deleter(0){}
67 #endif
68  typedef void (*Deleter)( void* obj);
69 
71  explicit Reference( Deleter deleter_)
72  :m_ptr(),m_deleter(deleter_){}
73 
75  Reference( const Reference& o)
76  :m_ptr(o.m_ptr),m_deleter(o.m_deleter){}
77 
79  ~Reference(){}
80 
81  void reset( void* obj_=0)
82  {
83  m_ptr.reset( obj_, m_deleter);
84  }
85 
87  Reference& operator = (const Reference& o)
88  {
89  m_ptr = o.m_ptr;
90  m_deleter = o.m_deleter;
91  return *this;
92  }
93 
95  const void* get() const {return m_ptr.get();}
97  void* get() {return m_ptr.get();}
98 
99 private:
100  boost::shared_ptr<void> m_ptr;
101  void (*m_deleter)( void* obj);
102 };
103 #endif
104 
105 
106 #if defined DOXYGEN_PHP || defined DOXYGEN_PYTHON
107 #error DOXYGEN_PYTHON
109 class Tokenizer
110 {
111 };
112 #else
113 class Tokenizer
115 {
116 public:
118  Tokenizer( const Tokenizer& o)
119  :m_name(o.m_name),m_arguments(o.m_arguments){}
120  Tokenizer( const String& name_, const StringVector& arg_)
121  :m_name(name_),m_arguments(arg_){}
122  Tokenizer( const String& name_, const String& arg_)
123  :m_name(name_)
124  {
125  m_arguments.push_back( arg_);
126  }
127  Tokenizer( const String& name_, const String& arg1_, const String& arg2_)
128  :m_name(name_),m_arguments()
129  {
130  m_arguments.push_back( arg1_);
131  m_arguments.push_back( arg2_);
132  }
133  Tokenizer( const String& name_)
134  :m_name(name_),m_arguments(){}
135 
136  const String& name() const {return m_name;}
137  const StringVector& arguments() const {return m_arguments;}
138 
139  void setName( const String& name_) {m_name = name_;}
140  void addArgument( const String& arg_) {m_arguments.push_back( arg_);}
141  void addArgumentInt( long arg_);
142  void addArgumentFloat( double arg_);
143 
144 private:
145  std::string m_name;
146  std::vector<std::string> m_arguments;
147 };
148 #endif
149 
150 
151 #if defined DOXYGEN_PHP || defined DOXYGEN_PYTHON
152 class Normalizer
154 {
155 };
156 #else
157 class Normalizer
159 {
160 public:
163  :m_name(o.m_name),m_arguments(o.m_arguments){}
164  Normalizer( const String& name_, const StringVector& arg_)
165  :m_name(name_),m_arguments(arg_){}
166  Normalizer( const String& name_, const String& arg_)
167  :m_name(name_)
168  {
169  m_arguments.push_back( arg_);
170  }
171  Normalizer( const String& name_, const String& arg1_, const String& arg2_)
172  :m_name(name_),m_arguments()
173  {
174  m_arguments.push_back( arg1_);
175  m_arguments.push_back( arg2_);
176  }
177  Normalizer( const String& name_)
178  :m_name(name_),m_arguments(){}
179 
181 
182  const String& name() const {return m_name;}
183  const StringVector& arguments() const {return m_arguments;}
184 
185  void setName( const String& name_) {m_name = name_;}
186  void addArgument( const String& arg_) {m_arguments.push_back( arg_);}
187  void addArgumentInt( long arg_);
188  void addArgumentFloat( double arg_);
189 
190 private:
191  friend class QueryAnalyzer;
192  friend class DocumentAnalyzer;
193 
194  std::string m_name;
195  std::vector<std::string> m_arguments;
196 };
197 #endif
198 
199 #ifdef STRUS_BOOST_PYTHON
200 typedef std::vector<Normalizer> NormalizerVector;
201 #endif
202 #if defined DOXYGEN_PHP || defined DOXYGEN_PYTHON
203 class NormalizerVector
205 {
206 };
207 #endif
208 
209 #if defined DOXYGEN_PHP || defined DOXYGEN_PYTHON
210 class Aggregator
212 {
213 };
214 #else
215 class Aggregator
217 {
218 public:
223  :m_name(o.m_name),m_arguments(o.m_arguments){}
227  Aggregator( const String& name_, const StringVector& arg_)
228  :m_name(name_),m_arguments(arg_){}
232  Aggregator( const String& name_, const String& arg_)
233  :m_name(name_)
234  {
235  m_arguments.push_back( arg_);
236  }
241  Aggregator( const String& name_, const String& arg1_, const String& arg2_)
242  :m_name(name_),m_arguments()
243  {
244  m_arguments.push_back( arg1_);
245  m_arguments.push_back( arg2_);
246  }
249  Aggregator( const String& name_)
250  :m_name(name_),m_arguments(){}
251 
254 
257  const String& name() const {return m_name;}
260  const StringVector& arguments() const {return m_arguments;}
261 
264  void setName( const String& name_) {m_name = name_;}
267  void addArgument( const String& arg_) {m_arguments.push_back( arg_);}
270  void addArgumentInt( long arg_);
273  void addArgumentFloat( double arg_);
274 
275 private:
276  friend class DocumentAnalyzer;
277 
278  std::string m_name;
279  std::vector<std::string> m_arguments;
280 };
281 #endif
282 
283 #if defined DOXYGEN_LANG
284 class Variant
286 {
287 };
288 #else
289 enum VariantType
291 {
292  Variant_UNDEFINED,
293  Variant_UINT,
294  Variant_INT,
295  Variant_FLOAT,
296  Variant_TEXT
297 };
298 
300 union VariantValue
301 {
302  unsigned int UINT;
303  int INT;
304  double FLOAT;
305  const char* TEXT;
306 };
307 
309 class Variant
310 {
311 public:
313  Variant();
315  Variant( const Variant& o);
317  Variant( unsigned int v);
319  Variant( int v);
321  Variant( double v);
323  Variant( const String& v);
325  Variant( const char* v);
326 
329  bool defined() const {return m_type != Variant_UNDEFINED;}
332  VariantType type() const {return m_type;}
335  unsigned long getUInt() const;
338  long getInt() const;
341  double getFloat() const;
344  const char* getText() const;
345 
347  void init();
350  void assign( const Variant& o);
353  void assignUint( unsigned long v);
356  void assignInt( long v);
359  void assignFloat( double v);
362  void assignText( const String& v);
363 
364  Variant& operator=( const Variant& o)
365  {
366  assign( o);
367  return *this;
368  }
369 
370 #ifdef STRUS_BOOST_PYTHON
371  bool operator==( const Variant& o) const
372  {
373  return isEqual( o);
374  }
375  bool operator!=( const Variant& o) const
376  {
377  return !isEqual( o);
378  }
379 #endif
380 private:
381  bool isEqual( const Variant& o) const;
382 
383 private:
384  friend class Storage;
385  friend class Summarizer;
386  friend class WeightingFunction;
387  friend class QueryEval;
388  friend class DocumentAnalyzer;
389  VariantType m_type;
390  VariantValue m_value;
391  std::string m_buf;
392 };
393 #endif
394 
395 
397 class Term
398 {
399 public:
401  Term( const String& type_, const String& value_, const Index& position_, const Index& length_)
402  :m_type(type_),m_value(value_),m_position(position_),m_length(length_){}
404  Term( const Term& o)
405  :m_type(o.m_type),m_value(o.m_value),m_position(o.m_position),m_length(o.m_length){}
408  :m_position(0),m_length(0){}
409 
411  const String& type() const {return m_type;}
413  const String& value() const {return m_value;}
414 #if defined STRUS_BOOST_PYTHON || defined DOXYGEN_PYTHON
415  WString ucvalue() const;
416 #endif
417  Index position() const {return m_position;}
420  Index length() const {return m_length;}
421 
422 #ifdef STRUS_BOOST_PYTHON
423  bool operator==( const Term& o) const
424  {
425  return m_type == o.m_type && m_value == o.m_value && m_position == o.m_position && m_length == o.m_length;
426  }
427  bool operator!=( const Term& o) const
428  {
429  return m_type != o.m_type || m_value != o.m_value || m_position != o.m_position || m_length != o.m_length;
430  }
431 #endif
432 #ifndef SWIG
433  bool operator < (const Term& o) const;
434 #endif
435 private:
436  std::string m_type;
437  std::string m_value;
438  Index m_position;
439  Index m_length;
440 };
441 #ifdef STRUS_BOOST_PYTHON
442 typedef std::vector<Term> TermVector;
443 #endif
444 
445 
448 class MetaData
449 {
450 public:
452  MetaData( const String& name_, const Variant& value_)
453  :m_name(name_),m_value(value_){}
455  MetaData( const MetaData& o)
456  :m_name(o.m_name),m_value(o.m_value){}
459  :m_name(0),m_value(){}
460 
462  const String& name() const {return m_name;}
464  double value() const {return m_value.getFloat();}
465 
466 #ifdef STRUS_BOOST_PYTHON
467  bool operator==( const MetaData& o) const
468  {
469  return (m_name == o.m_name && m_value == o.m_value);
470  }
471  bool operator!=( const MetaData& o) const
472  {
473  return (m_name != o.m_name || m_value != o.m_value);
474  }
475 #endif
476 private:
477  std::string m_name;
478  Variant m_value;
479 };
480 #ifdef STRUS_BOOST_PYTHON
481 typedef std::vector<MetaData> MetaDataVector;
482 #endif
483 
484 
489 {
490 public:
492  Attribute( const String& name_, const String& value_)
493  :m_name(name_),m_value(value_){}
495  Attribute( const Attribute& o)
496  :m_name(o.m_name),m_value(o.m_value){}
499  :m_name(0){}
500 
502  const String& name() const {return m_name;}
504  const String& value() const {return m_value;}
505 
506 #if defined STRUS_BOOST_PYTHON || defined DOXYGEN_PYTHON
507  WString ucvalue() const;
508 #endif
509 
510 #ifdef STRUS_BOOST_PYTHON
511  bool operator==( const Attribute& o) const
512  {
513  return m_name == o.m_name && m_value == o.m_value;
514  }
515  bool operator!=( const Attribute& o) const
516  {
517  return m_name != o.m_name || m_value != o.m_value;
518  }
519 #endif
520 private:
521  std::string m_name;
522  std::string m_value;
523 };
524 #ifdef STRUS_BOOST_PYTHON
525 typedef std::vector<Attribute> AttributeVector;
526 #endif
527 
528 
531 {
532 public:
536  explicit DocumentClass(
537  const String& mimeType_) :m_mimeType(mimeType_){}
540  const String& mimeType_,
541  const String& encoding_) :m_mimeType(mimeType_),m_encoding(encoding_){}
544  const String& mimeType_,
545  const String& encoding_,
546  const String& scheme_) :m_mimeType(mimeType_),m_scheme(scheme_),m_encoding(encoding_){}
548  DocumentClass( const DocumentClass& o) :m_mimeType(o.m_mimeType),m_scheme(o.m_scheme),m_encoding(o.m_encoding){}
549 
552  bool valid() const {return !m_mimeType.empty();}
553 
556  void setMimeType( const String& mimeType_) {m_mimeType = mimeType_;}
559  void setScheme( const String& scheme_) {m_scheme = scheme_;}
562  void setEncoding( const String& encoding_) {m_encoding = encoding_;}
563 
566  const String& mimeType() const {return m_mimeType;}
569  const String& scheme() const {return m_scheme;}
572  const String& encoding() const {return m_encoding;}
573 
574 private:
575  std::string m_mimeType;
576  std::string m_scheme;
577  std::string m_encoding;
578 };
579 
580 
583 class Document
584 {
585 public:
589  Document( const Document& o);
590 
595  void addSearchIndexTerm( const String& type, const String& value, const Index& position);
600  void addForwardIndexTerm( const String& type, const String& value, const Index& position);
601 #ifndef DOXYGEN_JAVA
602  void setMetaData( const String& name, const Variant& value);
606 #endif
607 #ifdef STRUS_BOOST_PYTHON
608  void setMetaData_double( const String& name, double value)
609  {
610  setMetaData( name, value);
611  }
612  void setMetaData_int( const String& name, int value)
613  {
614  setMetaData( name, value);
615  }
616  void setMetaData_uint( const String& name, unsigned int value)
617  {
618  setMetaData( name, value);
619  }
620 #endif
621  void setMetaData( const String& name, double value);
628  void setMetaData( const String& name, int value);
632  void setMetaData( const String& name, unsigned int value);
636  void setAttribute( const String& name, const String& value);
637 #ifdef STRUS_BOOST_PYTHON
638  void setAttribute_obj( const String& name, const StringObject& value);
639 #endif
640  void setUserAccessRight( const String& username);
646  void setDocid( const String& docid_);
647 
650  const TermVector& searchIndexTerms() const {return m_searchIndexTerms;}
653  const TermVector& forwardIndexTerms() const {return m_forwardIndexTerms;}
656  const MetaDataVector& metaData() const {return m_metaData;}
659  const AttributeVector& attributes() const {return m_attributes;}
662  const StringVector& users() const {return m_users;}
665  const String& docid() const {return m_docid;}
666 
667 private:
668  std::vector<Term> m_searchIndexTerms;
669  std::vector<Term> m_forwardIndexTerms;
670  std::vector<MetaData> m_metaData;
671  std::vector<Attribute> m_attributes;
672  std::vector<std::string> m_users;
673  std::string m_docid;
674 };
675 
676 
678 class DocumentAnalyzeQueue;
680 class PatternMatcher;
681 
688 {
689 public:
690 #ifdef STRUS_BOOST_PYTHON
693  :m_textproc(0){}
694 #endif
699 
706 #if defined SWIGPHP
707  // ... SWIG PHP implementation cannot handle signatures with typemaps and default parameters (!)
708  void addSearchIndexFeature(
709  const String& type,
710  const String& selectexpr,
711  const Tokenizer& tokenizer,
712  const NormalizerVector& normalizers,
713  const String& options);
714 #else
715  void addSearchIndexFeature(
716  const String& type,
717  const String& selectexpr,
718  const Tokenizer& tokenizer,
719  const NormalizerVector& normalizers,
720  const String& options=String());
721 #endif
722 #ifdef STRUS_BOOST_PYTHON
723  void addSearchIndexFeature_4(
724  const String& type,
725  const String& selectexpr,
726  const FunctionObject& tokenizer_,
727  const FunctionObject& normalizers_);
728 
729  void addSearchIndexFeature_5(
730  const String& type,
731  const String& selectexpr,
732  const FunctionObject& tokenizer_,
733  const FunctionObject& normalizers_,
734  const String& options);
735 #endif
736 
743 #if defined SWIGPHP
744  // ... SWIG PHP implementation cannot handle signatures with typemaps and default parameters (!)
745  void addForwardIndexFeature(
746  const String& type,
747  const String& selectexpr,
748  const Tokenizer& tokenizer,
749  const NormalizerVector& normalizers,
750  const String& options);
751 #else
752  void addForwardIndexFeature(
753  const String& type,
754  const String& selectexpr,
755  const Tokenizer& tokenizer,
756  const NormalizerVector& normalizers,
757  const String& options=String());
758 #endif
759 #ifdef STRUS_BOOST_PYTHON
760  void addForwardIndexFeature_4(
761  const String& type,
762  const String& selectexpr,
763  const FunctionObject& tokenizer_,
764  const FunctionObject& normalizers_);
765 
766  void addForwardIndexFeature_5(
767  const String& type,
768  const String& selectexpr,
769  const FunctionObject& tokenizer_,
770  const FunctionObject& normalizers_,
771  const String& options);
772 #endif
773 
779  void defineMetaData(
780  const String& fieldname,
781  const String& selectexpr,
782  const Tokenizer& tokenizer,
783  const NormalizerVector& normalizers);
784 
785 #ifdef STRUS_BOOST_PYTHON
786  void defineMetaData_obj(
787  const String& fieldname,
788  const String& selectexpr,
789  const FunctionObject& tokenizer_,
790  const FunctionObject& normalizers_);
791 #endif
792 
796  void defineAggregatedMetaData(
797  const String& fieldname,
798  const Aggregator& function);
799 
800 #ifdef STRUS_BOOST_PYTHON
801  void defineAggregatedMetaData_obj(
802  const String& fieldname,
803  const FunctionObject& function_);
804 #endif
805 
811  void defineAttribute(
812  const String& attribname,
813  const String& selectexpr,
814  const Tokenizer& tokenizer,
815  const NormalizerVector& normalizers);
816 
817 #ifdef STRUS_BOOST_PYTHON
818  void defineAttribute_obj(
819  const String& fieldname,
820  const String& selectexpr,
821  const FunctionObject& tokenizer_,
822  const FunctionObject& normalizers_);
823 #endif
824 #if defined SWIGPHP
825  // ... SWIG PHP implementation cannot handle signatures with typemaps and default parameters (!)
826  void addSearchIndexFeatureFromPatternMatch(
827  const String& type,
828  const String& patternTypeName,
829  const NormalizerVector& normalizers,
830  const String& options);
831 #else
832  void addSearchIndexFeatureFromPatternMatch(
833  const String& type,
834  const String& patternTypeName,
835  const NormalizerVector& normalizers,
836  const String& options=String());
837 #endif
838 #ifdef STRUS_BOOST_PYTHON
839  void addSearchIndexFeatureFromPatternMatch_3(
840  const String& type,
841  const String& patternTypeName,
842  const FunctionObject& normalizers_);
843 
844  void addSearchIndexFeatureFromPatternMatch_4(
845  const String& type,
846  const String& patternTypeName,
847  const FunctionObject& normalizers_,
848  const String& options);
849 #endif
850 #if defined SWIGPHP
851  // ... SWIG PHP implementation cannot handle signatures with typemaps and default parameters (!)
852  void addForwardIndexFeatureFromPatternMatch(
853  const String& type,
854  const String& patternTypeName,
855  const NormalizerVector& normalizers,
856  const String& options);
857 #else
858  void addForwardIndexFeatureFromPatternMatch(
859  const String& type,
860  const String& patternTypeName,
861  const NormalizerVector& normalizers,
862  const String& options=String());
863 #endif
864 #ifdef STRUS_BOOST_PYTHON
865  void addForwardIndexFeatureFromPatternMatch_3(
866  const String& type,
867  const String& patternTypeName,
868  const FunctionObject& normalizers_);
869 
870  void addForwardIndexFeatureFromPatternMatch_4(
871  const String& type,
872  const String& patternTypeName,
873  const FunctionObject& normalizers_,
874  const String& options);
875 #endif
876  void defineMetaDataFromPatternMatch(
877  const String& fieldname,
878  const String& patternTypeName,
879  const NormalizerVector& normalizers);
880 
881 #ifdef STRUS_BOOST_PYTHON
882  void defineMetaDataFromPatternMatch_obj(
883  const String& fieldname,
884  const String& patternTypeName,
885  const FunctionObject& normalizers_);
886 #endif
887  void defineAttributeFromPatternMatch(
888  const String& attribname,
889  const String& patternTypeName,
890  const NormalizerVector& normalizers);
891 
892 #ifdef STRUS_BOOST_PYTHON
893  void defineAttributeFromPatternMatch_obj(
894  const String& fieldname,
895  const String& patternTypeName,
896  const FunctionObject& normalizers_);
897 #endif
898 
903  void definePatternMatcherPostProc(
904  const String& patternTypeName,
905  const String& patternMatcherModule,
906  const PatternMatcher& patterns);
907 
912  void definePatternMatcherPostProcFromFile(
913  const String& patternTypeName,
914  const String& patternMatcherModule,
915  const String& serializedPatternFile);
916 
917 #ifdef STRUS_BOOST_PYTHON
918  void definePatternMatcherPostProc_expr(
919  const String& patternTypeName,
920  const String& patternMatcherModule,
921  const FunctionObject& expr_);
922 
923  void definePatternMatcherPostProcFromFile_obj(
924  const String& patternTypeName,
925  const String& patternMatcherModule,
926  const StringObject& serializedPatternFile);
927 #endif
928 
933  void defineDocument(
934  const String& subDocumentTypeName,
935  const String& selectexpr);
936 
939  Document analyze( const String& content);
940 
944  Document analyze( const String& content, const DocumentClass& dclass);
945 
946 #ifdef STRUS_BOOST_PYTHON
947  Document analyze_obj_1( const StringObject& content);
948  Document analyze_obj_2( const StringObject& content, const DocumentClass& dclass);
949 #endif
950 
953  DocumentAnalyzeQueue createQueue() const;
954 
955 private:
957  friend class Context;
958  DocumentAnalyzer( const Reference& objbuilder, const Reference& trace, const Reference& errorhnd, const String& segmentername, const void* textproc_);
959 
960  Reference m_errorhnd_impl;
961  Reference m_trace_impl;
962  Reference m_objbuilder_impl;
963  Reference m_analyzer_impl;
964  const void* m_textproc;
965 };
966 
967 
972 {
973 public:
974 #ifdef STRUS_BOOST_PYTHON
977  :m_result_queue_idx(0),m_analyzerctx_queue_idx(0),m_textproc(0){}
978 #endif
983 
986  void push( const String& content);
990  void push( const String& content, const DocumentClass& dclass);
991 
992 #ifdef STRUS_BOOST_PYTHON
993  void push_obj_1( const StringObject& content);
994  void push_obj_2( const StringObject& content, const DocumentClass& dclass);
995 #endif
996  bool hasMore() const;
999 
1002  Document fetch();
1003 
1004 private:
1005  void analyzeNext();
1006 
1007 private:
1009  friend class DocumentAnalyzer;
1010  explicit DocumentAnalyzeQueue( const Reference& objbuilder, const Reference& trace, const Reference& errorhnd, const Reference& analyzer, const void* textproc_);
1011 
1012  Reference m_errorhnd_impl;
1013  Reference m_trace_impl;
1014  Reference m_objbuilder_impl;
1015  Reference m_analyzer_impl;
1016  std::vector<Document> m_result_queue;
1017  std::size_t m_result_queue_idx;
1018  std::vector<Reference> m_analyzerctx_queue;
1019  std::size_t m_analyzerctx_queue_idx;
1020  const void* m_textproc;
1021 };
1022 
1023 
1025 class QueryAnalyzeContext;
1026 
1029 {
1030 public:
1032  :m_ops(o.m_ops),m_strings(o.m_strings),m_size(o.m_size){}
1034  :m_size(0){}
1035 
1039  void pushTerm( const String& type_, const String& value_);
1040 
1041 #ifdef STRUS_BOOST_PYTHON
1042  void pushTerm_obj( const String& type_, const StringObject& value_);
1043 #endif
1044 
1047  void pushPattern( const String& name_);
1048 
1049 #ifdef STRUS_BOOST_PYTHON
1050  void pushPattern_obj( const StringObject& name_);
1051 #endif
1052 
1058  void pushExpression( const String& opname_, unsigned int argc_, int range_=0, unsigned int cardinality_=0);
1059 
1060 #ifdef STRUS_BOOST_PYTHON
1061  void pushExpression_2( const String& opname_, unsigned int argc)
1062  {
1063  pushExpression( opname_, argc, 0, 0);
1064  }
1065  void pushExpression_3( const String& opname_, unsigned int argc, int range_)
1066  {
1067  pushExpression( opname_, argc, range_, 0);
1068  }
1069  void pushExpression_4( const String& opname_, unsigned int argc, int range_, unsigned int cardinality_)
1070  {
1071  pushExpression( opname_, argc, range_, cardinality_);
1072  }
1073 #endif
1074  void definePattern( const String& name_, bool visible);
1077 #ifdef STRUS_BOOST_PYTHON
1078  void definePattern_obj( const StringObject& name_, bool visible);
1079 #endif
1080 
1085  void attachVariable( const String& name_);
1086 
1087 #ifdef STRUS_BOOST_PYTHON
1088  void attachVariable_obj( const StringObject& name_);
1089 #endif
1090 
1093  void add( const PatternMatcher& o);
1094 
1097  std::size_t size() const
1098  {
1099  return m_size;
1100  }
1101 
1102 private:
1103  friend class Query;
1104 
1105  struct StackOp
1106  {
1107  enum Type
1108  {
1109  PushTerm,
1110  PushPattern,
1111  PushExpression,
1112  DefinePattern,
1113  AttachVariable
1114  };
1115  enum ArgIndex
1116  {
1117  Term_type=0x0,
1118  Term_value=0x1,
1119  Expression_opname=0x0,
1120  Expression_argc=0x1,
1121  Expression_range=0x2,
1122  Expression_cardinality=0x3,
1123  Variable_name=0x0,
1124  Pattern_name=0x0,
1125  Pattern_visible=0x1
1126  };
1127  Type type;
1128  int arg[4];
1129 
1130  StackOp( Type type_, int arg0_, int arg1_=0, int arg2_=0, int arg3_=0)
1131  :type(type_)
1132  {
1133  arg[0] = arg0_;
1134  arg[1] = arg1_;
1135  arg[2] = arg2_;
1136  arg[3] = arg3_;
1137  }
1138 
1139  StackOp()
1140  :type(PushTerm)
1141  {
1142  std::memset( arg, 0, sizeof(arg));
1143  }
1144  StackOp( const StackOp& o)
1145  {
1146  std::memcpy( this, &o, sizeof(*this));
1147  }
1148  };
1149  const std::vector<StackOp>& ops() const
1150  {
1151  return m_ops;
1152  }
1153  const std::string& strings() const
1154  {
1155  return m_strings;
1156  }
1157 
1158 private:
1159  std::size_t allocid( const String& str);
1160 #ifdef STRUS_BOOST_PYTHON
1161  std::size_t allocid_obj( const StringObject& str);
1162 #endif
1163 
1164 private:
1165  friend class QueryAnalyzer;
1166  friend class DocumentAnalyzer;
1167  friend class PatternMatchLoader;
1168  std::vector<StackOp> m_ops;
1169  std::string m_strings;
1170  std::size_t m_size;
1171 };
1172 
1173 
1180 {
1181 public:
1182 #ifdef STRUS_BOOST_PYTHON
1183  QueryAnalyzer(){}
1185 #endif
1186  QueryAnalyzer( const QueryAnalyzer& o);
1190 
1196  void addSearchIndexElement(
1197  const String& featureType,
1198  const String& fieldType,
1199  const Tokenizer& tokenizer,
1200  const NormalizerVector& normalizers);
1201 #ifdef STRUS_BOOST_PYTHON
1202  void addSearchIndexElement_obj(
1203  const String& featureType,
1204  const String& fieldType,
1205  const FunctionObject& tokenizer_,
1206  const FunctionObject& normalizers_);
1207 #endif
1208  void addSearchIndexElementFromPatternMatch(
1213  const std::string& type,
1214  const std::string& patternTypeName,
1215  const NormalizerVector& normalizers);
1216 
1217 #ifdef STRUS_BOOST_PYTHON
1218  void addSearchIndexElementFromPatternMatch_obj(
1219  const String& type,
1220  const String& patternTypeName,
1221  const FunctionObject& normalizers_);
1222 #endif
1223 
1229  void addPatternLexem(
1230  const std::string& termtype,
1231  const std::string& fieldtype,
1232  const Tokenizer& tokenizer,
1233  const NormalizerVector& normalizers);
1234 #ifdef STRUS_BOOST_PYTHON
1235  void addPatternLexem_obj(
1236  const String& featureType,
1237  const String& fieldType,
1238  const FunctionObject& tokenizer_,
1239  const FunctionObject& normalizers_);
1240 #endif
1241 
1246  void definePatternMatcherPostProc(
1247  const String& patternTypeName,
1248  const String& patternMatcherModule,
1249  const PatternMatcher& patterns);
1250 
1255  void definePatternMatcherPostProcFromFile(
1256  const String& patternTypeName,
1257  const String& patternMatcherModule,
1258  const String& serializedPatternFile);
1259 
1260 #ifdef STRUS_BOOST_PYTHON
1261  void definePatternMatcherPostProc_expr(
1262  const String& patternTypeName,
1263  const String& patternMatcherModule,
1264  const FunctionObject& expr_);
1265 
1266  void definePatternMatcherPostProcFromFile_obj(
1267  const String& patternTypeName,
1268  const String& patternMatcherModule,
1269  const StringObject& serializedPatternFile);
1270 #endif
1271 
1276  TermVector analyzeField(
1277  const String& fieldType,
1278  const String& fieldContent);
1279 
1280 #ifdef STRUS_BOOST_PYTHON
1281  TermVector analyzeField_obj(
1282  const String& fieldType,
1283  const StringObject& fieldContent);
1284 #endif
1285 
1288  QueryAnalyzeContext createContext() const;
1289 
1290 private:
1292  friend class Context;
1293  QueryAnalyzer( const Reference& objbuilder, const Reference& trace, const Reference& errorhnd);
1294 
1295  Reference m_errorhnd_impl;
1296  Reference m_trace_impl;
1297  Reference m_objbuilder_impl;
1298  Reference m_analyzer_impl;
1299 };
1300 
1301 
1304 class QueryTerm :public Term
1305 {
1306 public:
1308  QueryTerm( const Index& field_, const String& type_, const String& value_, const Index& position_, const Index& length_)
1309  :Term(type_,value_,position_, length_),m_field(field_){}
1312  :Term(o),m_field(o.m_field){}
1315  :Term(),m_field(0){}
1316 
1318  unsigned int field() const {return m_field;}
1320  const String& type() const {return Term::type();}
1322  const String& value() const {return Term::value();}
1323 #if defined STRUS_BOOST_PYTHON || defined DOXYGEN_PYTHON
1324  WString ucvalue() const {return Term::ucvalue();}
1325 #endif
1326  Index position() const {return Term::position();}
1328 
1329 #ifdef STRUS_BOOST_PYTHON
1330  bool operator==( const QueryTerm& o) const {return Term::operator==( o);}
1331  bool operator!=( const QueryTerm& o) const {return Term::operator!=( o);}
1332 #endif
1333 
1334 private:
1335  Index m_field;
1336 };
1337 #ifdef STRUS_BOOST_PYTHON
1338 typedef std::vector<QueryTerm> QueryTermVector;
1339 #endif
1340 
1341 
1345 {
1346 public:
1347 #ifdef STRUS_BOOST_PYTHON
1350 #endif
1355 
1360  void putField(
1361  unsigned int fieldNo,
1362  const String& fieldType,
1363  const String& fieldContent);
1364 #ifdef STRUS_BOOST_PYTHON
1365  void putField_obj( unsigned int fieldNo, const String& fieldType, const StringObject& fieldContent);
1366 #endif
1367 
1370  QueryTermVector analyze();
1371 
1372 private:
1374  friend class QueryAnalyzer;
1375  explicit QueryAnalyzeContext( const Reference& objbuilder, const Reference& trace, const Reference& errorhnd, const Reference& analyzer);
1376 
1377  Reference m_errorhnd_impl;
1378  Reference m_trace_impl;
1379  Reference m_objbuilder_impl;
1380  Reference m_analyzer_impl;
1381  Reference m_analyzer_ctx_impl;
1382 };
1383 
1385 class StatisticsIterator;
1387 class StorageTransaction;
1389 class DocumentBrowser;
1390 
1394 {
1395 public:
1396 #ifdef STRUS_BOOST_PYTHON
1397  StorageClient(){}
1399 #endif
1400  StorageClient( const StorageClient& o);
1402 
1405 
1408  Index nofDocumentsInserted() const;
1409 
1412  StorageTransaction createTransaction() const;
1413 
1417  StatisticsIterator createInitStatisticsIterator( bool sign) const;
1418 
1421  StatisticsIterator createUpdateStatisticsIterator() const;
1422 
1424  DocumentBrowser createDocumentBrowser();
1425 
1427  void close();
1428 
1429 private:
1430  friend class Context;
1431  StorageClient( const Reference& objbuilder, const Reference& trace, const Reference& errorhnd_, const String& config);
1432 
1433  friend class Query;
1434  friend class QueryEval;
1435  Reference m_errorhnd_impl;
1436  Reference m_trace_impl;
1437  Reference m_objbuilder_impl;
1438  Reference m_storage_impl;
1439 };
1440 
1441 
1445 {
1446 public:
1447 #ifdef STRUS_BOOST_PYTHON
1448  StorageTransaction(){}
1450 #endif
1451  ~StorageTransaction(){}
1453 
1458  void insertDocument( const String& docid, const Document& doc);
1459 
1463  void deleteDocument( const String& docid);
1464 #ifdef STRUS_BOOST_PYTHON
1465  void deleteDocument_obj( const StringObject& docid);
1466 #endif
1467 
1471  void deleteUserAccessRights( const String& username);
1472 #ifdef STRUS_BOOST_PYTHON
1473  void deleteUserAccessRights_obj( const StringObject& username);
1474 #endif
1475 
1477  void commit();
1478 
1480  void rollback();
1481 
1482 private:
1483  friend class StorageClient;
1484  StorageTransaction( const Reference& objbuilder, const Reference& trace, const Reference& errorhnd_, const Reference& storage_);
1485 
1486  friend class Query;
1487  friend class QueryEval;
1488  Reference m_errorhnd_impl;
1489  Reference m_trace_impl;
1490  Reference m_objbuilder_impl;
1491  Reference m_storage_impl;
1492  Reference m_transaction_impl;
1493 };
1494 
1495 
1498 {
1499 public:
1504  DocumentFrequencyChange( const String& type_, const String& value_, int increment_)
1505  :m_type(type_),m_value(value_),m_increment(increment_){}
1508  :m_type(o.m_type),m_value(o.m_value),m_increment(o.m_increment){}
1511  :m_increment(0){}
1512 
1514  const String& type() const {return m_type;}
1516  const String& value() const {return m_value;}
1517 #if defined STRUS_BOOST_PYTHON || defined DOXYGEN_PYTHON
1518  WString ucvalue() const;
1519 #endif
1520  int increment() const {return m_increment;}
1522 
1523 #ifdef STRUS_BOOST_PYTHON
1524  bool operator==( const DocumentFrequencyChange& o) const
1525  {
1526  return m_type == o.m_type && m_value == o.m_value && m_increment == o.m_increment;
1527  }
1528  bool operator!=( const DocumentFrequencyChange& o) const
1529  {
1530  return m_type != o.m_type || m_value != o.m_value || m_increment != o.m_increment;
1531  }
1532 #endif
1533 
1534 private:
1535  std::string m_type;
1536  std::string m_value;
1537  int m_increment;
1538 };
1539 #ifdef STRUS_BOOST_PYTHON
1540 typedef std::vector<DocumentFrequencyChange> DocumentFrequencyChangeVector;
1541 #endif
1542 
1543 
1546 {
1547 public:
1548 #ifdef STRUS_BOOST_PYTHON
1549  StatisticsMessage(){}
1551 #endif
1554  :m_nofDocumentsInsertedChange(o.m_nofDocumentsInsertedChange)
1555  ,m_documentFrequencyChangeList(o.m_documentFrequencyChangeList){}
1556 
1558  StatisticsMessage( const std::vector<DocumentFrequencyChange>& dfchglist, int nofdocs)
1559  :m_nofDocumentsInsertedChange(nofdocs)
1560  ,m_documentFrequencyChangeList(dfchglist){}
1561 
1565  {
1566  return m_nofDocumentsInsertedChange;
1567  }
1568 
1571  const std::vector<DocumentFrequencyChange>& documentFrequencyChangeList() const
1572  {
1573  return m_documentFrequencyChangeList;
1574  }
1575 
1576 private:
1577  int m_nofDocumentsInsertedChange;
1578  std::vector<DocumentFrequencyChange> m_documentFrequencyChangeList;
1579 };
1580 
1581 
1584 {
1585 public:
1586 #ifdef STRUS_BOOST_PYTHON
1587  StatisticsIterator(){}
1589 #endif
1592 
1595  String getNext();
1596 
1597 private:
1598  friend class StorageClient;
1599  StatisticsIterator( const Reference& objbuilder, const Reference& trace, const Reference& errorhnd_, const Reference& storage_, const Reference& iter_);
1600 
1601 private:
1602  Reference m_errorhnd_impl;
1603  Reference m_trace_impl;
1604  Reference m_objbuilder_impl;
1605  Reference m_storage_impl;
1606  Reference m_iter_impl;
1607 };
1608 
1609 
1612 {
1613 public:
1614 #ifdef STRUS_BOOST_PYTHON
1617 #endif
1618  StatisticsMessage decode( const String& blob) const;
1622 #ifdef STRUS_BOOST_PYTHON
1623  StatisticsMessage decode_datablob( const DataBlob& blob) const;
1624 #endif
1625  String encode( const StatisticsMessage& msg) const;
1629 
1630 private:
1631  friend class Context;
1632  StatisticsProcessor( const Reference& objbuilder_, const Reference& trace_, const std::string& name_, const Reference& errorhnd_);
1633 
1634 private:
1635  Reference m_errorhnd_impl;
1636  Reference m_trace_impl;
1637  Reference m_objbuilder_impl;
1638  const void* m_statsproc;
1639 };
1640 
1641 
1643 class VecRank
1644 {
1645 public:
1648  :m_index(0),m_weight(0.0){}
1650  VecRank( Index index_, double weight_)
1651  :m_index(index_),m_weight(weight_){}
1653  VecRank( const VecRank& o)
1654  :m_index(o.m_index),m_weight(o.m_weight){}
1655 
1657  Index index() const {return m_index;}
1659  double weight() const {return m_weight;}
1661 
1662 #ifdef STRUS_BOOST_PYTHON
1663  bool operator==( const VecRank& o) const
1664  {
1665  if (m_index != o.m_index) return false;
1666  double ww = (m_weight - o.m_weight);
1667  return (ww < 0.0)?(-ww < std::numeric_limits<double>::epsilon()):(ww < std::numeric_limits<double>::epsilon());
1668  }
1669  bool operator!=( const VecRank& o) const
1670  {
1671  return !operator==( o);
1672  }
1673 #endif
1674 
1675 private:
1676  Index m_index;
1677  double m_weight;
1678 };
1679 #ifdef STRUS_BOOST_PYTHON
1680 typedef std::vector<VecRank> VecRankVector;
1681 #endif
1682 
1684 {
1685 public:
1686 #ifdef STRUS_BOOST_PYTHON
1689 #endif
1692 
1695 
1700  VecRankVector findSimilar( const FloatVector& vec, unsigned int maxNofResults) const;
1701 #ifdef STRUS_BOOST_PYTHON
1702  VecRankVector findSimilar_obj( const FunctionObject& vec, unsigned int maxNofResults) const;
1703 #endif
1704 
1710  VecRankVector findSimilarFromSelection( const IndexVector& featidxlist, const FloatVector& vec, unsigned int maxNofResults) const;
1711 #ifdef STRUS_BOOST_PYTHON
1712  VecRankVector findSimilarFromSelection_obj( const FunctionObject& featidxlist, const FunctionObject& vec, unsigned int maxNofResults) const;
1713 #endif
1714 
1716  void close();
1717 
1718 private:
1719  friend class VectorStorageClient;
1720  VectorStorageSearcher( const Reference& storage, const Reference& trace, const Index& range_from, const Index& range_to, const Reference& errorhnd_);
1721 
1722  Reference m_errorhnd_impl;
1723  Reference m_searcher_impl;
1724  Reference m_trace_impl;
1725 };
1726 
1729 
1733 {
1734 public:
1735 #ifdef STRUS_BOOST_PYTHON
1738 #endif
1741 
1744 
1749  VectorStorageSearcher createSearcher( const Index& range_from, const Index& range_to) const;
1750 
1752  VectorStorageTransaction createTransaction();
1753 
1756  StringVector conceptClassNames() const;
1757 
1762  IndexVector conceptFeatures( const String& conceptClass, const Index& conceptid) const;
1763 
1767  unsigned int nofConcepts( const String& conceptClass) const;
1768 
1773  IndexVector featureConcepts( const String& conceptClass, const Index& index) const;
1774 
1778  FloatVector featureVector( const Index& index) const;
1779 
1783  String featureName( const Index& index) const;
1784 
1788  Index featureIndex( const String& name) const;
1789 
1792  unsigned int nofFeatures() const;
1793 
1796  String config() const;
1797 
1799  void close();
1800 
1801 private:
1802  friend class Context;
1803  VectorStorageClient( const Reference& objbuilder, const Reference& trace, const Reference& errorhnd_, const String& config);
1804 
1805  Reference m_errorhnd_impl;
1806  Reference m_trace_impl;
1807  Reference m_objbuilder_impl;
1808  Reference m_vector_storage_impl;
1809  std::string m_config;
1810 };
1811 
1813 {
1814 public:
1815 #ifdef STRUS_BOOST_PYTHON
1818 #endif
1821 
1823 
1824  void addFeature( const String& name, const FloatVector& vec);
1825 #ifdef STRUS_BOOST_PYTHON
1826  void addFeature_obj( const StringObject& name, const FunctionObject& vec);
1827 #endif
1828  void defineFeatureConceptRelation( const String& relationTypeName, const Index& featidx, const Index& conidx);
1829 #ifdef STRUS_BOOST_PYTHON
1830  void defineFeatureConceptRelation_obj( const StringObject& relationTypeName, const Index& featidx, const Index& conidx);
1831 #endif
1832 
1833  bool commit();
1834 
1835  void rollback();
1836 
1838  void close();
1839 
1840 private:
1841  friend class VectorStorageClient;
1842  VectorStorageTransaction( const Reference& objbuilder, const Reference& storage, const Reference& trace, const Reference& errorhnd_, const String& config);
1843 
1844  Reference m_errorhnd_impl;
1845  Reference m_trace_impl;
1846  Reference m_objbuilder_impl;
1847  Reference m_vector_storage_impl;
1848  Reference m_vector_transaction_impl;
1849 };
1850 
1851 
1854 {
1855 public:
1860  :m_variables(o.m_variables){}
1861 
1865  void defineVariable( const String& name, double value)
1866  {
1867  m_variables[ name] = value;
1868  }
1869 
1870 private:
1871  friend class Query;
1872  friend class QueryEval;
1873  std::map<std::string,double> m_variables;
1874 };
1875 
1878 {
1879 public:
1884  :m_parameters(o.m_parameters),m_features(o.m_features){}
1885 
1886 #ifndef DOXYGEN_JAVA
1887  void defineParameter( const String& name, const Variant& value)
1891  {
1892  m_parameters[ name] = value;
1893  }
1894 #endif
1895  void defineParameter( const String& name, const char* value)
1899  {
1900  m_parameters[ name] = Variant(value);
1901  }
1902 
1906  void defineParameter( const String& name, int value)
1907  {
1908  m_parameters[ name] = value;
1909  }
1910 
1914  void defineParameter( const String& name, unsigned int value)
1915  {
1916  m_parameters[ name] = value;
1917  }
1918 
1922  void defineParameter( const String& name, double value)
1923  {
1924  m_parameters[ name] = value;
1925  }
1926 
1930  void defineFeature( const String& sumtype, const String& set)
1931  {
1932  m_features[ sumtype] = set;
1933  }
1934 
1938  void defineResultName( const String& origname, const String& newname)
1939  {
1940  m_resultnamemap[ origname] = newname;
1941  }
1942 
1943 private:
1944  friend class QueryEval;
1945  std::map<std::string,Variant> m_parameters;
1946  std::map<std::string,std::string> m_features;
1947  std::map<std::string,std::string> m_resultnamemap;
1948 };
1949 
1952 {
1953 public:
1958  :m_parameters(o.m_parameters){}
1959 
1960 #ifndef DOXYGEN_JAVA
1961  void defineParameter( const String& name, const Variant& value)
1965  {
1966  m_parameters[ name] = value;
1967  }
1968 #endif
1969  void defineParameter( const String& name, int value)
1973  {
1974  m_parameters[ name] = value;
1975  }
1976 
1980  void defineParameter( const String& name, unsigned int value)
1981  {
1982  m_parameters[ name] = value;
1983  }
1984 
1988  void defineParameter( const String& name, double value)
1989  {
1990  m_parameters[ name] = value;
1991  }
1992 
1996  void defineParameter( const String& name, const char* value)
1997  {
1998  m_parameters[ name] = Variant(value);
1999  }
2000 #if !defined SWIGJAVA && !defined SWIGPHP
2001  void defineParameter( const String& name, const String& value)
2005  {
2006  m_parameters[ name] = Variant(value);
2007  }
2008 #endif
2009 
2013  void defineFeature( const String& sumtype, const String& set)
2014  {
2015  m_features[ sumtype] = set;
2016  }
2017 
2018 private:
2019  friend class QueryEval;
2020  std::map<std::string,Variant> m_parameters;
2021  std::map<std::string,std::string> m_features;
2022 };
2023 
2025 class Query;
2026 
2029 {
2030 public:
2031 #ifdef STRUS_BOOST_PYTHON
2032  QueryEval(){}
2034 #endif
2035  QueryEval( const QueryEval& o);
2039 
2044  void addTerm(
2045  const String& set_,
2046  const String& type_,
2047  const String& value_);
2048 
2051  void addSelectionFeature( const String& set_);
2052 
2055  void addRestrictionFeature( const String& set_);
2056 
2059  void addExclusionFeature( const String& set_);
2060 
2064  void addSummarizer(
2065  const String& name,
2066  const SummarizerConfig& config);
2067 
2068 #ifdef STRUS_BOOST_PYTHON
2069  void addSummarizer_obj(
2070  const String& name,
2071  const FunctionObject& config_);
2072 #endif
2073 
2077  void addWeightingFunction(
2078  const String& name,
2079  const WeightingConfig& config);
2080 
2081 #ifdef STRUS_BOOST_PYTHON
2082  void addWeightingFunction_obj(
2083  const String& name,
2084  const FunctionObject& config_);
2085 #endif
2086  void addWeightingFormula(
2089  const String& source,
2090  const FunctionVariableConfig& defaultParameter);
2091 #ifdef STRUS_BOOST_PYTHON
2092  void addWeightingFormula_obj(
2093  const StringObject& source,
2094  const FunctionObject& defaultParameter_);
2095 #endif
2096 
2099  Query createQuery( const StorageClient& storage) const;
2100 
2101 private:
2103  friend class Context;
2104  QueryEval( const Reference& objbuilder, const Reference& trace, const Reference& errorhnd);
2105 
2106  friend class Query;
2107  Reference m_errorhnd_impl;
2108  Reference m_trace_impl;
2109  Reference m_objbuilder_impl;
2110  Reference m_queryeval_impl;
2111  const void* m_queryproc;
2112 };
2113 
2114 
2117 {
2118 public:
2121  :m_weight(0.0),m_index(-1){}
2123  SummaryElement( const String& name_, const String& value_, double weight_, int index_)
2124  :m_name(name_),m_value(value_),m_weight(weight_),m_index(index_){}
2127  :m_name(o.m_name),m_value(o.m_value),m_weight(o.m_weight),m_index(o.m_index){}
2128 
2130  const String& name() const {return m_name;}
2132  const String& value() const {return m_value;}
2134  double weight() const {return m_weight;}
2136  int index() const {return m_index;}
2137 
2138 #if defined STRUS_BOOST_PYTHON || defined DOXYGEN_PYTHON
2139  WString ucvalue() const;
2140 
2141  bool operator==( const SummaryElement& o) const
2142  {
2143  if (m_name != o.m_name || m_value != o.m_value || m_index != o.m_index) return false;
2144  double ww = m_weight - o.m_weight;
2145  return (ww < 0.0)?(-ww<std::numeric_limits<double>::epsilon()):(ww<std::numeric_limits<double>::epsilon());
2146  }
2147  bool operator!=( const SummaryElement& o) const
2148  {
2149  return !operator==(o);
2150  }
2151 #endif
2152 private:
2153  friend class Query;
2154  std::string m_name;
2155  std::string m_value;
2156  double m_weight;
2157  int m_index;
2158 };
2159 #ifdef STRUS_BOOST_PYTHON
2160 typedef std::vector<SummaryElement> SummaryElementVector;
2161 #endif
2162 
2163 
2165 class Rank
2166 {
2167 public:
2170  :m_docno(0),m_weight(0.0){}
2172  Rank( Index docno_, double weight_, const SummaryElementVector& summaryElements_)
2173  :m_docno(docno_),m_weight(weight_),m_summaryElements(summaryElements_){}
2175  Rank( const Rank& o)
2176  :m_docno(o.m_docno),m_weight(o.m_weight),m_summaryElements(o.m_summaryElements){}
2177 
2179  Index docno() const {return m_docno;}
2181  double weight() const {return m_weight;}
2183 
2185  const SummaryElementVector& summaryElements() const {return m_summaryElements;}
2186 
2187 #ifdef STRUS_BOOST_PYTHON
2188  bool operator==( const Rank& o) const
2189  {
2190  if (m_docno != o.m_docno) return false;
2191  double ww = (m_weight - o.m_weight);
2192  return (ww < 0.0)?(-ww < std::numeric_limits<double>::epsilon()):(ww < std::numeric_limits<double>::epsilon());
2193  }
2194  bool operator!=( const Rank& o) const
2195  {
2196  return !operator==( o);
2197  }
2198 #endif
2199 
2200 private:
2201  friend class Query;
2202  Index m_docno;
2203  double m_weight;
2204  std::vector<SummaryElement> m_summaryElements;
2205 };
2206 #ifdef STRUS_BOOST_PYTHON
2207 typedef std::vector<Rank> RankVector;
2208 #endif
2209 
2210 
2213 {
2214 public:
2216  :m_ops(o.m_ops),m_strings(o.m_strings),m_size(o.m_size){}
2218  :m_size(0){}
2219 
2224  void pushTerm( const String& type_, const String& value_, const Index& length_);
2225 
2229  void pushDocField( const String& metadata_start_, const String& metadata_end_);
2230 
2231 #ifdef STRUS_BOOST_PYTHON
2232  void pushTerm_obj( const String& type_, const StringObject& value_, const Index& length_);
2233 #endif
2234  void pushExpression( const String& opname_, unsigned int argc_, int range_=0, unsigned int cardinality_=0);
2240 
2241 #ifdef STRUS_BOOST_PYTHON
2242  void pushExpression_2( const String& opname_, unsigned int argc)
2243  {
2244  pushExpression( opname_, argc, 0, 0);
2245  }
2246  void pushExpression_3( const String& opname_, unsigned int argc, int range_)
2247  {
2248  pushExpression( opname_, argc, range_, 0);
2249  }
2250  void pushExpression_4( const String& opname_, unsigned int argc, int range_, unsigned int cardinality_)
2251  {
2252  pushExpression( opname_, argc, range_, cardinality_);
2253  }
2254 #endif
2255 
2260  void attachVariable( const String& name_);
2261 #ifdef STRUS_BOOST_PYTHON
2262  void attachVariable_obj( const StringObject& name_);
2263 #endif
2264 
2267  void add( const QueryExpression& o);
2268 
2271  std::size_t size() const
2272  {
2273  return m_size;
2274  }
2275 
2276 private:
2277  friend class Query;
2278 
2279  struct StackOp
2280  {
2281  enum Type
2282  {
2283  PushTerm,
2284  PushDocField,
2285  PushExpression,
2286  AttachVariable
2287  };
2288  enum ArgIndex
2289  {
2290  Term_type=0x0,
2291  Term_value=0x1,
2292  Term_length=0x2,
2293  Term_metastart=0x0,
2294  Term_metaend=0x1,
2295  Expression_opname=0x0,
2296  Expression_argc=0x1,
2297  Expression_range=0x2,
2298  Expression_cardinality=0x3,
2299  Variable_name=0x0
2300  };
2301  Type type;
2302  int arg[4];
2303 
2304  StackOp( Type type_, int arg0_, int arg1_=0, int arg2_=0, int arg3_=0)
2305  :type(type_)
2306  {
2307  arg[0] = arg0_;
2308  arg[1] = arg1_;
2309  arg[2] = arg2_;
2310  arg[3] = arg3_;
2311  }
2312 
2313  StackOp()
2314  :type(PushTerm)
2315  {
2316  std::memset( arg, 0, sizeof(arg));
2317  }
2318  StackOp( const StackOp& o)
2319  {
2320  std::memcpy( this, &o, sizeof(*this));
2321  }
2322  };
2323  std::size_t allocid( const String& str);
2324 #ifdef STRUS_BOOST_PYTHON
2325  std::size_t allocid_obj( const StringObject& str);
2326 #endif
2327 
2328 private:
2329  std::vector<StackOp> m_ops;
2330  std::string m_strings;
2331  std::size_t m_size;
2332 };
2333 
2334 
2338 {
2339 public:
2342  :m_df(-1){}
2345  :m_df(df_){}
2348  :m_df(o.m_df){}
2349 
2352  GlobalCounter df() const {return m_df;}
2355  void set_df( GlobalCounter df_) {m_df = df_;}
2356 
2357 private:
2358  GlobalCounter m_df;
2359 };
2360 
2364 {
2367  :m_nofDocumentsInserted(-1){}
2369  explicit GlobalStatistics( GlobalCounter nofDocumentsInserted_)
2370  :m_nofDocumentsInserted(nofDocumentsInserted_){}
2373  :m_nofDocumentsInserted(o.m_nofDocumentsInserted){}
2374 
2376  GlobalCounter nofdocs() const {return m_nofDocumentsInserted;}
2379  void set_nofdocs( GlobalCounter nofdocs_) {m_nofDocumentsInserted = nofdocs_;}
2380 
2381 private:
2382  GlobalCounter m_nofDocumentsInserted;
2383 };
2384 
2387 {
2388 public:
2391  :m_evaluationPass(0),m_nofDocumentsRanked(0),m_nofDocumentsVisited(0){}
2392 
2394  unsigned int evaluationPass() const {return m_evaluationPass;}
2396  unsigned int nofDocumentsRanked() const {return m_nofDocumentsRanked;}
2398  unsigned int nofDocumentsVisited() const {return m_nofDocumentsVisited;}
2399 
2401  const RankVector& ranks() const {return m_ranks;}
2402 
2403 private:
2404  friend class Query;
2405  QueryResult( unsigned int evaluationPass_, unsigned int nofDocumentsRanked_, unsigned int nofDocumentsVisited_)
2406  :m_evaluationPass(evaluationPass_),m_nofDocumentsRanked(nofDocumentsRanked_),m_nofDocumentsVisited(nofDocumentsVisited_){}
2407 
2408 private:
2409  unsigned int m_evaluationPass;
2410  unsigned int m_nofDocumentsRanked;
2411  unsigned int m_nofDocumentsVisited;
2412  RankVector m_ranks;
2413 };
2414 
2416 class Query
2417 {
2418 public:
2419 #ifdef STRUS_BOOST_PYTHON
2420  Query(){}
2422 #endif
2423  Query( const Query& o);
2427 
2433 #if defined SWIGPHP
2434  // ... SWIG PHP implementation cannot handle signatures with typemaps and default parameters (!)
2435  void defineFeature( const String& set_, const QueryExpression& expr_, double weight_);
2436 #else
2437  void defineFeature( const String& set_, const QueryExpression& expr_, double weight_=1.0);
2438 #endif
2439 #ifdef STRUS_BOOST_PYTHON
2440  void defineFeature_2( const String& set_, const QueryExpression& expr_)
2441  {
2442  defineFeature( set_, expr_, 1.0);
2443  }
2444 
2445  void defineFeature_3( const String& set_, const QueryExpression& expr_, double weight_)
2446  {
2447  defineFeature( set_, expr_, weight_);
2448  }
2449 
2450  void defineFeature_expr_2( const String& set_, const FunctionObject& expr_);
2451  void defineFeature_expr_3( const String& set_, const FunctionObject& expr_, double weight_);
2452 #endif
2453 
2458  void defineDocFieldFeature( const String& set_, const String& metadataStart, const String& metadataEnd);
2459 
2460 #ifndef DOXYGEN_JAVA
2461  void addMetaDataRestrictionCondition(
2467  const char* compareOp, const String& name,
2468  const Variant& value, bool newGroup);
2469 #endif
2470  void addMetaDataRestrictionCondition(
2476  const char* compareOp, const String& name,
2477  double value, bool newGroup);
2478 
2484  void addMetaDataRestrictionCondition(
2485  const char* compareOp, const String& name,
2486  unsigned int value, bool newGroup);
2487 
2493  void addMetaDataRestrictionCondition(
2494  const char* compareOp, const String& name,
2495  int value, bool newGroup);
2496 
2497 #ifdef STRUS_BOOST_PYTHON
2498  void addMetaDataRestrictionCondition_double(
2499  const char* compareOp, const String& name,
2500  double value, bool newGroup)
2501  {
2502  addMetaDataRestrictionCondition( compareOp, name, value, newGroup);
2503  }
2504 
2505  void addMetaDataRestrictionCondition_uint(
2506  const char* compareOp, const String& name,
2507  unsigned int value, bool newGroup)
2508  {
2509  addMetaDataRestrictionCondition( compareOp, name, value, newGroup);
2510  }
2511 
2512  void addMetaDataRestrictionCondition_int(
2513  const char* compareOp, const String& name,
2514  int value, bool newGroup)
2515  {
2516  addMetaDataRestrictionCondition( compareOp, name, value, newGroup);
2517  }
2518 #endif
2519  void defineTermStatistics( const String& type_, const String& value_, const TermStatistics& stats_);
2524 
2527  void defineGlobalStatistics( const GlobalStatistics& stats_);
2528 
2529 #ifdef STRUS_BOOST_PYTHON
2530  void defineTermStatistics_obj_struct( const String& type_, const StringObject& value_, const FunctionObject& stats_);
2531  void defineGlobalStatistics_struct( const FunctionObject& stats_);
2532 #endif
2533 
2536  void addDocumentEvaluationSet( const IndexVector& docnolist_);
2537 #ifdef STRUS_BOOST_PYTHON
2538  void addDocumentEvaluationSet_struct( const FunctionObject& docnolist_);
2539 #endif
2540 
2543  void setMaxNofRanks( unsigned int maxNofRanks_);
2544 
2547  void setMinRank( unsigned int minRank_);
2548 
2552  void addUserName( const String& username_);
2553 
2554 #ifdef STRUS_BOOST_PYTHON
2555  void addUserName_obj( const StringObject& username_);
2556 #endif
2557  void setWeightingVariables(
2560  const FunctionVariableConfig& parameter);
2561 #ifdef STRUS_BOOST_PYTHON
2562  void setWeightingVariables_obj(
2563  const FunctionObject& parameter_);
2564 #endif
2565 
2568  QueryResult evaluate() const;
2569 
2572  String tostring() const;
2573 
2574 private:
2575  friend class QueryEval;
2576  Query( const Reference& objbuilder_impl_, const Reference& trace_impl_, const Reference& errorhnd_, const Reference& storage_impl_, const Reference& queryeval_impl_, const Reference& query_impl_, const void* queryproc_)
2577  :m_errorhnd_impl(errorhnd_),m_trace_impl(trace_impl_),m_objbuilder_impl(objbuilder_impl_),m_storage_impl(storage_impl_),m_queryeval_impl(queryeval_impl_),m_query_impl(query_impl_),m_queryproc(queryproc_)
2578  {}
2579 
2580  Reference m_errorhnd_impl;
2581  Reference m_trace_impl;
2582  Reference m_objbuilder_impl;
2583  Reference m_storage_impl;
2584  Reference m_queryeval_impl;
2585  Reference m_query_impl;
2586  const void* m_queryproc;
2587 };
2588 
2591 {
2592 public:
2593 #ifdef STRUS_BOOST_PYTHON
2594  DocumentBrowser(){}
2596 #endif
2597  DocumentBrowser( const DocumentBrowser& o);
2601 
2602 #ifndef DOXYGEN_JAVA
2603  void addMetaDataRestrictionCondition(
2610  const char* compareOp, const String& name,
2611  const Variant& value, bool newGroup);
2612 #endif
2613  void addMetaDataRestrictionCondition(
2620  const char* compareOp, const String& name,
2621  double value, bool newGroup);
2622 
2629  void addMetaDataRestrictionCondition(
2630  const char* compareOp, const String& name,
2631  unsigned int value, bool newGroup);
2632 
2639  void addMetaDataRestrictionCondition(
2640  const char* compareOp, const String& name,
2641  int value, bool newGroup);
2642 
2643 #ifdef STRUS_BOOST_PYTHON
2644  void addMetaDataRestrictionCondition_double(
2645  const char* compareOp, const String& name,
2646  double value, bool newGroup)
2647  {
2648  addMetaDataRestrictionCondition( compareOp, name, value, newGroup);
2649  }
2650 
2651  void addMetaDataRestrictionCondition_uint(
2652  const char* compareOp, const String& name,
2653  unsigned int value, bool newGroup)
2654  {
2655  addMetaDataRestrictionCondition( compareOp, name, value, newGroup);
2656  }
2657 
2658  void addMetaDataRestrictionCondition_int(
2659  const char* compareOp, const String& name,
2660  int value, bool newGroup)
2661  {
2662  addMetaDataRestrictionCondition( compareOp, name, value, newGroup);
2663  }
2664 #endif
2665  Index skipDoc( const Index& docno_);
2669 
2672  String attribute( const String& name);
2673 
2674 private:
2675  friend class StorageClient;
2677  const Reference& objbuilder_impl_,
2678  const Reference& trace_impl_,
2679  const Reference& storage_impl_,
2680  const Reference& errorhnd_);
2681 
2682 private:
2683  Reference m_errorhnd_impl;
2684  Reference m_trace_impl;
2685  Reference m_objbuilder_impl;
2686  Reference m_storage_impl;
2687  Reference m_restriction_impl;
2688  Reference m_postingitr_impl;
2689  Reference m_attributereader_impl;
2690  Index m_docno;
2691 };
2692 
2701 class Context
2702 {
2703 public:
2705  Context();
2708  explicit Context( unsigned int maxNofThreads);
2712  explicit Context( unsigned int maxNofThreads, const String& tracecfg);
2716  explicit Context( const String& connectionstring);
2721  Context( const String& connectionstring, unsigned int maxNofThreads);
2723  Context( const Context& o);
2726 
2729  void checkErrors() const;
2730 
2734  void loadModule( const String& name_);
2735 
2739  void addModulePath( const String& paths_);
2740 
2741 #ifdef STRUS_BOOST_PYTHON
2742  void addModulePath_obj( const StringObject& paths_);
2743 #endif
2744 
2748  void addResourcePath( const String& paths_);
2749 
2750 #ifdef STRUS_BOOST_PYTHON
2751  void addResourcePath_obj( const StringObject& paths_);
2752 #endif
2753 
2756  StatisticsProcessor createStatisticsProcessor( const String& name);
2757 
2759  StorageClient createStorageClient();
2760 
2763  StorageClient createStorageClient( const String& config_);
2764 
2765 #ifdef STRUS_BOOST_PYTHON
2766  StorageClient createStorageClient_0();
2767  StorageClient createStorageClient_obj( const StringObject& config_);
2768 #endif
2769  VectorStorageClient createVectorStorageClient();
2771 
2774  VectorStorageClient createVectorStorageClient( const String& config_);
2775 
2776 #ifdef STRUS_BOOST_PYTHON
2777  VectorStorageClient createVectorStorageClient_0();
2778  VectorStorageClient createVectorStorageClient_obj( const StringObject& config_);
2779 #endif
2780 
2784  void createStorage( const String& config_);
2785 
2786 #ifdef STRUS_BOOST_PYTHON
2787  void createStorage_obj( const StringObject& config_);
2788 #endif
2789 
2793  void createVectorStorage( const String& config_);
2794 
2795 #ifdef STRUS_BOOST_PYTHON
2796  void createVectorStorage_obj( const StringObject& config_);
2797 #endif
2798  void destroyStorage( const String& config_);
2803 
2804 #ifdef STRUS_BOOST_PYTHON
2805  void destroyStorage_obj( const StringObject& config_);
2806 #endif
2807  DocumentClass detectDocumentClass( const String& content);
2811 
2812 #ifdef STRUS_BOOST_PYTHON
2813  DocumentClass detectDocumentClass_obj( const StringObject& content);
2814 #endif
2815  DocumentAnalyzer createDocumentAnalyzer( const String& segmentername_="");
2818 
2819 #ifdef STRUS_BOOST_PYTHON
2820  DocumentAnalyzer createDocumentAnalyzer_obj( const StringObject& segmentername_);
2821 
2822  DocumentAnalyzer createDocumentAnalyzer_0();
2823 #endif
2824 
2826  QueryAnalyzer createQueryAnalyzer();
2827 
2829  QueryEval createQueryEval();
2830 
2832  void close();
2833 
2834 private:
2835  void initStorageObjBuilder();
2836  void initAnalyzerObjBuilder();
2837 
2838 private:
2839  Reference m_errorhnd_impl;
2840  Reference m_moduleloader_impl;
2841  Reference m_rpc_impl;
2842  Reference m_trace_impl;
2843  Reference m_storage_objbuilder_impl;
2844  Reference m_analyzer_objbuilder_impl;
2845  const void* m_textproc;
2846 };
2847 
2848 #ifdef DOXYGEN_LANG
2849 #if defined DOXYGEN_JAVA
2850 }}}
2851 #elif defined DOXYGEN_PYTHON
2852 }
2853 #endif
2854 #endif
2855 #endif
2856 
2857 
SummaryElement(const String &name_, const String &value_, double weight_, int index_)
Constructor.
Definition: bindingObjects.hpp:2123
void defineParameter(const String &name, int value)
Define a summarizer parameter.
Definition: bindingObjects.hpp:1906
long GlobalCounter
Definition: bindingObjects.hpp:56
~DocumentAnalyzer()
Destructor.
Definition: bindingObjects.hpp:698
QueryTerm(const QueryTerm &o)
Copy constructor.
Definition: bindingObjects.hpp:1311
const String & name() const
Definition: bindingObjects.hpp:136
TermStatistics(GlobalCounter df_)
Constructor.
Definition: bindingObjects.hpp:2344
Object representing a client connection to the storage.
Definition: bindingObjects.hpp:1393
SummaryElement(const SummaryElement &o)
Copy connstructor.
Definition: bindingObjects.hpp:2126
TermStatistics(const TermStatistics &o)
Copy constructor.
Definition: bindingObjects.hpp:2347
WeightingConfig(const WeightingConfig &o)
Copy constructor.
Definition: bindingObjects.hpp:1957
Iterator on messages with storage statistics.
Definition: bindingObjects.hpp:1583
PatternMatcher()
Definition: bindingObjects.hpp:1033
Tokenizer(const String &name_, const StringVector &arg_)
Definition: bindingObjects.hpp:120
MetaData(const String &name_, const Variant &value_)
Constructor.
Definition: bindingObjects.hpp:452
const TermVector & forwardIndexTerms() const
Get the list of forward terms of the document.
Definition: bindingObjects.hpp:653
DocumentFrequencyChange(const String &type_, const String &value_, int increment_)
Constructor.
Definition: bindingObjects.hpp:1504
const SummaryElementVector & summaryElements() const
Get the summary elements.
Definition: bindingObjects.hpp:2185
void defineFeature(const String &sumtype, const String &set)
Define a summarizer feature.
Definition: bindingObjects.hpp:1930
DocumentClass(const String &mimeType_)
Constructor.
Definition: bindingObjects.hpp:536
~VectorStorageTransaction()
Definition: bindingObjects.hpp:1822
Object representing a string or a numeric value of the binding language.
Definition: bindingObjects.hpp:285
Object representing a transaction of the storage.
Definition: bindingObjects.hpp:1444
void defineParameter(const String &name, unsigned int value)
Define a summarizer parameter.
Definition: bindingObjects.hpp:1914
Defines a description of the properties of a document content processed by the analyzer.
Definition: bindingObjects.hpp:530
DocumentClass(const String &mimeType_, const String &encoding_)
Constructor.
Definition: bindingObjects.hpp:539
Attribute of a query evaluation result element.
Definition: bindingObjects.hpp:2116
const String & value() const
Get the value of the summary element.
Definition: bindingObjects.hpp:2132
const String & value() const
Get the term value.
Definition: bindingObjects.hpp:1516
Data object that describes a single property of a document that is not subject of retrieval...
Definition: bindingObjects.hpp:488
GlobalCounter df() const
Get the global document frequency.
Definition: bindingObjects.hpp:2352
void setName(const String &name_)
Definition: bindingObjects.hpp:185
Object representing a aggregator function definition.
Definition: bindingObjects.hpp:216
Global document statistics, if passed down with the query.
Definition: bindingObjects.hpp:2363
Tokenizer(const String &name_)
Definition: bindingObjects.hpp:133
bool valid() const
Check if this document class is valid.
Definition: bindingObjects.hpp:552
Rank()
Constructor.
Definition: bindingObjects.hpp:2169
Normalizer(const Normalizer &o)
Definition: bindingObjects.hpp:162
QueryTerm()
Default constructor.
Definition: bindingObjects.hpp:1314
~Aggregator()
Destructor.
Definition: bindingObjects.hpp:253
void setScheme(const String &scheme_)
Set the scheme identifier of the document class.
Definition: bindingObjects.hpp:559
SummarizerConfig()
Constructor.
Definition: bindingObjects.hpp:1881
int Index
Definition: bindingObjects.hpp:55
double weight() const
Get the weight of the summary element.
Definition: bindingObjects.hpp:2134
Message with storage statistics.
Definition: bindingObjects.hpp:1545
void set_df(GlobalCounter df_)
Set the global document frequency for a term in a query evaluation.
Definition: bindingObjects.hpp:2355
Aggregator(const String &name_, const StringVector &arg_)
Constructor.
Definition: bindingObjects.hpp:227
~Normalizer()
Definition: bindingObjects.hpp:180
Analyzer object representing a program for segmenting, tokenizing and normalizing a document into ato...
Definition: bindingObjects.hpp:687
GlobalStatistics()
Default constructor.
Definition: bindingObjects.hpp:2366
const String & type() const
Get the term type name.
Definition: bindingObjects.hpp:1514
Rank(const Rank &o)
Copy constructor.
Definition: bindingObjects.hpp:2175
GlobalStatistics(GlobalCounter nofDocumentsInserted_)
Constructor.
Definition: bindingObjects.hpp:2369
Structure holding the statistics of a term to be used in a query.
Definition: bindingObjects.hpp:2337
Translation to update a storage with statistics messages.
Definition: bindingObjects.hpp:1611
Normalizer()
Definition: bindingObjects.hpp:161
Analyzer object representing a set of function for transforming a field, the smallest unit in any que...
Definition: bindingObjects.hpp:1179
Object representing a normalizer function definition.
Definition: bindingObjects.hpp:158
int nofDocumentsInsertedChange() const
Return the change of number of documents inserted.
Definition: bindingObjects.hpp:1564
Attribute(const String &name_, const String &value_)
Constructor.
Definition: bindingObjects.hpp:492
Normalizer(const String &name_, const StringVector &arg_)
Definition: bindingObjects.hpp:164
Structure describing the document frequency change of one term in the collection. ...
Definition: bindingObjects.hpp:1497
void defineParameter(const String &name, double value)
Define a summarizer parameter.
Definition: bindingObjects.hpp:1922
const StringVector & arguments() const
Get the arguments of the aggregator function.
Definition: bindingObjects.hpp:260
unsigned int evaluationPass() const
Get the last query evaluation pass used (level of selection features used)
Definition: bindingObjects.hpp:2394
const String & value() const
Get the term value.
Definition: bindingObjects.hpp:1322
Aggregator(const Aggregator &o)
Copy constructor.
Definition: bindingObjects.hpp:222
void addArgument(const String &arg_)
Definition: bindingObjects.hpp:186
~VectorStorageClient()
Destructor.
Definition: bindingObjects.hpp:1743
VecRank(Index index_, double weight_)
Constructor.
Definition: bindingObjects.hpp:1650
~DocumentAnalyzeQueue()
Destructor.
Definition: bindingObjects.hpp:982
QueryResult()
Default constructor.
Definition: bindingObjects.hpp:2390
DocumentFrequencyChange()
Default constructor.
Definition: bindingObjects.hpp:1510
Aggregator(const String &name_)
Constructor.
Definition: bindingObjects.hpp:249
QueryExpression()
Definition: bindingObjects.hpp:2217
Weighted document reference with attributes (result of a query evaluation)
Definition: bindingObjects.hpp:2165
~StorageClient()
Destructor.
Definition: bindingObjects.hpp:1404
const TermVector & searchIndexTerms() const
Get the list of search terms of the document.
Definition: bindingObjects.hpp:650
double value() const
Get the value of this meta data field:
Definition: bindingObjects.hpp:464
VecRank()
Constructor.
Definition: bindingObjects.hpp:1647
const AttributeVector & attributes() const
Get the list of attributes of the document.
Definition: bindingObjects.hpp:659
const String & name() const
Definition: bindingObjects.hpp:182
void setName(const String &name_)
Definition: bindingObjects.hpp:139
Object representing a client connection to a vector storage.
Definition: bindingObjects.hpp:1732
~Query()
Destructor.
Definition: bindingObjects.hpp:2426
const String & type() const
Get the term type name.
Definition: bindingObjects.hpp:411
One typed term occurrence in a document or a query.
Definition: bindingObjects.hpp:397
const String & name() const
Get the name of the aggregator function.
Definition: bindingObjects.hpp:257
void set_nofdocs(GlobalCounter nofdocs_)
Set the global total number of documents in the collection for a query evaluation.
Definition: bindingObjects.hpp:2379
void defineVariable(const String &name, double value)
Define a variable value.
Definition: bindingObjects.hpp:1865
void setMimeType(const String &mimeType_)
Set the MIME type of the document class.
Definition: bindingObjects.hpp:556
const String & name() const
Get the type name of this meta data field:
Definition: bindingObjects.hpp:462
const StringVector & users() const
Get the list of users that are allowed to access the document.
Definition: bindingObjects.hpp:662
Aggregator(const String &name_, const String &arg1_, const String &arg2_)
Constructor.
Definition: bindingObjects.hpp:241
Rank(Index docno_, double weight_, const SummaryElementVector &summaryElements_)
Constructor.
Definition: bindingObjects.hpp:2172
Index position() const
Get the term position.
Definition: bindingObjects.hpp:418
Tokenizer()
Definition: bindingObjects.hpp:117
unsigned int nofDocumentsRanked() const
Get the total number of matches that were ranked (after applying all query restrictions) ...
Definition: bindingObjects.hpp:2396
double weight() const
Get the weight of the rank.
Definition: bindingObjects.hpp:2181
Index docno() const
Get the internal document nuber used.
Definition: bindingObjects.hpp:2179
Tokenizer(const String &name_, const String &arg1_, const String &arg2_)
Definition: bindingObjects.hpp:127
Object representing a tokenizer function definition.
Definition: bindingObjects.hpp:114
DocumentClass(const String &mimeType_, const String &encoding_, const String &scheme_)
Constructor.
Definition: bindingObjects.hpp:543
const std::vector< DocumentFrequencyChange > & documentFrequencyChangeList() const
Return the list of document frequency changes.
Definition: bindingObjects.hpp:1571
const MetaDataVector & metaData() const
Get the list of meta data of the document.
Definition: bindingObjects.hpp:656
SummaryElement()
Constructor.
Definition: bindingObjects.hpp:2120
Document object representing one item of retrieval. A document can be manually composed of its sub pa...
Definition: bindingObjects.hpp:583
~Context()
Destructor.
Definition: bindingObjects.hpp:2725
VecRank(const VecRank &o)
Copy constructor.
Definition: bindingObjects.hpp:1653
TermStatistics()
Constructor.
Definition: bindingObjects.hpp:2341
QueryTerm(const Index &field_, const String &type_, const String &value_, const Index &position_, const Index &length_)
Constructor.
Definition: bindingObjects.hpp:1308
Structure representing the result of a query.
Definition: bindingObjects.hpp:2386
DocumentFrequencyChange(const DocumentFrequencyChange &o)
Copy constructor.
Definition: bindingObjects.hpp:1507
Term(const String &type_, const String &value_, const Index &position_, const Index &length_)
Constructor.
Definition: bindingObjects.hpp:401
Configuration describing a scalar function variable value.
Definition: bindingObjects.hpp:1853
Definition: bindingObjects.hpp:1683
const String & name() const
Get the unique type name of this attribute.
Definition: bindingObjects.hpp:502
~DocumentBrowser()
Destructor.
Definition: bindingObjects.hpp:2600
std::size_t size() const
Get the number of items (sub expressions) on the stack as result of this expression.
Definition: bindingObjects.hpp:1097
std::size_t size() const
Get the number of items (sub expressions) on the stack as result of this expression.
Definition: bindingObjects.hpp:2271
QueryExpression(const QueryExpression &o)
Definition: bindingObjects.hpp:2215
void defineResultName(const String &origname, const String &newname)
Rename a result (each summarizer result has a default name that can be changed with this method) ...
Definition: bindingObjects.hpp:1938
void defineFeature(const String &sumtype, const String &set)
Define a weighting feature.
Definition: bindingObjects.hpp:2013
~QueryEval()
Destructor.
Definition: bindingObjects.hpp:2038
const String & value() const
Get the type value of this attribute.
Definition: bindingObjects.hpp:504
~QueryAnalyzeContext()
Destructor.
Definition: bindingObjects.hpp:1354
Query analyzer term with info about the field it originated from.
Definition: bindingObjects.hpp:1304
double weight() const
Get the weight of the vector rank.
Definition: bindingObjects.hpp:1659
DocumentClass(const DocumentClass &o)
Copy constructor.
Definition: bindingObjects.hpp:548
void setName(const String &name_)
Set the name of the aggregator function.
Definition: bindingObjects.hpp:264
const String & name() const
Get the name of the summary element.
Definition: bindingObjects.hpp:2130
void defineParameter(const String &name, const char *value)
Define a parameter used for weighting.
Definition: bindingObjects.hpp:1996
const String & mimeType() const
Get the MIME type of the document class.
Definition: bindingObjects.hpp:566
void defineParameter(const String &name, unsigned int value)
Define a parameter used for weighting.
Definition: bindingObjects.hpp:1980
Configuration describing the values passed to a weighting function.
Definition: bindingObjects.hpp:1951
Implements browsing the documents of a storage without weighting query, just with a restriction on me...
Definition: bindingObjects.hpp:2590
MetaData()
Default constructor.
Definition: bindingObjects.hpp:458
WeightingConfig()
Default constructor.
Definition: bindingObjects.hpp:1955
const String & type() const
Get the term type name.
Definition: bindingObjects.hpp:1320
Tokenizer(const String &name_, const String &arg_)
Definition: bindingObjects.hpp:122
unsigned int nofDocumentsVisited() const
Get the total number of matches that were visited (after applying ACL restrictions, but before applying other restrictions)
Definition: bindingObjects.hpp:2398
StatisticsMessage(const std::vector< DocumentFrequencyChange > &dfchglist, int nofdocs)
Constructor from elements.
Definition: bindingObjects.hpp:1558
Query evaluation program object representing an information retrieval scheme for documents in a stora...
Definition: bindingObjects.hpp:2028
Query analyzer context for analysing a multipart query.
Definition: bindingObjects.hpp:1344
Object representing a pattern match program.
Definition: bindingObjects.hpp:1028
Object holding the global context of the strus information retrieval engine.
Definition: bindingObjects.hpp:2701
Attribute()
Constructor.
Definition: bindingObjects.hpp:498
Normalizer(const String &name_, const String &arg1_, const String &arg2_)
Definition: bindingObjects.hpp:171
const String & docid() const
Get the document identifier (docid) of the document.
Definition: bindingObjects.hpp:665
Document()
Default constructor.
Definition: bindingObjects.hpp:587
const RankVector & ranks() const
Get the list of result elements.
Definition: bindingObjects.hpp:2401
PatternMatcher(const PatternMatcher &o)
Definition: bindingObjects.hpp:1031
Weighted vector (result of a query vector storage search)
Definition: bindingObjects.hpp:1643
Aggregator()
Default constructor.
Definition: bindingObjects.hpp:220
Normalizer(const String &name_)
Definition: bindingObjects.hpp:177
int index() const
Get the index (grouping) of the summary element if defined or -1.
Definition: bindingObjects.hpp:2136
Index length() const
Get the term length.
Definition: bindingObjects.hpp:420
Query program object representing a retrieval method for documents in a storage.
Definition: bindingObjects.hpp:2416
const StringVector & arguments() const
Definition: bindingObjects.hpp:183
Data object that represents single numeric property of a document that can be subject of retrieval or...
Definition: bindingObjects.hpp:448
Aggregator(const String &name_, const String &arg_)
Constructor.
Definition: bindingObjects.hpp:232
~VectorStorageSearcher()
Destructor.
Definition: bindingObjects.hpp:1694
Tokenizer(const Tokenizer &o)
Definition: bindingObjects.hpp:118
SummarizerConfig(const SummarizerConfig &o)
Copy constructor.
Definition: bindingObjects.hpp:1883
void defineParameter(const String &name, double value)
Define a parameter used for weighting.
Definition: bindingObjects.hpp:1988
const String & scheme() const
Get the scheme identifier of the document class.
Definition: bindingObjects.hpp:569
MetaData(const MetaData &o)
Copy constructor.
Definition: bindingObjects.hpp:455
~QueryAnalyzer()
Destructor.
Definition: bindingObjects.hpp:1189
DocumentClass()
Default constructor.
Definition: bindingObjects.hpp:534
Definition: bindingObjects.hpp:1812
Term()
Default constructor.
Definition: bindingObjects.hpp:407
FunctionVariableConfig()
Default constructor.
Definition: bindingObjects.hpp:1857
GlobalCounter nofdocs() const
Get the global total number of documents in the collection.
Definition: bindingObjects.hpp:2376
Configuration describing the values passed to a summarizer function.
Definition: bindingObjects.hpp:1877
GlobalStatistics(const GlobalStatistics &o)
Copy constructor.
Definition: bindingObjects.hpp:2372
Attribute(const Attribute &o)
Constructor.
Definition: bindingObjects.hpp:495
const String & value() const
Get the term value.
Definition: bindingObjects.hpp:413
unsigned int field() const
Get the term position.
Definition: bindingObjects.hpp:1318
Index index() const
Get the feature number ( >= 0) from this.
Definition: bindingObjects.hpp:1657
void addArgument(const String &arg_)
Definition: bindingObjects.hpp:140
const StringVector & arguments() const
Definition: bindingObjects.hpp:137
FunctionVariableConfig(const FunctionVariableConfig &o)
Copy constructor.
Definition: bindingObjects.hpp:1859
Object representing a sequence of query operations to get the set of postings (d,p) of an atomic term...
Definition: bindingObjects.hpp:2212
Analyzer object implementing a queue of analyze document tasks.
Definition: bindingObjects.hpp:971
void setEncoding(const String &encoding_)
Set the character set encoding of the document class.
Definition: bindingObjects.hpp:562
const String & encoding() const
Get the character set encoding of the document class.
Definition: bindingObjects.hpp:572
void addArgument(const String &arg_)
Add an argument to the aggregator function.
Definition: bindingObjects.hpp:267
Normalizer(const String &name_, const String &arg_)
Definition: bindingObjects.hpp:166
Term(const Term &o)
Copy constructor.
Definition: bindingObjects.hpp:404