tools/assistant/lib/fulltextsearch/qindexwriter_p.h
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
       
     4 ** All rights reserved.
       
     5 **
       
     6 ** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     7 ** All rights reserved.
       
     8 **
       
     9 ** This file may be used under the terms of the GNU Lesser General Public
       
    10 ** License version 2.1 as published by the Free Software Foundation and
       
    11 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    12 ** Please review the following information to ensure the GNU Lesser General
       
    13 ** Public License version 2.1 requirements will be met:
       
    14 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    15 **
       
    16 ****************************************************************************/
       
    17 
       
    18 #ifndef QINDEXWRITER_P_H
       
    19 #define QINDEXWRITER_P_H
       
    20 
       
    21 //
       
    22 //  W A R N I N G
       
    23 //  -------------
       
    24 //
       
    25 // This file is not part of the Qt API. It exists for the convenience
       
    26 // of the help generator tools. This header file may change from version
       
    27 // to version without notice, or even be removed.
       
    28 //
       
    29 // We mean it.
       
    30 //
       
    31 
       
    32 #include "qanalyzer_p.h"
       
    33 #include "qdocument_p.h"
       
    34 #include "qclucene_global_p.h"
       
    35 
       
    36 #include <QtCore/QString>
       
    37 #include <QtCore/QSharedDataPointer>
       
    38 #include <QtCore/QSharedData>
       
    39 
       
    40 CL_NS_DEF(index)
       
    41     class IndexWriter;
       
    42 CL_NS_END
       
    43 CL_NS_USE(index)
       
    44 
       
    45 QT_BEGIN_NAMESPACE
       
    46 
       
    47 class QCLuceneIndexReader;
       
    48 
       
    49 class QHELP_EXPORT QCLuceneIndexWriterPrivate : public QSharedData
       
    50 {
       
    51 public:
       
    52     QCLuceneIndexWriterPrivate();
       
    53     QCLuceneIndexWriterPrivate(const QCLuceneIndexWriterPrivate &other);
       
    54 
       
    55     ~QCLuceneIndexWriterPrivate();
       
    56 
       
    57     IndexWriter *writer;
       
    58     bool deleteCLuceneIndexWriter;
       
    59 
       
    60 private:
       
    61     QCLuceneIndexWriterPrivate &operator=(const QCLuceneIndexWriterPrivate &other);
       
    62 };
       
    63 
       
    64 class QHELP_EXPORT QCLuceneIndexWriter
       
    65 {
       
    66 public:
       
    67     enum {
       
    68         DEFAULT_MERGE_FACTOR = 10,
       
    69         COMMIT_LOCK_TIMEOUT = 10000,
       
    70         DEFAULT_MAX_BUFFERED_DOCS = 10,
       
    71         DEFAULT_MAX_FIELD_LENGTH = 10000,
       
    72         DEFAULT_TERM_INDEX_INTERVAL = 128,
       
    73         DEFAULT_MAX_MERGE_DOCS = 0x7FFFFFFFL
       
    74     };
       
    75 
       
    76 	QCLuceneIndexWriter(const QString &path, QCLuceneAnalyzer &analyzer, 
       
    77         bool create, bool closeDir = true);
       
    78     virtual ~QCLuceneIndexWriter();
       
    79 
       
    80 	void close();
       
    81 	void optimize();
       
    82     qint32 docCount();
       
    83     QCLuceneAnalyzer getAnalyzer();
       
    84 	
       
    85     void addIndexes(const QList<QCLuceneIndexReader*> &readers);
       
    86     void addDocument(QCLuceneDocument &doc, QCLuceneAnalyzer &analyzer);
       
    87 
       
    88 	qint32 getMaxFieldLength() const;
       
    89 	void setMaxFieldLength(qint32 value);
       
    90 	
       
    91     qint32 getMaxBufferedDocs() const;
       
    92     void setMaxBufferedDocs(qint32 value);
       
    93 	
       
    94 	qint64 getWriteLockTimeout() const;
       
    95     void setWriteLockTimeout(qint64 writeLockTimeout);
       
    96 	
       
    97     qint64 getCommitLockTimeout() const;
       
    98 	void setCommitLockTimeout(qint64 commitLockTimeout);
       
    99 
       
   100 	qint32 getMergeFactor() const;
       
   101 	void setMergeFactor(qint32 value);
       
   102 
       
   103     qint32 getTermIndexInterval() const;
       
   104 	void setTermIndexInterval(qint32 interval);
       
   105 	
       
   106 	qint32 getMinMergeDocs() const;
       
   107 	void setMinMergeDocs(qint32 value);
       
   108 
       
   109 	qint32 getMaxMergeDocs() const;
       
   110 	void setMaxMergeDocs(qint32 value);
       
   111 
       
   112     bool getUseCompoundFile() const;
       
   113 	void setUseCompoundFile(bool value);
       
   114 
       
   115 protected:
       
   116     QSharedDataPointer<QCLuceneIndexWriterPrivate> d;
       
   117 
       
   118 private:
       
   119     QCLuceneAnalyzer analyzer;
       
   120 };
       
   121 
       
   122 QT_END_NAMESPACE
       
   123 
       
   124 #endif  // QINDEXWRITER_P_H