Lucene++ - a full-featured, c++ search engine
API Documentation


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SortField.h
Go to the documentation of this file.
1 
2 // Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6 
7 #ifndef SORTFIELD_H
8 #define SORTFIELD_H
9 
10 #include "LuceneObject.h"
11 
12 namespace Lucene {
13 
16 class LPPAPI SortField : public LuceneObject {
17 public:
22  SortField(const String& field, int32_t type, bool reverse = false);
23 
30  SortField(const String& field, const ParserPtr& parser, bool reverse = false);
31 
36  SortField(const String& field, const std::locale& locale, bool reverse = false);
37 
42  SortField(const String& field, const FieldComparatorSourcePtr& comparator, bool reverse = false);
43 
44  virtual ~SortField();
45 
47 
48 public:
50  static const int32_t SCORE;
51 
53  static const int32_t DOC;
54 
56  static const int32_t STRING;
57 
59  static const int32_t INT;
60 
62  static const int32_t FLOAT;
63 
65  static const int32_t LONG;
66 
68  static const int32_t DOUBLE;
69 
71  static const int32_t SHORT;
72 
75  static const int32_t CUSTOM;
76 
78  static const int32_t BYTE;
79 
82  static const int32_t STRING_VAL;
83 
84 INTERNAL:
85  bool reverse; // defaults to natural order
86 
87  String field;
88  int32_t type; // defaults to determining type dynamically
89  localePtr locale; // defaults to "natural order" (no Locale)
91 
92 private:
94  FieldComparatorSourcePtr comparatorSource;
95 
96 public:
98  static SortFieldPtr FIELD_SCORE();
99 
101  static SortFieldPtr FIELD_DOC();
102 
105  String getField();
106 
109  int32_t getType();
110 
112  localePtr getLocale();
113 
117  ParserPtr getParser();
118 
121  bool getReverse();
122 
124  FieldComparatorSourcePtr getComparatorSource();
125 
126  virtual String toString();
127 
130  virtual bool equals(const LuceneObjectPtr& other);
131 
132  virtual int32_t hashCode();
133 
139  FieldComparatorPtr getComparator(int32_t numHits, int32_t sortPos);
140 
141 protected:
143  void initFieldType(const String& field, int32_t type);
144 };
145 
146 }
147 
148 #endif

clucene.sourceforge.net