00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _SOPRANO_CLUCENE_INDEX_H_
00023 #define _SOPRANO_CLUCENE_INDEX_H_
00024
00025 #include <QtCore/QString>
00026
00027 #include "statement.h"
00028 #include "soprano_export.h"
00029 #include "error.h"
00030 #include "iterator.h"
00031 #include "indexqueryhit.h"
00032
00033
00034 namespace lucene {
00035 namespace search {
00036 class Hits;
00037 class Query;
00038 }
00039 namespace analysis {
00040 class Analyzer;
00041 }
00042 namespace document {
00043 class Document;
00044 class Field;
00045 }
00046 }
00047
00048 namespace Soprano {
00049
00050 namespace Index {
00051
00075 class SOPRANO_INDEX_EXPORT CLuceneIndex : public Error::ErrorCache
00076 {
00077 public:
00079
00082 CLuceneIndex( lucene::analysis::Analyzer* analyzer = 0 );
00083
00089 ~CLuceneIndex();
00091
00093
00099 bool open( const QString& folder, bool force = false );
00100
00104 void close();
00105
00110 bool isOpen() const;
00112
00114
00120 int resourceCount() const;
00122
00124
00135 int startTransaction();
00136
00145 bool closeTransaction( int id );
00147
00149
00153 Error::ErrorCode addStatement( const Soprano::Statement& );
00154
00159 Error::ErrorCode removeStatement( const Soprano::Statement& );
00161
00163
00174 lucene::document::Document* documentForResource( const Node& resource );
00176
00178
00187 Iterator<QueryHit> search( const QString& query );
00188
00202 Iterator<QueryHit> search( lucene::search::Query* query );
00204
00205 #if 0
00206
00210 double getScore( const Soprano::Node& resource, const QString& query );
00211
00216 double getScore( const Soprano::Node& resource, lucene::search::Query* query );
00217 #endif
00218
00222 static Soprano::Node getResource( lucene::document::Document* document );
00223
00234 static QString defaultSearchField();
00235
00237
00240 void dump( QTextStream& ) const;
00241
00247 void clear();
00248
00255 void optimize();
00257
00258 private:
00259 class Private;
00260 Private* const d;
00261 };
00262 }
00263 }
00264
00265 #endif