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

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SortField.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 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 {
18 public:
23 SortField(const String& field, int32_t type, bool reverse = false);
24
31 SortField(const String& field, ParserPtr parser, bool reverse = false);
32
37 SortField(const String& field, const std::locale& locale, bool reverse = false);
38
43 SortField(const String& field, FieldComparatorSourcePtr comparator, bool reverse = false);
44
45 virtual ~SortField();
46
47 LUCENE_CLASS(SortField);
48
49 public:
51 static const int32_t SCORE;
52
54 static const int32_t DOC;
55
57 static const int32_t STRING;
58
60 static const int32_t INT;
61
63 static const int32_t FLOAT;
64
66 static const int32_t LONG;
67
69 static const int32_t DOUBLE;
70
72 static const int32_t SHORT;
73
76 static const int32_t CUSTOM;
77
79 static const int32_t BYTE;
80
83 static const int32_t STRING_VAL;
84
85 INTERNAL:
86 bool reverse; // defaults to natural order
87
88 String field;
89 int32_t type; // defaults to determining type dynamically
90 localePtr locale; // defaults to "natural order" (no Locale)
91 ParserPtr parser;
92
93 private:
95 FieldComparatorSourcePtr comparatorSource;
96
97 public:
99 static SortFieldPtr FIELD_SCORE();
100
102 static SortFieldPtr FIELD_DOC();
103
106 String getField();
107
110 int32_t getType();
111
113 localePtr getLocale();
114
118 ParserPtr getParser();
119
122 bool getReverse();
123
125 FieldComparatorSourcePtr getComparatorSource();
126
127 virtual String toString();
128
131 virtual bool equals(LuceneObjectPtr other);
132
133 virtual int32_t hashCode();
134
140 FieldComparatorPtr getComparator(int32_t numHits, int32_t sortPos);
141
142 protected:
144 void initFieldType(const String& field, int32_t type);
145 };
146 }
147
148 #endif

clucene.sourceforge.net