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 namespace Index {
00050
00074 class SOPRANO_INDEX_EXPORT CLuceneIndex : public Error::ErrorCache
00075 {
00076 public:
00078
00081 CLuceneIndex( lucene::analysis::Analyzer* analyzer = 0 );
00082
00088 ~CLuceneIndex();
00090
00092
00098 bool open( const QString& folder, bool force = false );
00099
00103 void close();
00104
00109 bool isOpen() const;
00111
00113
00119 int resourceCount() const;
00121
00123
00134 int startTransaction();
00135
00144 bool closeTransaction( int id );
00146
00148
00152 Error::ErrorCode addStatement( const Soprano::Statement& );
00153
00158 Error::ErrorCode removeStatement( const Soprano::Statement& );
00160
00162
00173 lucene::document::Document* documentForResource( const Node& resource );
00175
00177
00186 Iterator<QueryHit> search( const QString& query );
00187
00201 Iterator<QueryHit> search( lucene::search::Query* query );
00203
00204 #if 0
00205
00209 double getScore( const Soprano::Node& resource, const QString& query );
00210
00215 double getScore( const Soprano::Node& resource, lucene::search::Query* query );
00216 #endif
00217
00221 static Soprano::Node getResource( lucene::document::Document* document );
00222
00233 static QString defaultSearchField();
00234
00236
00239 void dump( QTextStream& ) const;
00240
00246 void clear();
00248
00249 private:
00250 class Private;
00251 Private* const d;
00252 };
00253 }
00254 }
00255
00256 uint qHash( const Soprano::Node& node );
00257
00258 #endif