index/cluceneindex.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of Soprano Project.
00003  *
00004  * Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public License
00017  * along with this library; see the file COPYING.LIB.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
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;
00241 
00242         private:
00243             class Private;
00244             Private* const d;
00245         };
00246     }
00247 }
00248 
00249 uint qHash( const Soprano::Node& node );
00250 
00251 #endif

Generated on Fri Mar 7 19:00:11 2008 for Soprano by  doxygen 1.5.4