summaryrefslogtreecommitdiffstats
path: root/tools/assistant/lib/fulltextsearch
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:18:55 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:18:55 (GMT)
commite5fcad302d86d316390c6b0f62759a067313e8a9 (patch)
treec2afbf6f1066b6ce261f14341cf6d310e5595bc1 /tools/assistant/lib/fulltextsearch
downloadQt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2
Long live Qt 4.5!
Diffstat (limited to 'tools/assistant/lib/fulltextsearch')
-rw-r--r--tools/assistant/lib/fulltextsearch/fulltextsearch.pri161
-rw-r--r--tools/assistant/lib/fulltextsearch/fulltextsearch.pro50
-rw-r--r--tools/assistant/lib/fulltextsearch/license.txt503
-rw-r--r--tools/assistant/lib/fulltextsearch/qanalyzer.cpp201
-rw-r--r--tools/assistant/lib/fulltextsearch/qanalyzer_p.h145
-rw-r--r--tools/assistant/lib/fulltextsearch/qclucene-config_p.h552
-rw-r--r--tools/assistant/lib/fulltextsearch/qclucene_global_p.h127
-rw-r--r--tools/assistant/lib/fulltextsearch/qdocument.cpp172
-rw-r--r--tools/assistant/lib/fulltextsearch/qdocument_p.h93
-rw-r--r--tools/assistant/lib/fulltextsearch/qfield.cpp163
-rw-r--r--tools/assistant/lib/fulltextsearch/qfield_p.h112
-rw-r--r--tools/assistant/lib/fulltextsearch/qfilter.cpp49
-rw-r--r--tools/assistant/lib/fulltextsearch/qfilter_p.h68
-rw-r--r--tools/assistant/lib/fulltextsearch/qhits.cpp86
-rw-r--r--tools/assistant/lib/fulltextsearch/qhits_p.h79
-rw-r--r--tools/assistant/lib/fulltextsearch/qindexreader.cpp161
-rw-r--r--tools/assistant/lib/fulltextsearch/qindexreader_p.h108
-rw-r--r--tools/assistant/lib/fulltextsearch/qindexwriter.cpp183
-rw-r--r--tools/assistant/lib/fulltextsearch/qindexwriter_p.h117
-rw-r--r--tools/assistant/lib/fulltextsearch/qquery.cpp350
-rw-r--r--tools/assistant/lib/fulltextsearch/qquery_p.h181
-rw-r--r--tools/assistant/lib/fulltextsearch/qqueryparser.cpp168
-rw-r--r--tools/assistant/lib/fulltextsearch/qqueryparser_p.h102
-rw-r--r--tools/assistant/lib/fulltextsearch/qreader.cpp94
-rw-r--r--tools/assistant/lib/fulltextsearch/qreader_p.h97
-rw-r--r--tools/assistant/lib/fulltextsearch/qsearchable.cpp195
-rw-r--r--tools/assistant/lib/fulltextsearch/qsearchable_p.h128
-rw-r--r--tools/assistant/lib/fulltextsearch/qsort.cpp89
-rw-r--r--tools/assistant/lib/fulltextsearch/qsort_p.h77
-rw-r--r--tools/assistant/lib/fulltextsearch/qterm.cpp126
-rw-r--r--tools/assistant/lib/fulltextsearch/qterm_p.h93
-rw-r--r--tools/assistant/lib/fulltextsearch/qtoken.cpp142
-rw-r--r--tools/assistant/lib/fulltextsearch/qtoken_p.h105
-rw-r--r--tools/assistant/lib/fulltextsearch/qtokenizer.cpp110
-rw-r--r--tools/assistant/lib/fulltextsearch/qtokenizer_p.h90
-rw-r--r--tools/assistant/lib/fulltextsearch/qtokenstream.cpp59
-rw-r--r--tools/assistant/lib/fulltextsearch/qtokenstream_p.h88
37 files changed, 5424 insertions, 0 deletions
diff --git a/tools/assistant/lib/fulltextsearch/fulltextsearch.pri b/tools/assistant/lib/fulltextsearch/fulltextsearch.pri
new file mode 100644
index 0000000..134678f
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/fulltextsearch.pri
@@ -0,0 +1,161 @@
+DEFINES += _BUILD_FOR_QT_ LUCENE_DISABLE_MEMTRACKING
+win32:DEFINES += _CRT_SECURE_NO_DEPRECATE _MT
+
+CLUCENEDIR = ../../../../src/3rdparty/clucene/src/CLucene
+
+INCLUDEPATH += . .. \
+ $$CLUCENEDIR \
+ $$CLUCENEDIR/../ \
+ $$CLUCENEDIR/analysis \
+ $$CLUCENEDIR/analysis/standard \
+ $$CLUCENEDIR/config \
+ $$CLUCENEDIR/debug \
+ $$CLUCENEDIR/document \
+ $$CLUCENEDIR/index \
+ $$CLUCENEDIR/queryParser \
+ $$CLUCENEDIR/search \
+ $$CLUCENEDIR/store \
+ $$CLUCENEDIR/util
+
+
+SOURCES += $$CLUCENEDIR/StdHeader.cpp \
+ $$CLUCENEDIR/analysis/AnalysisHeader.cpp \
+ $$CLUCENEDIR/analysis/Analyzers.cpp \
+ $$CLUCENEDIR/config/gunichartables.cpp \
+ $$CLUCENEDIR/config/repl_lltot.cpp \
+ $$CLUCENEDIR/config/repl_tcscasecmp.cpp \
+ $$CLUCENEDIR/config/repl_tcslwr.cpp \
+ $$CLUCENEDIR/config/repl_tcstod.cpp \
+ $$CLUCENEDIR/config/repl_tcstoll.cpp \
+ $$CLUCENEDIR/config/repl_tprintf.cpp \
+ $$CLUCENEDIR/config/threads.cpp \
+ $$CLUCENEDIR/config/utf8.cpp \
+ $$CLUCENEDIR/debug/condition.cpp \
+ $$CLUCENEDIR/debug/error.cpp \
+ $$CLUCENEDIR/debug/memtracking.cpp \
+ $$CLUCENEDIR/document/DateField.cpp \
+ $$CLUCENEDIR/document/Document.cpp \
+ $$CLUCENEDIR/document/Field.cpp \
+ $$CLUCENEDIR/index/CompoundFile.cpp \
+ $$CLUCENEDIR/index/DocumentWriter.cpp \
+ $$CLUCENEDIR/index/FieldInfos.cpp \
+ $$CLUCENEDIR/index/FieldsReader.cpp \
+ $$CLUCENEDIR/index/FieldsWriter.cpp \
+ $$CLUCENEDIR/index/IndexModifier.cpp \
+ $$CLUCENEDIR/index/IndexReader.cpp \
+ $$CLUCENEDIR/index/IndexWriter.cpp \
+ $$CLUCENEDIR/index/MultiReader.cpp \
+ $$CLUCENEDIR/index/SegmentInfos.cpp \
+ $$CLUCENEDIR/index/SegmentMergeInfo.cpp \
+ $$CLUCENEDIR/index/SegmentMergeQueue.cpp \
+ $$CLUCENEDIR/index/SegmentMerger.cpp \
+ $$CLUCENEDIR/index/SegmentReader.cpp \
+ $$CLUCENEDIR/index/SegmentTermDocs.cpp \
+ $$CLUCENEDIR/index/SegmentTermEnum.cpp \
+ $$CLUCENEDIR/index/SegmentTermPositions.cpp \
+ $$CLUCENEDIR/index/SegmentTermVector.cpp \
+ $$CLUCENEDIR/index/Term.cpp \
+ $$CLUCENEDIR/index/TermInfo.cpp \
+ $$CLUCENEDIR/index/TermInfosReader.cpp \
+ $$CLUCENEDIR/index/TermInfosWriter.cpp \
+ $$CLUCENEDIR/index/TermVectorReader.cpp \
+ $$CLUCENEDIR/index/TermVectorWriter.cpp \
+ $$CLUCENEDIR/queryParser/Lexer.cpp \
+ $$CLUCENEDIR/queryParser/MultiFieldQueryParser.cpp \
+ $$CLUCENEDIR/queryParser/QueryParser.cpp \
+ $$CLUCENEDIR/queryParser/QueryParserBase.cpp \
+ $$CLUCENEDIR/queryParser/QueryToken.cpp \
+ $$CLUCENEDIR/queryParser/TokenList.cpp \
+ $$CLUCENEDIR/search/BooleanQuery.cpp \
+ $$CLUCENEDIR/search/BooleanScorer.cpp \
+ $$CLUCENEDIR/search/CachingWrapperFilter.cpp \
+ $$CLUCENEDIR/search/ChainedFilter.cpp \
+ $$CLUCENEDIR/search/ConjunctionScorer.cpp \
+ $$CLUCENEDIR/search/DateFilter.cpp \
+ $$CLUCENEDIR/search/ExactPhraseScorer.cpp \
+ $$CLUCENEDIR/search/Explanation.cpp \
+ $$CLUCENEDIR/search/FieldCache.cpp \
+ $$CLUCENEDIR/search/FieldCacheImpl.cpp \
+ $$CLUCENEDIR/search/FieldDocSortedHitQueue.cpp \
+ $$CLUCENEDIR/search/FieldSortedHitQueue.cpp \
+ $$CLUCENEDIR/search/FilteredTermEnum.cpp \
+ $$CLUCENEDIR/search/FuzzyQuery.cpp \
+ $$CLUCENEDIR/search/HitQueue.cpp \
+ $$CLUCENEDIR/search/Hits.cpp \
+ $$CLUCENEDIR/search/IndexSearcher.cpp \
+ $$CLUCENEDIR/search/MultiSearcher.cpp \
+ $$CLUCENEDIR/search/MultiTermQuery.cpp \
+ $$CLUCENEDIR/search/PhrasePositions.cpp \
+ $$CLUCENEDIR/search/PhraseQuery.cpp \
+ $$CLUCENEDIR/search/PhraseScorer.cpp \
+ $$CLUCENEDIR/search/PrefixQuery.cpp \
+ $$CLUCENEDIR/search/QueryFilter.cpp \
+ $$CLUCENEDIR/search/RangeFilter.cpp \
+ $$CLUCENEDIR/search/RangeQuery.cpp \
+ $$CLUCENEDIR/search/SearchHeader.cpp \
+ $$CLUCENEDIR/search/Similarity.cpp \
+ $$CLUCENEDIR/search/SloppyPhraseScorer.cpp \
+ $$CLUCENEDIR/search/Sort.cpp \
+ $$CLUCENEDIR/search/TermQuery.cpp \
+ $$CLUCENEDIR/search/TermScorer.cpp \
+ $$CLUCENEDIR/search/WildcardQuery.cpp \
+ $$CLUCENEDIR/search/WildcardTermEnum.cpp \
+ $$CLUCENEDIR/store/FSDirectory.cpp \
+ $$CLUCENEDIR/store/IndexInput.cpp \
+ $$CLUCENEDIR/store/IndexOutput.cpp \
+ $$CLUCENEDIR/store/Lock.cpp \
+ $$CLUCENEDIR/store/MMapInput.cpp \
+ $$CLUCENEDIR/store/RAMDirectory.cpp \
+ $$CLUCENEDIR/store/TransactionalRAMDirectory.cpp \
+ $$CLUCENEDIR/util/BitSet.cpp \
+ $$CLUCENEDIR/util/Equators.cpp \
+ $$CLUCENEDIR/util/FastCharStream.cpp \
+ $$CLUCENEDIR/util/fileinputstream.cpp \
+ $$CLUCENEDIR/util/Misc.cpp \
+ $$CLUCENEDIR/util/Reader.cpp \
+ $$CLUCENEDIR/util/StringBuffer.cpp \
+ $$CLUCENEDIR/util/StringIntern.cpp \
+ $$CLUCENEDIR/util/ThreadLocal.cpp \
+ $$CLUCENEDIR/analysis/standard/StandardAnalyzer.cpp \
+ $$CLUCENEDIR/analysis/standard/StandardFilter.cpp \
+ $$CLUCENEDIR/analysis/standard/StandardTokenizer.cpp
+
+
+#Header files
+HEADERS += qclucene_global_p.h \
+ qclucene-config_p.h \
+ qanalyzer_p.h \
+ qtokenizer_p.h \
+ qtoken_p.h \
+ qtokenstream_p.h \
+ qdocument_p.h \
+ qfield_p.h \
+ qindexreader_p.h \
+ qindexwriter_p.h \
+ qterm_p.h \
+ qqueryparser_p.h \
+ qfilter_p.h \
+ qhits_p.h \
+ qsearchable_p.h \
+ qsort_p.h \
+ qquery_p.h \
+ qreader_p.h
+
+
+#Source files
+SOURCES += qanalyzer.cpp \
+ qtokenizer.cpp \
+ qtoken.cpp \
+ qtokenstream.cpp \
+ qdocument.cpp \
+ qfield.cpp \
+ qindexreader.cpp \
+ qindexwriter.cpp \
+ qterm.cpp \
+ qqueryparser.cpp \
+ qfilter.cpp \
+ qhits.cpp \
+ qsearchable.cpp \
+ qsort.cpp \
+ qquery.cpp \
+ qreader.cpp
diff --git a/tools/assistant/lib/fulltextsearch/fulltextsearch.pro b/tools/assistant/lib/fulltextsearch/fulltextsearch.pro
new file mode 100644
index 0000000..e0cd13a
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/fulltextsearch.pro
@@ -0,0 +1,50 @@
+
+QMAKE_TARGET_PRODUCT = QtCLucene
+QMAKE_TARGET_DESCRIPTION = QtCLucene full text search library wrapper.
+#if qt is built with frameworks in debug, we must build QtCLucene in debug and release
+#that's a similar logic as in qbase.pri
+mac:!static:contains(QT_CONFIG, qt_framework) {
+ CONFIG(debug, debug|release) {
+ !build_pass:CONFIG += build_all
+ }
+}
+QT_CONFIG -= qt_framework
+QT -= gui
+TEMPLATE = lib
+TARGET = QtCLucene
+DEFINES += QHELP_LIB
+include(../../../../src/qbase.pri)
+include(fulltextsearch.pri)
+
+CONFIG += qt warn_off
+contains(QT_CONFIG, reduce_exports) {
+ CONFIG += hide_symbols
+ # workaround for compiler errors on Ubuntu
+ linux*-g++*:DEFINES += _GLIBCXX_EXTERN_TEMPLATE=0
+}
+
+unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+
+# impossible to disable exceptions in clucene atm
+CONFIG(exceptions_off) {
+ CONFIG -= exceptions_off
+ CONFIG += exceptions
+ !win32|win32-g++ {
+ QMAKE_CFLAGS -= -fno-exceptions
+ QMAKE_CXXFLAGS -= -fno-exceptions
+ QMAKE_LFLAGS -= -fno-exceptions
+ QMAKE_CFLAGS += -fexceptions
+ QMAKE_CXXFLAGS += -fexceptions
+ QMAKE_LFLAGS += -fexceptions
+ }
+}
+
+win32-msvc.net | win32-msvc2* {
+ QMAKE_CFLAGS_RELEASE -= -O2
+ QMAKE_CXXFLAGS_RELEASE -= -O2
+}
+
+# the following define could be set globally in case we need it elsewhere
+solaris* {
+ DEFINES += Q_SOLARIS_VERSION=$$system(uname -r | sed -e 's/5\.//')
+}
diff --git a/tools/assistant/lib/fulltextsearch/license.txt b/tools/assistant/lib/fulltextsearch/license.txt
new file mode 100644
index 0000000..9ef3d70
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/license.txt
@@ -0,0 +1,503 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
diff --git a/tools/assistant/lib/fulltextsearch/qanalyzer.cpp b/tools/assistant/lib/fulltextsearch/qanalyzer.cpp
new file mode 100644
index 0000000..e19a075
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qanalyzer.cpp
@@ -0,0 +1,201 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qanalyzer_p.h"
+#include "qclucene_global_p.h"
+
+#include <CLucene.h>
+#include <CLucene/analysis/AnalysisHeader.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneAnalyzerPrivate::QCLuceneAnalyzerPrivate()
+ : QSharedData()
+{
+ analyzer = 0;
+ deleteCLuceneAnalyzer = true;
+}
+
+QCLuceneAnalyzerPrivate::QCLuceneAnalyzerPrivate(const QCLuceneAnalyzerPrivate &other)
+ : QSharedData()
+{
+ analyzer = _CL_POINTER(other.analyzer);
+}
+
+QCLuceneAnalyzerPrivate::~QCLuceneAnalyzerPrivate()
+{
+ if (deleteCLuceneAnalyzer)
+ _CLDECDELETE(analyzer);
+}
+
+
+QCLuceneAnalyzer::QCLuceneAnalyzer()
+ : d(new QCLuceneAnalyzerPrivate())
+{
+ //nothing todo, private
+}
+
+QCLuceneAnalyzer::~QCLuceneAnalyzer()
+{
+ // nothing todo
+}
+
+qint32 QCLuceneAnalyzer::positionIncrementGap(const QString &fieldName) const
+{
+ Q_UNUSED(fieldName);
+ return 0;
+}
+
+QCLuceneTokenStream QCLuceneAnalyzer::tokenStream(const QString &fieldName,
+ const QCLuceneReader &reader) const
+{
+ TCHAR *fName = QStringToTChar(fieldName);
+ QCLuceneTokenStream tokenStream;
+ tokenStream.d->tokenStream = d->analyzer->tokenStream(fName, reader.d->reader);
+ delete [] fName;
+
+ return tokenStream;
+}
+
+
+QCLuceneStandardAnalyzer::QCLuceneStandardAnalyzer()
+ : QCLuceneAnalyzer()
+{
+ d->analyzer = new lucene::analysis::standard::StandardAnalyzer();
+}
+
+QCLuceneStandardAnalyzer::~QCLuceneStandardAnalyzer()
+{
+ // nothing todo
+}
+
+QCLuceneStandardAnalyzer::QCLuceneStandardAnalyzer(const QStringList &stopWords)
+{
+ const TCHAR **tArray = new const TCHAR*[stopWords.count() +1];
+
+ for(int i = 0; i < stopWords.count(); ++i) {
+ TCHAR *stopWord = QStringToTChar(stopWords.at(i));
+ tArray[i] = STRDUP_TtoT(stopWord);
+ delete [] stopWord;
+ }
+ tArray[stopWords.count()] = 0;
+
+ d->analyzer = new lucene::analysis::standard::StandardAnalyzer(tArray);
+}
+
+
+QCLuceneWhitespaceAnalyzer::QCLuceneWhitespaceAnalyzer()
+ : QCLuceneAnalyzer()
+{
+ d->analyzer = new lucene::analysis::WhitespaceAnalyzer();
+}
+
+QCLuceneWhitespaceAnalyzer::~QCLuceneWhitespaceAnalyzer()
+{
+ // nothing todo
+}
+
+
+QCLuceneSimpleAnalyzer::QCLuceneSimpleAnalyzer()
+ : QCLuceneAnalyzer()
+{
+ d->analyzer = new lucene::analysis::SimpleAnalyzer();
+}
+
+QCLuceneSimpleAnalyzer::~QCLuceneSimpleAnalyzer()
+{
+ // nothing todo
+}
+
+
+QCLuceneStopAnalyzer::QCLuceneStopAnalyzer()
+ : QCLuceneAnalyzer()
+{
+ d->analyzer = new lucene::analysis::StopAnalyzer();
+}
+
+QCLuceneStopAnalyzer::~QCLuceneStopAnalyzer()
+{
+ // nothing todo
+}
+
+QCLuceneStopAnalyzer::QCLuceneStopAnalyzer(const QStringList &stopWords)
+ : QCLuceneAnalyzer()
+{
+ const TCHAR **tArray = new const TCHAR*[stopWords.count() +1];
+
+ for(int i = 0; i < stopWords.count(); ++i) {
+ TCHAR *stopWord = QStringToTChar(stopWords.at(i));
+ tArray[i] = STRDUP_TtoT(stopWord);
+ delete [] stopWord;
+ }
+ tArray[stopWords.count()] = 0;
+
+ d->analyzer = new lucene::analysis::StopAnalyzer(tArray);
+}
+
+QStringList QCLuceneStopAnalyzer::englishStopWords() const
+{
+ QStringList stopWordList;
+
+ const TCHAR** stopWords = lucene::analysis::StopAnalyzer::ENGLISH_STOP_WORDS;
+ for (qint32 i = 0; stopWords[i] != 0; ++i)
+ stopWordList.append(TCharToQString(stopWords[i]));
+
+ return stopWordList;
+}
+
+
+QCLuceneKeywordAnalyzer::QCLuceneKeywordAnalyzer()
+ : QCLuceneAnalyzer()
+{
+ d->analyzer = new lucene::analysis::KeywordAnalyzer();
+}
+
+QCLuceneKeywordAnalyzer::~QCLuceneKeywordAnalyzer()
+{
+ // nothing todo
+}
+
+
+QCLucenePerFieldAnalyzerWrapper::QCLucenePerFieldAnalyzerWrapper(
+ QCLuceneAnalyzer *defaultAnalyzer)
+ : QCLuceneAnalyzer()
+{
+ d->analyzer = new
+ lucene::analysis::PerFieldAnalyzerWrapper(defaultAnalyzer->d->analyzer);
+
+ analyzers.append(defaultAnalyzer);
+ defaultAnalyzer->d->deleteCLuceneAnalyzer = false;
+}
+
+QCLucenePerFieldAnalyzerWrapper::~QCLucenePerFieldAnalyzerWrapper()
+{
+ qDeleteAll(analyzers);
+}
+
+void QCLucenePerFieldAnalyzerWrapper::addAnalyzer(const QString &fieldName,
+ QCLuceneAnalyzer *analyzer)
+{
+ lucene::analysis::PerFieldAnalyzerWrapper *analyzerWrapper =
+ static_cast<lucene::analysis::PerFieldAnalyzerWrapper*> (d->analyzer);
+
+ if (analyzerWrapper == 0)
+ return;
+
+ analyzers.append(analyzer);
+ analyzer->d->deleteCLuceneAnalyzer = false;
+
+ TCHAR *fName = QStringToTChar(fieldName);
+ analyzerWrapper->addAnalyzer(fName, analyzer->d->analyzer);
+ delete [] fName;
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qanalyzer_p.h b/tools/assistant/lib/fulltextsearch/qanalyzer_p.h
new file mode 100644
index 0000000..c0b94f4
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qanalyzer_p.h
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QANALYZER_P_H
+#define QANALYZER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qreader_p.h"
+#include "qtokenstream_p.h"
+#include "qclucene_global_p.h"
+
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(analysis)
+ class Analyzer;
+CL_NS_END
+CL_NS_USE(analysis)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneIndexWriter;
+class QCLuceneQueryParser;
+class QCLuceneStopAnalyzer;
+class QCLuceneSimpleAnalyzer;
+class QCLuceneKeywordAnalyzer;
+class QCLuceneStandardAnalyzer;
+class QCLuceneWhitespaceAnalyzer;
+class QCLucenePerFieldAnalyzerWrapper;
+
+class QHELP_EXPORT QCLuceneAnalyzerPrivate : public QSharedData
+{
+public:
+ QCLuceneAnalyzerPrivate();
+ QCLuceneAnalyzerPrivate(const QCLuceneAnalyzerPrivate &other);
+
+ ~QCLuceneAnalyzerPrivate();
+
+ Analyzer *analyzer;
+ bool deleteCLuceneAnalyzer;
+
+private:
+ QCLuceneAnalyzerPrivate &operator=(const QCLuceneAnalyzerPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneAnalyzer
+{
+public:
+ virtual ~QCLuceneAnalyzer();
+
+ qint32 positionIncrementGap(const QString &fieldName) const;
+ QCLuceneTokenStream tokenStream(const QString &fieldName,
+ const QCLuceneReader &reader) const;
+
+protected:
+ friend class QCLuceneIndexWriter;
+ friend class QCLuceneQueryParser;
+ friend class QCLuceneStopAnalyzer;
+ friend class QCLuceneSimpleAnalyzer;
+ friend class QCLuceneKeywordAnalyzer;
+ friend class QCLuceneStandardAnalyzer;
+ friend class QCLuceneWhitespaceAnalyzer;
+ friend class QCLucenePerFieldAnalyzerWrapper;
+ QSharedDataPointer<QCLuceneAnalyzerPrivate> d;
+
+private:
+ QCLuceneAnalyzer();
+};
+
+class QHELP_EXPORT QCLuceneStandardAnalyzer : public QCLuceneAnalyzer
+{
+public:
+ QCLuceneStandardAnalyzer();
+ QCLuceneStandardAnalyzer(const QStringList &stopWords);
+
+ ~QCLuceneStandardAnalyzer();
+};
+
+class QHELP_EXPORT QCLuceneWhitespaceAnalyzer : public QCLuceneAnalyzer
+{
+public:
+ QCLuceneWhitespaceAnalyzer();
+ ~QCLuceneWhitespaceAnalyzer();
+};
+
+class QHELP_EXPORT QCLuceneSimpleAnalyzer : public QCLuceneAnalyzer
+{
+public:
+ QCLuceneSimpleAnalyzer();
+ ~QCLuceneSimpleAnalyzer();
+};
+
+class QHELP_EXPORT QCLuceneStopAnalyzer : public QCLuceneAnalyzer
+{
+public:
+ QCLuceneStopAnalyzer();
+ QCLuceneStopAnalyzer(const QStringList &stopWords);
+
+ ~QCLuceneStopAnalyzer();
+
+ QStringList englishStopWords() const;
+};
+
+class QHELP_EXPORT QCLuceneKeywordAnalyzer : public QCLuceneAnalyzer
+{
+public:
+ QCLuceneKeywordAnalyzer();
+ ~QCLuceneKeywordAnalyzer();
+};
+
+class QHELP_EXPORT QCLucenePerFieldAnalyzerWrapper : public QCLuceneAnalyzer
+{
+public:
+ QCLucenePerFieldAnalyzerWrapper(QCLuceneAnalyzer *defaultAnalyzer);
+ ~QCLucenePerFieldAnalyzerWrapper();
+
+ void addAnalyzer(const QString &fieldName, QCLuceneAnalyzer *analyzer);
+
+private:
+ QList<QCLuceneAnalyzer*> analyzers;
+};
+
+QT_END_NAMESPACE
+
+#endif // QANALYZER_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qclucene-config_p.h b/tools/assistant/lib/fulltextsearch/qclucene-config_p.h
new file mode 100644
index 0000000..b3befbe
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qclucene-config_p.h
@@ -0,0 +1,552 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QCLUCENE_CONFIG_P_H
+#define QCLUCENE_CONFIG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+
+#ifndef _SRC_CLUCENE_CLUCENE_CONFIG_H
+#define _SRC_CLUCENE_CLUCENE_CONFIG_H 1
+
+/*
+src/CLucene/clucene-config.h.
+Generated
+automatically
+at
+end
+of
+configure.
+*/
+/* config.h.tmp. Generated by configure. */
+/* config.h.tmp.in. Generated from configure.ac by autoheader. */
+
+/* Disable multithreading */
+/* #undef _CL_DISABLE_MULTITHREADING */
+
+/* Define to 1 if you have the <algorithm> header file. */
+#ifndef _CL_HAVE_ALGORITHM
+#define _CL_HAVE_ALGORITHM 1
+#endif
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#ifndef _CL_HAVE_CTYPE_H
+#define _CL_HAVE_CTYPE_H 1
+#endif
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#ifndef _CL_HAVE_DIRENT_H
+#define _CL_HAVE_DIRENT_H 1
+#endif
+
+#if !defined (__MINGW32__)
+ /* Define to 1 if you have the <dlfcn.h> header file. */
+# ifndef _CL_HAVE_DLFCN_H
+# define _CL_HAVE_DLFCN_H 1
+# endif
+#endif
+
+/* Define to 1 if you have the <errno.h> header file. */
+#ifndef _CL_HAVE_ERRNO_H
+#define _CL_HAVE_ERRNO_H 1
+#endif
+
+#if !defined(__SUNPRO_CC) && !defined(__SUNPRO_C)
+ /* Define to 1 if you have the <ext/hash_map> header file. */
+# ifndef _CL_HAVE_EXT_HASH_MAP
+# define _CL_HAVE_EXT_HASH_MAP 1
+# endif
+
+ /* Define to 1 if you have the <ext/hash_set> header file. */
+# ifndef _CL_HAVE_EXT_HASH_SET
+# define _CL_HAVE_EXT_HASH_SET 1
+# endif
+#endif
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#ifndef _CL_HAVE_FCNTL_H
+#define _CL_HAVE_FCNTL_H 1
+#endif
+
+#if !defined(__xlC__) && !defined(__xlc__) && !defined (__MINGW32__) && \
+ !defined(__HP_aCC) && !defined(__SUNPRO_C) && !defined(__SUNPRO_CC) || \
+ defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x550) || (defined(__HP_aCC) && defined(__ia64))
+ /* Define to 1 if the system has the type `float_t'. */
+# ifndef _CL_HAVE_FLOAT_T
+# define _CL_HAVE_FLOAT_T 1
+# endif
+#endif
+
+/* Define to 1 if you have the <functional> header file. */
+#ifndef _CL_HAVE_FUNCTIONAL
+#define _CL_HAVE_FUNCTIONAL 1
+#endif
+
+/* Does not support new float byte<->float conversions */
+#ifndef _CL_HAVE_FUNCTIONING_FLOAT_BYTE
+#define _CL_HAVE_FUNCTIONING_FLOAT_BYTE
+#endif
+
+/* Define to 1 if you have the `getpagesize' function. */
+#ifndef _CL_HAVE_GETPAGESIZE
+#define _CL_HAVE_GETPAGESIZE 1
+#endif
+
+/* Define to 1 if you have the <hash_map> header file. */
+/* #undef _CL_HAVE_HASH_MAP */
+
+/* Define to 1 if you have the <hash_set> header file. */
+/* #undef _CL_HAVE_HASH_SET */
+
+/* Define to 1 if the system has the type `intptr_t'. */
+#ifndef _CL_HAVE_INTPTR_T
+#define _CL_HAVE_INTPTR_T 1
+#endif
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#ifndef _CL_HAVE_INTTYPES_H
+#define _CL_HAVE_INTTYPES_H 1
+#endif
+
+/* Define to 1 if you have the <list> header file. */
+#ifndef _CL_HAVE_LIST
+#define _CL_HAVE_LIST 1
+#endif
+
+/* Define to 1 if you have the `lltoa' function. */
+/* #undef _CL_HAVE_LLTOA */
+
+#if defined(__MINGW32__)
+ /* Define to 1 if you have the `lltow' function. */
+# ifndef _CL_HAVE_LLTOW
+# define _CL_HAVE_LLTOW 1
+# endif
+#endif
+
+#if !defined(__SUNPRO_CC) && !defined(__SUNPRO_C) && !defined(__xlC__) && !defined(__xlc__)
+ /* Define to 1 if long double works and has more range or precision than double. */
+# ifndef _CL_HAVE_LONG_DOUBLE
+# define _CL_HAVE_LONG_DOUBLE 1
+# endif
+#endif
+
+/* Define to 1 if you have the <map> header file. */
+#ifndef _CL_HAVE_MAP
+#define _CL_HAVE_MAP 1
+#endif
+
+/* Define to 1 if you have the <math.h> header file. */
+#ifndef _CL_HAVE_MATH_H
+#define _CL_HAVE_MATH_H 1
+#endif
+
+/* Define to 1 if you have the <memory.h> header file. */
+#ifndef _CL_HAVE_MEMORY_H
+#define _CL_HAVE_MEMORY_H 1
+#endif
+
+#if !defined(__MINGW32__) && !defined(__HP_aCC) && !defined(__xlC__) && !defined(__xlc__)
+ /* Define to 1 if you have a working `mmap' system call. */
+# ifndef _CL_HAVE_MMAP
+# define _CL_HAVE_MMAP 1
+# endif
+#endif
+
+/* define if the compiler implements namespaces */
+#ifndef _CL_HAVE_NAMESPACES
+#define _CL_HAVE_NAMESPACES
+#endif
+
+#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) || defined(__HP_aCC) || defined(__xlC__) || defined(__xlc__)
+ /* Define if you have the nanosleep function */
+# ifndef _CL_HAVE_NANOSLEEP
+# define _CL_HAVE_NANOSLEEP 1
+# endif
+#endif
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef _CL_HAVE_NDIR_H */
+
+/* Does not support new float byte<->float conversions */
+/* #undef _CL_HAVE_NO_FLOAT_BYTE */
+
+/* Does not support try/catch blocks */
+/* #undef _CL_HAVE_NO_FUNCTION_TRY_BLOCKS */
+
+/* Define to 1 if you have the `printf' function. */
+#ifndef _CL_HAVE_PRINTF
+#define _CL_HAVE_PRINTF 1
+#endif
+
+#if !defined(__MINGW32__)
+ /* Define if you have POSIX threads libraries and header files. */
+# ifndef _CL_HAVE_PTHREAD
+# define _CL_HAVE_PTHREAD 1
+# endif
+#endif
+
+/* Define if recursive pthread mutexes are available */
+/* #undef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE */
+
+/* Define to 1 if you have the <set> header file. */
+#ifndef _CL_HAVE_SET
+#define _CL_HAVE_SET 1
+#endif
+
+/* Define to 1 if you have the `snprintf' function. */
+#ifndef _CL_HAVE_SNPRINTF
+#define _CL_HAVE_SNPRINTF 1
+#endif
+
+/* Defined if the snprintf overflow test fails */
+/* #undef _CL_HAVE_SNPRINTF_BUG */
+
+/* Define to 1 if you have the `snwprintf' function. */
+/* #undef _CL_HAVE_SNWPRINTF */
+
+#if !defined(__HP_aCC) && !defined(__SUNPRO_CC) && !defined(__SUNPRO_C)
+ /* define if the compiler supports ISO C++ standard library */
+# ifndef _CL_HAVE_STD
+# define _CL_HAVE_STD
+# endif
+#endif
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#ifndef _CL_HAVE_STDARG_H
+#define _CL_HAVE_STDARG_H 1
+#endif
+
+/* x */
+#ifndef _CL_HAVE_STDEXCEPT
+#define _CL_HAVE_STDEXCEPT
+#endif
+
+#if !defined(__SUNPRO_CC) && !defined(__SUNPRO_C) && !defined(__HP_aCC) && \
+ !defined(__xlC__) && !defined(__xlc__)
+ /* Define to 1 if you have the <stdint.h> header file. */
+# ifndef _CL_HAVE_STDINT_H
+# define _CL_HAVE_STDINT_H 1
+# endif
+#endif
+
+#if !defined(__HP_aCC)
+ /* Define to 1 if you have the <stdlib.h> header file. */
+# ifndef _CL_HAVE_STDLIB_H
+# define _CL_HAVE_STDLIB_H 1
+# endif
+
+ /* define if the compiler supports Standard Template Library */
+# ifndef _CL_HAVE_STL
+# define _CL_HAVE_STL
+# endif
+#endif
+
+/* Define to 1 if you have the <strings.h> header file. */
+#ifndef _CL_HAVE_STRINGS_H
+#define _CL_HAVE_STRINGS_H 1
+#endif
+
+/* Define to 1 if you have the <string.h> header file. */
+#ifndef _CL_HAVE_STRING_H
+#define _CL_HAVE_STRING_H 1
+#endif
+
+/* Define to 1 if you have the `strlwr' function. */
+/* #undef _CL_HAVE_STRLWR */
+
+/* Define to 1 if you have the `strtoll' function. */
+/* #undef _CL_HAVE_STRTOLL */
+
+/* Define to 1 if you have the `strupr' function. */
+/* #undef _CL_HAVE_STRUPR */
+
+/* Defined if the swprintf test fails */
+#ifndef _CL_HAVE_SWPRINTF_BUG
+#define _CL_HAVE_SWPRINTF_BUG
+#endif
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
+/* #undef _CL_HAVE_SYS_DIR_H */
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+/* #undef _CL_HAVE_SYS_NDIR_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#ifndef _CL_HAVE_SYS_STAT_H
+#define _CL_HAVE_SYS_STAT_H 1
+#endif
+
+/* Define to 1 if you have the <sys/timeb.h> header file. */
+#ifndef _CL_HAVE_SYS_TIMEB_H
+#define _CL_HAVE_SYS_TIMEB_H 1
+#endif
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#ifndef _CL_HAVE_SYS_TYPES_H
+#define _CL_HAVE_SYS_TYPES_H 1
+#endif
+
+// Do not use the tchar.h that ships with mingw, this causes the qt build to
+// fail (211547, 211401, etc...), reuse the replacement as with any other compiler
+// #if defined(__MINGW32__)
+// /* Define to 1 if you have the <tchar.h> header file. */
+// # ifndef _CL_HAVE_TCHAR_H
+// # define _CL_HAVE_TCHAR_H 1
+// # endif
+// #endif
+
+#if defined(__MINGW32__) || defined(__SUNPRO_CC) || defined(__SUNPRO_C)
+ /* Define to 1 if you have the `tell' function. */
+# ifndef _CL_HAVE_TELL
+# define _CL_HAVE_TELL 1
+# endif
+#endif
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#ifndef _CL_HAVE_UNISTD_H
+#define _CL_HAVE_UNISTD_H 1
+#endif
+
+/* Define to 1 if you have the <vector> header file. */
+#ifndef _CL_HAVE_VECTOR
+#define _CL_HAVE_VECTOR 1
+#endif
+
+/* Define to 1 if you have the `vsnwprintf' function. */
+/* #undef _CL_HAVE_VSNWPRINTF */
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#ifndef _CL_HAVE_WCHAR_H
+#define _CL_HAVE_WCHAR_H 1
+#endif
+
+/* Define to 1 if the system has the type `wchar_t'. */
+#ifndef _CL_HAVE_WCHAR_T
+#define _CL_HAVE_WCHAR_T 1
+#endif
+
+#if !defined(__SUNPRO_CC) && !defined(__SUNPRO_C) && !defined(__MINGW32__) && \
+ !defined(Q_OS_MAC) && !defined(__HP_aCC)
+ /* Define to 1 if you have the `wcscasecmp' function. */
+# ifndef _CL_HAVE_WCSCASECMP
+# define _CL_HAVE_WCSCASECMP 1
+# endif
+#endif
+
+/* Define to 1 if you have the `wcscat' function. */
+#ifndef _CL_HAVE_WCSCAT
+#define _CL_HAVE_WCSCAT 1
+#endif
+
+/* Define to 1 if you have the `wcschr' function. */
+#ifndef _CL_HAVE_WCSCHR
+#define _CL_HAVE_WCSCHR 1
+#endif
+
+/* Define to 1 if you have the `wcscmp' function. */
+#ifndef _CL_HAVE_WCSCMP
+#define _CL_HAVE_WCSCMP 1
+#endif
+
+/* Define to 1 if you have the `wcscpy' function. */
+#ifndef _CL_HAVE_WCSCPY
+#define _CL_HAVE_WCSCPY 1
+#endif
+
+/* Define to 1 if you have the `wcscspn' function. */
+#ifndef _CL_HAVE_WCSCSPN
+#define _CL_HAVE_WCSCSPN 1
+#endif
+
+#if defined(__MINGW32__)
+ /* Define to 1 if you have the `wcsicmp' function. */
+# ifndef _CL_HAVE_WCSICMP
+# define _CL_HAVE_WCSICMP 1
+# endif
+#endif
+
+/* Define to 1 if you have the `wcslen' function. */
+#ifndef _CL_HAVE_WCSLEN
+#define _CL_HAVE_WCSLEN 1
+#endif
+
+/* Define to 1 if you have the `wcsncmp' function. */
+#ifndef _CL_HAVE_WCSNCMP
+#define _CL_HAVE_WCSNCMP 1
+#endif
+
+/* Define to 1 if you have the `wcsncpy' function. */
+#ifndef _CL_HAVE_WCSNCPY
+#define _CL_HAVE_WCSNCPY 1
+#endif
+
+/* Define to 1 if you have the `wcsstr' function. */
+#ifndef _CL_HAVE_WCSSTR
+#define _CL_HAVE_WCSSTR 1
+#endif
+
+/* Define to 1 if you have the `wcstod' function. */
+#ifndef _CL_HAVE_WCSTOD
+#define _CL_HAVE_WCSTOD 1
+#endif
+
+#if !defined(__SUNPRO_CC) && !defined(__SUNPRO_C) && !defined(__HP_aCC)
+ /* Define to 1 if you have the `wcstoll' function. */
+# ifndef _CL_HAVE_WCSTOLL
+# define _CL_HAVE_WCSTOLL 1
+# endif
+#endif
+
+#if defined(__MINGW32__)
+ /* Define to 1 if you have the `wcsupr' function. */
+# ifndef _CL_HAVE_WCSUPR
+# define _CL_HAVE_WCSUPR 1
+# endif
+#endif
+
+#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) || defined(__HP_aCC)
+ /* Define to 1 if you have a functioning <wchar.h> header file. */
+# ifndef _CL_HAVE_WCTYPE_H
+# define _CL_HAVE_WCTYPE_H
+# endif
+#endif
+
+/* Define to 1 if you have the `wprintf' function. */
+/* #undef _CL_HAVE_WPRINTF */
+
+#if defined(__MINGW32__)
+ /* Define to 1 if you have the `_filelength' function. */
+# ifndef _CL_HAVE__FILELENGTH
+# define _CL_HAVE__FILELENGTH 1
+# endif
+#endif
+
+/* How to define a static const in a class */
+#ifndef LUCENE_STATIC_CONSTANT_SYNTAX
+#define LUCENE_STATIC_CONSTANT_SYNTAX 1
+#endif
+
+/* Name of package */
+#ifndef _CL_PACKAGE
+#define _CL_PACKAGE "clucene-core"
+#endif
+
+/* Define to the address where bug reports for this package should be sent. */
+#ifndef _CL_PACKAGE_BUGREPORT
+#define _CL_PACKAGE_BUGREPORT ""
+#endif
+
+/* Define to the full name of this package. */
+#ifndef _CL_PACKAGE_NAME
+#define _CL_PACKAGE_NAME ""
+#endif
+
+/* Define to the full name and version of this package. */
+#ifndef _CL_PACKAGE_STRING
+#define _CL_PACKAGE_STRING ""
+#endif
+
+/* Define to the one symbol short name of this package. */
+#ifndef _CL_PACKAGE_TARNAME
+#define _CL_PACKAGE_TARNAME ""
+#endif
+
+/* Define to the version of this package. */
+#ifndef _CL_PACKAGE_VERSION
+#define _CL_PACKAGE_VERSION ""
+#endif
+
+/* Define to the necessary symbol if this constant uses a non-standard name on
+ your system. */
+/* #undef _CL_PTHREAD_CREATE_JOINABLE */
+
+/* The size of a `unsigned char', as computed by sizeof. */
+/* #undef _CL_SIZEOF_UNSIGNED_CHAR */
+
+/* The size of a `unsigned int', as computed by sizeof. */
+/* #undef _CL_SIZEOF_UNSIGNED_INT */
+
+/* The size of a `unsigned long', as computed by sizeof. */
+/* #undef _CL_SIZEOF_UNSIGNED_LONG */
+
+/* The size of a `unsigned long long', as computed by sizeof. */
+/* #undef _CL_SIZEOF_UNSIGNED_LONG_LONG */
+
+/* The size of a `unsigned __int64', as computed by sizeof. */
+/* #undef _CL_SIZEOF_UNSIGNED___INT64 */
+
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef _CL_STAT_MACROS_BROKEN */
+
+#if !defined(__HP_aCC)
+ /* Define to 1 if you have the ANSI C header files. */
+# ifndef _CL_STDC_HEADERS
+# define _CL_STDC_HEADERS 1
+# endif
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+# ifndef _CL_TIME_WITH_SYS_TIME
+# define _CL_TIME_WITH_SYS_TIME 1
+# endif
+#endif
+
+/* Version number of package */
+#ifndef _CL_VERSION
+#define _CL_VERSION "0.9.17"
+#endif
+
+/* Forces into Ascii mode */
+/* #undef _ASCII */
+
+/* Conditional Debugging */
+/* #undef _CL__CND_DEBUG */
+
+/* debuging option */
+/* #undef _DEBUG */
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* If not already defined, then define as a datatype of *exactly* 32 bits. */
+/* #undef uint32_t */
+
+/* If not already defined, then define as a datatype of *exactly* 64 bits. */
+/* #undef uint64_t */
+
+/* If not already defined, then define as a datatype of *exactly* 8 bits. */
+/* #undef uint8_t */
+
+/* once:
+_SRC_CLUCENE_CLUCENE_CONFIG_H
+*/
+#endif
+
+
+#if defined Q_CC_MSVC && _MSC_VER < 1300
+# define LUCENE_NO_STDC_NAMESPACE
+#endif
+
+
+#endif // QCLUCENE_CONFIG_P_H
+
diff --git a/tools/assistant/lib/fulltextsearch/qclucene_global_p.h b/tools/assistant/lib/fulltextsearch/qclucene_global_p.h
new file mode 100644
index 0000000..2a9d146
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qclucene_global_p.h
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QCLUCENE_GLOBAL_P_H
+#define QCLUCENE_GLOBAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#if !defined(_MSC_VER)
+# include "qclucene-config_p.h"
+#endif
+
+#include <QtCore/QChar>
+#include <QtCore/QString>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+#if !defined(QT_SHARED) && !defined(QT_DLL)
+# define QHELP_EXPORT
+#elif defined(QHELP_LIB)
+# define QHELP_EXPORT Q_DECL_EXPORT
+#else
+# define QHELP_EXPORT Q_DECL_IMPORT
+#endif
+
+//
+// W A R N I N G
+// -------------
+//
+// adjustments here, need to be done in
+// QTDIR/src/3rdparty/clucene/src/CLucene/StdHeader.h as well
+//
+#if defined(_LUCENE_DONTIMPLEMENT_NS_MACROS)
+
+#elif !defined(DISABLE_NAMESPACE)
+# ifdef QT_NAMESPACE
+# define CL_NS_DEF(sub) namespace QT_NAMESPACE { namespace lucene{ namespace sub{
+# define CL_NS_DEF2(sub,sub2) namespace QT_NAMESPACE { namespace lucene{ namespace sub{ namespace sub2 {
+
+# define CL_NS_END }}}
+# define CL_NS_END2 }}}}
+
+# define CL_NS_USE(sub) using namespace QT_NAMESPACE::lucene::sub;
+# define CL_NS_USE2(sub,sub2) using namespace QT_NAMESPACE::lucene::sub::sub2;
+
+# define CL_NS(sub) QT_NAMESPACE::lucene::sub
+# define CL_NS2(sub,sub2) QT_NAMESPACE::lucene::sub::sub2
+# else
+# define CL_NS_DEF(sub) namespace lucene{ namespace sub{
+# define CL_NS_DEF2(sub,sub2) namespace lucene{ namespace sub{ namespace sub2 {
+
+# define CL_NS_END }}
+# define CL_NS_END2 }}}
+
+# define CL_NS_USE(sub) using namespace lucene::sub;
+# define CL_NS_USE2(sub,sub2) using namespace lucene::sub::sub2;
+
+# define CL_NS(sub) lucene::sub
+# define CL_NS2(sub,sub2) lucene::sub::sub2
+# endif
+#else
+# define CL_NS_DEF(sub)
+# define CL_NS_DEF2(sub, sub2)
+# define CL_NS_END
+# define CL_NS_END2
+# define CL_NS_USE(sub)
+# define CL_NS_USE2(sub,sub2)
+# define CL_NS(sub)
+# define CL_NS2(sub,sub2)
+#endif
+
+#if !defined(_MSC_VER) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
+# if !defined(TCHAR)
+# define TCHAR wchar_t
+# endif
+#else
+# include <windows.h>
+#endif
+
+namespace {
+ TCHAR* QStringToTChar(const QString &str)
+ {
+ TCHAR *string = new TCHAR[(str.length() +1) * sizeof(TCHAR)];
+ memset(string, 0, (str.length() +1) * sizeof(TCHAR));
+ #if defined(UNICODE) || defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
+ str.toWCharArray(string);
+ #else
+ const QByteArray ba = str.toAscii();
+ strcpy(string, ba.constData());
+ #endif
+ return string;
+ }
+
+ QString TCharToQString(const TCHAR *string)
+ {
+ #if defined(UNICODE) || defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
+ QString retValue = QString::fromWCharArray(string);
+ return retValue;
+ #else
+ return QString(QLatin1String(string));
+ #endif
+ }
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QCLUCENE_GLOBAL_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qdocument.cpp b/tools/assistant/lib/fulltextsearch/qdocument.cpp
new file mode 100644
index 0000000..7e0f6d9
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qdocument.cpp
@@ -0,0 +1,172 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qdocument_p.h"
+#include "qreader_p.h"
+#include "qclucene_global_p.h"
+
+#include <CLucene.h>
+#include <CLucene/util/Reader.h>
+#include <CLucene/document/Document.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneDocumentPrivate::QCLuceneDocumentPrivate()
+ : QSharedData()
+{
+ document = 0;
+ deleteCLuceneDocument = true;
+}
+
+QCLuceneDocumentPrivate::QCLuceneDocumentPrivate(const QCLuceneDocumentPrivate &other)
+ : QSharedData()
+{
+ document = _CL_POINTER(other.document);
+}
+
+QCLuceneDocumentPrivate::~QCLuceneDocumentPrivate()
+{
+ if (deleteCLuceneDocument)
+ _CLDECDELETE(document);
+}
+
+
+QCLuceneDocument::QCLuceneDocument()
+ : d(new QCLuceneDocumentPrivate())
+{
+ // nothing todo
+ d->document = new lucene::document::Document();
+}
+
+QCLuceneDocument::~QCLuceneDocument()
+{
+ qDeleteAll(fieldList);
+ fieldList.clear();
+}
+
+void QCLuceneDocument::add(QCLuceneField *field)
+{
+ field->d->deleteCLuceneField = false;
+ d->document->add(*field->d->field);
+ fieldList.append(field);
+}
+
+QCLuceneField* QCLuceneDocument::getField(const QString &name) const
+{
+ QCLuceneField* field = 0;
+ foreach (field, fieldList) {
+ if (field->name() == name && field->d->field != 0)
+ return field;
+ }
+
+ field = 0;
+ TCHAR *fieldName = QStringToTChar(name);
+ lucene::document::Field *f = d->document->getField(fieldName);
+ if (f) {
+ field = new QCLuceneField();
+ field->d->field = f;
+ fieldList.append(field);
+ field->d->deleteCLuceneField = false;
+
+ lucene::util::Reader *r = f->readerValue();
+ if (r) {
+ field->reader->d->reader = r;
+ field->reader->d->deleteCLuceneReader = false;
+ }
+ }
+ delete [] fieldName;
+
+ return field;
+}
+
+QString QCLuceneDocument::get(const QString &name) const
+{
+ QCLuceneField* field = getField(name);
+ if (field)
+ return field->stringValue();
+
+ return QString();
+}
+
+QString QCLuceneDocument::toString() const
+{
+ return TCharToQString(d->document->toString());
+}
+
+void QCLuceneDocument::setBoost(qreal boost)
+{
+ d->document->setBoost(qreal(boost));
+}
+
+qreal QCLuceneDocument::getBoost() const
+{
+ return qreal(d->document->getBoost());
+}
+
+void QCLuceneDocument::removeField(const QString &name)
+{
+ TCHAR *fieldName = QStringToTChar(name);
+ d->document->removeField(fieldName);
+ delete [] fieldName;
+
+ QList<QCLuceneField*> tmp;
+ lucene::document::DocumentFieldEnumeration *dfe = d->document->fields();
+ while (dfe->hasMoreElements()) {
+ const lucene::document::Field* f = dfe->nextElement();
+ foreach (QCLuceneField* field, fieldList) {
+ if (f == field->d->field) {
+ tmp.append(field);
+ break;
+ }
+ }
+ }
+ _CLDELETE(dfe);
+ fieldList = tmp;
+}
+
+void QCLuceneDocument::removeFields(const QString &name)
+{
+ for (qint32 i = fieldList.count() -1; i >= 0; --i) {
+ QCLuceneField* field = fieldList.at(i);
+ if (field->name() == name)
+ delete fieldList.takeAt(i);
+ }
+
+ TCHAR *fieldName = QStringToTChar(name);
+ d->document->removeFields(fieldName);
+ delete [] fieldName;
+}
+
+QStringList QCLuceneDocument::getValues(const QString &name) const
+{
+ TCHAR *fieldName = QStringToTChar(name);
+ TCHAR **values = d->document->getValues(fieldName);
+
+ QStringList retValue;
+ if (values) {
+ for (qint32 i = 0; 0 != values[i]; ++i) {
+ retValue.append(TCharToQString((const TCHAR*)values[i]));
+ delete [] values[i]; values[i] = 0;
+ }
+ delete values;
+ }
+
+ delete [] fieldName;
+ return retValue;
+}
+
+void QCLuceneDocument::clear()
+{
+ d->document->clear();
+ qDeleteAll(fieldList);
+ fieldList.clear();
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qdocument_p.h b/tools/assistant/lib/fulltextsearch/qdocument_p.h
new file mode 100644
index 0000000..45f3d00
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qdocument_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QDOCUMENT_P_H
+#define QDOCUMENT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qfield_p.h"
+#include "qclucene_global_p.h"
+
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(document)
+ class Document;
+CL_NS_END
+CL_NS_USE(document)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneHits;
+class QCLuceneIndexReader;
+class QCLuceneIndexWriter;
+class QCLuceneIndexSearcher;
+class QCLuceneMultiSearcher;
+
+class QHELP_EXPORT QCLuceneDocumentPrivate : public QSharedData
+{
+public:
+ QCLuceneDocumentPrivate();
+ QCLuceneDocumentPrivate(const QCLuceneDocumentPrivate &other);
+
+ ~QCLuceneDocumentPrivate();
+
+ Document *document;
+ bool deleteCLuceneDocument;
+
+private:
+ QCLuceneDocumentPrivate &operator=(const QCLuceneDocumentPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneDocument
+{
+public:
+ QCLuceneDocument();
+ ~QCLuceneDocument();
+
+ void add(QCLuceneField *field);
+ QCLuceneField* getField(const QString &name) const;
+ QString get(const QString &name) const;
+ QString toString() const;
+ void setBoost(qreal boost);
+ qreal getBoost() const;
+ void removeField(const QString &name);
+ void removeFields(const QString &name);
+ QStringList getValues(const QString &name) const;
+ void clear();
+
+protected:
+ friend class QCLuceneHits;
+ friend class QCLuceneIndexReader;
+ friend class QCLuceneIndexWriter;
+ friend class QCLuceneIndexSearcher;
+ friend class QCLuceneMultiSearcher;
+ QSharedDataPointer<QCLuceneDocumentPrivate> d;
+
+private:
+ mutable QList<QCLuceneField*> fieldList;
+};
+
+QT_END_NAMESPACE
+
+#endif // QDOCUMENT_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qfield.cpp b/tools/assistant/lib/fulltextsearch/qfield.cpp
new file mode 100644
index 0000000..0c64fa8
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qfield.cpp
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qfield_p.h"
+#include "qreader_p.h"
+#include "qclucene_global_p.h"
+
+#include <CLucene.h>
+#include <CLucene/document/Field.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneFieldPrivate::QCLuceneFieldPrivate()
+ : QSharedData()
+{
+ field = 0;
+ deleteCLuceneField = true;
+}
+
+QCLuceneFieldPrivate::QCLuceneFieldPrivate(const QCLuceneFieldPrivate &other)
+ : QSharedData()
+{
+ field = _CL_POINTER(other.field);
+}
+
+QCLuceneFieldPrivate::~QCLuceneFieldPrivate()
+{
+ if (deleteCLuceneField)
+ _CLDECDELETE(field);
+}
+
+
+QCLuceneField::QCLuceneField()
+ : d(new QCLuceneFieldPrivate())
+ , reader(0)
+{
+ // nothing todo
+}
+
+QCLuceneField::QCLuceneField(const QString &name, const QString &value, int configs)
+ : d(new QCLuceneFieldPrivate())
+ , reader(0)
+{
+ TCHAR* fieldName = QStringToTChar(name);
+ TCHAR* fieldValue = QStringToTChar(value);
+
+ d->field = new lucene::document::Field(fieldName, fieldValue, configs);
+
+ delete [] fieldName;
+ delete [] fieldValue;
+}
+
+QCLuceneField::QCLuceneField(const QString &name, QCLuceneReader *reader,
+ int configs)
+ : d(new QCLuceneFieldPrivate())
+ , reader(reader)
+{
+ TCHAR* fieldName = QStringToTChar(name);
+
+ reader->d->deleteCLuceneReader = false; // clucene takes ownership
+ d->field = new lucene::document::Field(fieldName, reader->d->reader, configs);
+
+ delete [] fieldName;
+}
+
+QCLuceneField::~QCLuceneField()
+{
+ delete reader;
+}
+
+QString QCLuceneField::name() const
+{
+ return TCharToQString(d->field->name());
+}
+
+QString QCLuceneField::stringValue() const
+{
+ return TCharToQString((const TCHAR*)d->field->stringValue());
+}
+
+QCLuceneReader* QCLuceneField::readerValue() const
+{
+ return reader;
+}
+
+bool QCLuceneField::isStored() const
+{
+ return d->field->isStored();
+}
+
+bool QCLuceneField::isIndexed() const
+{
+ return d->field->isIndexed();
+}
+
+bool QCLuceneField::isTokenized() const
+{
+ return d->field->isTokenized();
+}
+
+bool QCLuceneField::isCompressed() const
+{
+ return d->field->isCompressed();
+}
+
+void QCLuceneField::setConfig(int termVector)
+{
+ d->field->setConfig(termVector);
+}
+
+bool QCLuceneField::isTermVectorStored() const
+{
+ return d->field->isTermVectorStored();
+}
+
+bool QCLuceneField::isStoreOffsetWithTermVector() const
+{
+ return d->field->isStoreOffsetWithTermVector();
+}
+
+bool QCLuceneField::isStorePositionWithTermVector() const
+{
+ return d->field->isStorePositionWithTermVector();
+}
+
+qreal QCLuceneField::getBoost() const
+{
+ return qreal(d->field->getBoost());
+}
+
+void QCLuceneField::setBoost(qreal value)
+{
+ d->field->setBoost(qreal(value));
+}
+
+bool QCLuceneField::isBinary() const
+{
+ return d->field->isBinary();
+}
+
+bool QCLuceneField::getOmitNorms() const
+{
+ return d->field->getOmitNorms();
+}
+
+void QCLuceneField::setOmitNorms(bool omitNorms)
+{
+ d->field->setOmitNorms(omitNorms);
+}
+
+QString QCLuceneField::toString() const
+{
+ return TCharToQString(d->field->toString());
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qfield_p.h b/tools/assistant/lib/fulltextsearch/qfield_p.h
new file mode 100644
index 0000000..86b6440
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qfield_p.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QFIELD_P_H
+#define QFIELD_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qclucene_global_p.h"
+
+#include <QtCore/QString>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(document)
+ class Field;
+CL_NS_END
+CL_NS_USE(document)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneReader;
+class QCLuceneDocument;
+
+class QHELP_EXPORT QCLuceneFieldPrivate : public QSharedData
+{
+public:
+ QCLuceneFieldPrivate();
+ QCLuceneFieldPrivate(const QCLuceneFieldPrivate &other);
+
+ ~QCLuceneFieldPrivate();
+
+ Field *field;
+ bool deleteCLuceneField;
+
+private:
+ QCLuceneFieldPrivate &operator=(const QCLuceneFieldPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneField
+{
+public:
+ enum Store {
+ STORE_YES = 1,
+ STORE_NO = 2,
+ STORE_COMPRESS = 4
+ };
+
+ enum Index {
+ INDEX_NO = 16,
+ INDEX_TOKENIZED = 32,
+ INDEX_UNTOKENIZED = 64,
+ INDEX_NONORMS = 128
+ };
+
+ enum TermVector {
+ TERMVECTOR_NO = 256,
+ TERMVECTOR_YES = 512,
+ TERMVECTOR_WITH_POSITIONS = 1024,
+ TERMVECTOR_WITH_OFFSETS = 2048
+ };
+
+ QCLuceneField(const QString &name, const QString &value, int configs);
+ QCLuceneField(const QString &name, QCLuceneReader *reader, int configs);
+ ~QCLuceneField();
+
+ QString name() const;
+ QString stringValue() const;
+ QCLuceneReader* readerValue() const;
+ bool isStored() const;
+ bool isIndexed() const;
+ bool isTokenized() const;
+ bool isCompressed() const;
+ void setConfig(int termVector);
+ bool isTermVectorStored() const;
+ bool isStoreOffsetWithTermVector() const;
+ bool isStorePositionWithTermVector() const;
+ qreal getBoost() const;
+ void setBoost(qreal value);
+ bool isBinary() const;
+ bool getOmitNorms() const;
+ void setOmitNorms(bool omitNorms);
+ QString toString() const;
+
+protected:
+ QCLuceneField();
+ friend class QCLuceneDocument;
+ QSharedDataPointer<QCLuceneFieldPrivate> d;
+
+private:
+ QCLuceneReader* reader;
+};
+
+QT_END_NAMESPACE
+
+#endif // QFIELD_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qfilter.cpp b/tools/assistant/lib/fulltextsearch/qfilter.cpp
new file mode 100644
index 0000000..2437339
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qfilter.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qfilter_p.h"
+
+#include <CLucene.h>
+#include <CLucene/search/Filter.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneFilterPrivate::QCLuceneFilterPrivate()
+ : QSharedData()
+{
+ filter = 0;
+ deleteCLuceneFilter = true;
+}
+
+QCLuceneFilterPrivate::QCLuceneFilterPrivate(const QCLuceneFilterPrivate &other)
+ : QSharedData()
+{
+ filter = _CL_POINTER(other.filter);
+}
+
+QCLuceneFilterPrivate::~QCLuceneFilterPrivate ()
+{
+ if (deleteCLuceneFilter)
+ _CLDECDELETE(filter);
+}
+
+
+QCLuceneFilter::QCLuceneFilter()
+ : d(new QCLuceneFilterPrivate())
+{
+ // nothing todo
+}
+
+QCLuceneFilter::~QCLuceneFilter()
+{
+ // nothing todo
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qfilter_p.h b/tools/assistant/lib/fulltextsearch/qfilter_p.h
new file mode 100644
index 0000000..fcc0674
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qfilter_p.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QFilter_P_H
+#define QFilter_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qclucene_global_p.h"
+
+#include <QtCore/QSharedData>
+#include <QtCore/QSharedDataPointer>
+
+CL_NS_DEF(search)
+ class Filter;
+CL_NS_END
+CL_NS_USE(search)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneHits;
+class QCLuceneSearcher;
+
+class QHELP_EXPORT QCLuceneFilterPrivate : public QSharedData
+{
+public:
+ QCLuceneFilterPrivate();
+ QCLuceneFilterPrivate(const QCLuceneFilterPrivate &other);
+
+ ~QCLuceneFilterPrivate ();
+
+ Filter *filter;
+ bool deleteCLuceneFilter;
+
+private:
+ QCLuceneFilterPrivate &operator=(const QCLuceneFilterPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneFilter
+{
+ QCLuceneFilter();
+ virtual ~QCLuceneFilter();
+
+protected:
+ friend class QCLuceneHits;
+ friend class QCLuceneSearcher;
+ QSharedDataPointer<QCLuceneFilterPrivate> d;
+};
+
+QT_END_NAMESPACE
+
+#endif // QFilter_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qhits.cpp b/tools/assistant/lib/fulltextsearch/qhits.cpp
new file mode 100644
index 0000000..b3dbea7
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qhits.cpp
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qhits_p.h"
+#include "qsearchable_p.h"
+
+#include <CLucene.h>
+#include <CLucene/search/SearchHeader.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneHitsPrivate::QCLuceneHitsPrivate()
+ : QSharedData()
+{
+ hits = 0;
+ deleteCLuceneHits = true;
+}
+
+QCLuceneHitsPrivate::QCLuceneHitsPrivate(const QCLuceneHitsPrivate &other)
+ : QSharedData()
+{
+ hits = _CL_POINTER(other.hits);
+}
+
+QCLuceneHitsPrivate::~QCLuceneHitsPrivate()
+{
+ if (deleteCLuceneHits)
+ _CLDECDELETE(hits);
+}
+
+
+QCLuceneHits::QCLuceneHits(const QCLuceneSearcher &searcher,
+ const QCLuceneQuery &query, const QCLuceneFilter &filter)
+ : d(new QCLuceneHitsPrivate())
+{
+ d->hits = new lucene::search::Hits(searcher.d->searchable, query.d->query,
+ filter.d->filter);
+}
+
+QCLuceneHits::QCLuceneHits(const QCLuceneSearcher &searcher, const QCLuceneQuery &query,
+ const QCLuceneFilter &filter, const QCLuceneSort &sort)
+ : d(new QCLuceneHitsPrivate())
+{
+ d->hits = new lucene::search::Hits(searcher.d->searchable, query.d->query,
+ filter.d->filter, sort.d->sort);
+}
+
+QCLuceneHits::~QCLuceneHits()
+{
+ // nothing todo
+}
+
+QCLuceneDocument QCLuceneHits::document(const qint32 index)
+{
+ // TODO: check this
+ QCLuceneDocument document;
+ document.d->deleteCLuceneDocument = false;
+ lucene::document::Document &doc = d->hits->doc(int32_t(index));
+ document.d->document = &doc;
+
+ return document;
+}
+
+qint32 QCLuceneHits::length() const
+{
+ return qint32(d->hits->length());
+}
+
+qint32 QCLuceneHits::id(const qint32 index)
+{
+ return qint32(d->hits->id(int32_t(index)));
+}
+
+qreal QCLuceneHits::score(const qint32 index)
+{
+ return qreal(d->hits->score(int32_t(index)));
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qhits_p.h b/tools/assistant/lib/fulltextsearch/qhits_p.h
new file mode 100644
index 0000000..fb6666b
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qhits_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QHITS_P_H
+#define QHITS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qsort_p.h"
+#include "qquery_p.h"
+#include "qfilter_p.h"
+#include "qdocument_p.h"
+#include "qclucene_global_p.h"
+
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(search)
+ class Hits;
+CL_NS_END
+CL_NS_USE(search)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneSearcher;
+
+class QHELP_EXPORT QCLuceneHitsPrivate : public QSharedData
+{
+public:
+ QCLuceneHitsPrivate();
+ QCLuceneHitsPrivate(const QCLuceneHitsPrivate &other);
+
+ ~QCLuceneHitsPrivate();
+
+ Hits *hits;
+ bool deleteCLuceneHits;
+
+private:
+ QCLuceneHitsPrivate &operator=(const QCLuceneHitsPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneHits
+{
+public:
+ QCLuceneHits(const QCLuceneSearcher &searcher, const QCLuceneQuery &query,
+ const QCLuceneFilter &filter);
+ QCLuceneHits(const QCLuceneSearcher &searcher, const QCLuceneQuery &query,
+ const QCLuceneFilter &filter, const QCLuceneSort &sort);
+ virtual ~QCLuceneHits();
+
+ QCLuceneDocument document(const qint32 index);
+ qint32 length() const;
+ qint32 id (const qint32 index);
+ qreal score(const qint32 index);
+
+protected:
+ friend class QCLuceneSearcher;
+ QSharedDataPointer<QCLuceneHitsPrivate> d;
+};
+
+QT_END_NAMESPACE
+
+#endif // QHITS_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qindexreader.cpp b/tools/assistant/lib/fulltextsearch/qindexreader.cpp
new file mode 100644
index 0000000..5f967cc
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qindexreader.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qindexreader_p.h"
+#include "qclucene_global_p.h"
+
+#include <CLucene.h>
+#include <CLucene/index/IndexReader.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneIndexReaderPrivate::QCLuceneIndexReaderPrivate()
+ : QSharedData()
+{
+ reader = 0;
+ deleteCLuceneIndexReader = true;
+}
+
+QCLuceneIndexReaderPrivate::QCLuceneIndexReaderPrivate(const QCLuceneIndexReaderPrivate &other)
+ : QSharedData()
+{
+ reader = _CL_POINTER(other.reader);
+}
+
+QCLuceneIndexReaderPrivate::~QCLuceneIndexReaderPrivate()
+{
+ if (deleteCLuceneIndexReader)
+ _CLDECDELETE(reader);
+}
+
+
+QCLuceneIndexReader::QCLuceneIndexReader()
+ : d(new QCLuceneIndexReaderPrivate())
+{
+ // nothing todo, private
+}
+
+QCLuceneIndexReader::~QCLuceneIndexReader()
+{
+ // nothing todo
+}
+
+bool QCLuceneIndexReader::isLuceneFile(const QString &filename)
+{
+ using namespace lucene::index;
+
+ return IndexReader::isLuceneFile(filename);
+}
+
+bool QCLuceneIndexReader::indexExists(const QString &directory)
+{
+ using namespace lucene::index;
+ return IndexReader::indexExists(directory);
+}
+
+QCLuceneIndexReader QCLuceneIndexReader::open(const QString &path)
+{
+ using namespace lucene::index;
+
+ QCLuceneIndexReader indexReader;
+ indexReader.d->reader = IndexReader::open(path);
+
+ return indexReader;
+}
+
+void QCLuceneIndexReader::unlock(const QString &path)
+{
+ using namespace lucene::index;
+ IndexReader::unlock(path);
+}
+
+bool QCLuceneIndexReader::isLocked(const QString &directory)
+{
+ using namespace lucene::index;
+ return IndexReader::isLocked(directory);
+}
+
+quint64 QCLuceneIndexReader::lastModified(const QString &directory)
+{
+ using namespace lucene::index;
+ return quint64(IndexReader::lastModified(directory));
+}
+
+qint64 QCLuceneIndexReader::getCurrentVersion(const QString &directory)
+{
+ using namespace lucene::index;
+ return qint64(IndexReader::getCurrentVersion(directory));
+}
+
+void QCLuceneIndexReader::close()
+{
+ d->reader->close();
+}
+
+bool QCLuceneIndexReader::isCurrent()
+{
+ return d->reader->isCurrent();
+}
+
+void QCLuceneIndexReader::undeleteAll()
+{
+ d->reader->undeleteAll();
+}
+
+qint64 QCLuceneIndexReader::getVersion()
+{
+ return qint64(d->reader->getVersion());
+}
+
+void QCLuceneIndexReader::deleteDocument(qint32 docNum)
+{
+ d->reader->deleteDocument(int32_t(docNum));
+}
+
+bool QCLuceneIndexReader::hasNorms(const QString &field)
+{
+ TCHAR *fieldName = QStringToTChar(field);
+ bool retValue = d->reader->hasNorms(fieldName);
+ delete [] fieldName;
+
+ return retValue;
+}
+
+qint32 QCLuceneIndexReader::deleteDocuments(const QCLuceneTerm &term)
+{
+ return d->reader->deleteDocuments(term.d->term);
+}
+
+bool QCLuceneIndexReader::document(qint32 index, QCLuceneDocument &document)
+{
+ if (!document.d->document)
+ document.d->document = new lucene::document::Document();
+
+ if (d->reader->document(int32_t(index), document.d->document))
+ return true;
+
+ return false;
+}
+
+void QCLuceneIndexReader::setNorm(qint32 doc, const QString &field, qreal value)
+{
+ TCHAR *fieldName = QStringToTChar(field);
+ d->reader->setNorm(int32_t(doc), fieldName, qreal(value));
+ delete [] fieldName;
+}
+
+void QCLuceneIndexReader::setNorm(qint32 doc, const QString &field, quint8 value)
+{
+ TCHAR *fieldName = QStringToTChar(field);
+ d->reader->setNorm(int32_t(doc), fieldName, uint8_t(value));
+ delete [] fieldName;
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qindexreader_p.h b/tools/assistant/lib/fulltextsearch/qindexreader_p.h
new file mode 100644
index 0000000..4a7330d
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qindexreader_p.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QINDEXREADER_P_H
+#define QINDEXREADER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qterm_p.h"
+#include "qdocument_p.h"
+#include "qclucene_global_p.h"
+
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(index)
+ class IndexReader;
+CL_NS_END
+CL_NS_USE(index)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneIndexWriter;
+class QCLuceneIndexSearcher;
+
+class QHELP_EXPORT QCLuceneIndexReaderPrivate : public QSharedData
+{
+public:
+ QCLuceneIndexReaderPrivate();
+ QCLuceneIndexReaderPrivate(const QCLuceneIndexReaderPrivate &other);
+
+ ~QCLuceneIndexReaderPrivate();
+
+ IndexReader *reader;
+ bool deleteCLuceneIndexReader;
+
+private:
+ QCLuceneIndexReaderPrivate &operator=(const QCLuceneIndexReaderPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneIndexReader
+{
+public:
+ enum FieldOption {
+ ALL = 1,
+ INDEXED = 2,
+ UNINDEXED = 4,
+ INDEXED_WITH_TERMVECTOR = 8,
+ INDEXED_NO_TERMVECTOR = 16,
+ TERMVECTOR = 32,
+ TERMVECTOR_WITH_POSITION = 64,
+ TERMVECTOR_WITH_OFFSET = 128,
+ TERMVECTOR_WITH_POSITION_OFFSET = 256
+ };
+
+ virtual ~QCLuceneIndexReader();
+
+ static bool isLuceneFile(const QString &filename);
+ static bool indexExists(const QString &directory);
+ static QCLuceneIndexReader open(const QString &path);
+
+ static void unlock(const QString &path);
+ static bool isLocked(const QString &directory);
+
+ static quint64 lastModified(const QString &directory);
+ static qint64 getCurrentVersion(const QString &directory);
+
+ void close();
+ bool isCurrent();
+ void undeleteAll();
+ qint64 getVersion();
+ void deleteDocument(qint32 docNum);
+ bool hasNorms(const QString &field);
+ qint32 deleteDocuments(const QCLuceneTerm &term);
+ bool document(qint32 index, QCLuceneDocument &document);
+ void setNorm(qint32 doc, const QString &field, qreal value);
+ void setNorm(qint32 doc, const QString &field, quint8 value);
+
+protected:
+ friend class QCLuceneIndexWriter;
+ friend class QCLuceneIndexSearcher;
+ QSharedDataPointer<QCLuceneIndexReaderPrivate> d;
+
+private:
+ QCLuceneIndexReader();
+};
+
+QT_END_NAMESPACE
+
+#endif // QINDEXREADER_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qindexwriter.cpp b/tools/assistant/lib/fulltextsearch/qindexwriter.cpp
new file mode 100644
index 0000000..890cc67
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qindexwriter.cpp
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qindexwriter_p.h"
+#include "qindexreader_p.h"
+
+#include <CLucene.h>
+#include <CLucene/index/IndexWriter.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneIndexWriterPrivate::QCLuceneIndexWriterPrivate()
+ : QSharedData()
+{
+ writer = 0;
+ deleteCLuceneIndexWriter = true;
+}
+
+QCLuceneIndexWriterPrivate::QCLuceneIndexWriterPrivate(const QCLuceneIndexWriterPrivate &other)
+ : QSharedData()
+{
+ writer = _CL_POINTER(other.writer);
+}
+
+QCLuceneIndexWriterPrivate::~QCLuceneIndexWriterPrivate()
+{
+ if (deleteCLuceneIndexWriter)
+ _CLDECDELETE(writer);
+}
+
+
+QCLuceneIndexWriter::QCLuceneIndexWriter(const QString &path,
+ QCLuceneAnalyzer &analyzer,
+ bool create, bool closeDir)
+ : d(new QCLuceneIndexWriterPrivate())
+ , analyzer(analyzer)
+{
+ d->writer = new lucene::index::IndexWriter(path,
+ analyzer.d->analyzer, create, closeDir);
+}
+
+QCLuceneIndexWriter::~QCLuceneIndexWriter()
+{
+ // nothing todo
+}
+
+void QCLuceneIndexWriter::close()
+{
+ d->writer->close();
+}
+
+void QCLuceneIndexWriter::optimize()
+{
+ d->writer->optimize();
+}
+
+qint32 QCLuceneIndexWriter::docCount()
+{
+ return qint32(d->writer->docCount());
+}
+
+QCLuceneAnalyzer QCLuceneIndexWriter::getAnalyzer()
+{
+ return analyzer;
+}
+
+void QCLuceneIndexWriter::addIndexes(const QList<QCLuceneIndexReader*> &readers)
+{
+ using namespace lucene::index;
+ IndexReader** readerArray = new IndexReader*[readers.count()];
+
+ for (int i = 0; i < readers.count(); ++i)
+ readerArray[i] = (readers.at(i))->d->reader;
+
+ d->writer->addIndexes(readerArray);
+ delete readerArray;
+}
+
+void QCLuceneIndexWriter::addDocument(QCLuceneDocument &doc,
+ QCLuceneAnalyzer &analyzer)
+{
+ if (doc.d->document)
+ d->writer->addDocument(doc.d->document, analyzer.d->analyzer);
+}
+
+qint32 QCLuceneIndexWriter::getMaxFieldLength() const
+{
+ return qint32(d->writer->getMaxFieldLength());
+}
+
+void QCLuceneIndexWriter::setMaxFieldLength(qint32 value)
+{
+ d->writer->setMaxFieldLength(int32_t(value));
+}
+
+qint32 QCLuceneIndexWriter::getMaxBufferedDocs() const
+{
+ return qint32(d->writer->getMaxBufferedDocs());
+}
+
+void QCLuceneIndexWriter::setMaxBufferedDocs(qint32 value)
+{
+ d->writer->setMaxBufferedDocs(int32_t(value));
+}
+
+qint64 QCLuceneIndexWriter::getWriteLockTimeout() const
+{
+ return qint64(d->writer->getWriteLockTimeout());
+}
+
+void QCLuceneIndexWriter::setWriteLockTimeout(qint64 writeLockTimeout)
+{
+ d->writer->setWriteLockTimeout(int64_t(writeLockTimeout));
+}
+
+qint64 QCLuceneIndexWriter::getCommitLockTimeout() const
+{
+ return qint64(d->writer->getCommitLockTimeout());
+}
+
+void QCLuceneIndexWriter::setCommitLockTimeout(qint64 commitLockTimeout)
+{
+ d->writer->setCommitLockTimeout(int64_t(commitLockTimeout));
+}
+
+qint32 QCLuceneIndexWriter::getMergeFactor() const
+{
+ return qint32(d->writer->getMergeFactor());
+}
+
+void QCLuceneIndexWriter::setMergeFactor(qint32 value)
+{
+ d->writer->setMergeFactor(int32_t(value));
+}
+
+qint32 QCLuceneIndexWriter::getTermIndexInterval() const
+{
+ return qint32(d->writer->getTermIndexInterval());
+}
+
+void QCLuceneIndexWriter::setTermIndexInterval(qint32 interval)
+{
+ d->writer->setTermIndexInterval(int32_t(interval));
+}
+
+qint32 QCLuceneIndexWriter::getMinMergeDocs() const
+{
+ return qint32(d->writer->getMinMergeDocs());
+}
+
+void QCLuceneIndexWriter::setMinMergeDocs(qint32 value)
+{
+ d->writer->setMinMergeDocs(int32_t(value));
+}
+
+qint32 QCLuceneIndexWriter::getMaxMergeDocs() const
+{
+ return qint32(d->writer->getMaxMergeDocs());
+}
+
+void QCLuceneIndexWriter::setMaxMergeDocs(qint32 value)
+{
+ d->writer->setMaxMergeDocs(int32_t(value));
+}
+
+bool QCLuceneIndexWriter::getUseCompoundFile() const
+{
+ return d->writer->getUseCompoundFile();
+}
+
+void QCLuceneIndexWriter::setUseCompoundFile(bool value)
+{
+ d->writer->setUseCompoundFile(value);
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qindexwriter_p.h b/tools/assistant/lib/fulltextsearch/qindexwriter_p.h
new file mode 100644
index 0000000..e793494
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qindexwriter_p.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QINDEXWRITER_P_H
+#define QINDEXWRITER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qanalyzer_p.h"
+#include "qdocument_p.h"
+#include "qclucene_global_p.h"
+
+#include <QtCore/QString>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(index)
+ class IndexWriter;
+CL_NS_END
+CL_NS_USE(index)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneIndexReader;
+
+class QHELP_EXPORT QCLuceneIndexWriterPrivate : public QSharedData
+{
+public:
+ QCLuceneIndexWriterPrivate();
+ QCLuceneIndexWriterPrivate(const QCLuceneIndexWriterPrivate &other);
+
+ ~QCLuceneIndexWriterPrivate();
+
+ IndexWriter *writer;
+ bool deleteCLuceneIndexWriter;
+
+private:
+ QCLuceneIndexWriterPrivate &operator=(const QCLuceneIndexWriterPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneIndexWriter
+{
+public:
+ enum {
+ DEFAULT_MERGE_FACTOR = 10,
+ COMMIT_LOCK_TIMEOUT = 10000,
+ DEFAULT_MAX_BUFFERED_DOCS = 10,
+ DEFAULT_MAX_FIELD_LENGTH = 10000,
+ DEFAULT_TERM_INDEX_INTERVAL = 128,
+ DEFAULT_MAX_MERGE_DOCS = 0x7FFFFFFFL
+ };
+
+ QCLuceneIndexWriter(const QString &path, QCLuceneAnalyzer &analyzer,
+ bool create, bool closeDir = true);
+ virtual ~QCLuceneIndexWriter();
+
+ void close();
+ void optimize();
+ qint32 docCount();
+ QCLuceneAnalyzer getAnalyzer();
+
+ void addIndexes(const QList<QCLuceneIndexReader*> &readers);
+ void addDocument(QCLuceneDocument &doc, QCLuceneAnalyzer &analyzer);
+
+ qint32 getMaxFieldLength() const;
+ void setMaxFieldLength(qint32 value);
+
+ qint32 getMaxBufferedDocs() const;
+ void setMaxBufferedDocs(qint32 value);
+
+ qint64 getWriteLockTimeout() const;
+ void setWriteLockTimeout(qint64 writeLockTimeout);
+
+ qint64 getCommitLockTimeout() const;
+ void setCommitLockTimeout(qint64 commitLockTimeout);
+
+ qint32 getMergeFactor() const;
+ void setMergeFactor(qint32 value);
+
+ qint32 getTermIndexInterval() const;
+ void setTermIndexInterval(qint32 interval);
+
+ qint32 getMinMergeDocs() const;
+ void setMinMergeDocs(qint32 value);
+
+ qint32 getMaxMergeDocs() const;
+ void setMaxMergeDocs(qint32 value);
+
+ bool getUseCompoundFile() const;
+ void setUseCompoundFile(bool value);
+
+protected:
+ QSharedDataPointer<QCLuceneIndexWriterPrivate> d;
+
+private:
+ QCLuceneAnalyzer analyzer;
+};
+
+QT_END_NAMESPACE
+
+#endif // QINDEXWRITER_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qquery.cpp b/tools/assistant/lib/fulltextsearch/qquery.cpp
new file mode 100644
index 0000000..2210220
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qquery.cpp
@@ -0,0 +1,350 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qquery_p.h"
+#include "qclucene_global_p.h"
+
+#include <CLucene.h>
+#include <CLucene/search/PhraseQuery.h>
+#include <CLucene/search/SearchHeader.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneQueryPrivate::QCLuceneQueryPrivate()
+ : QSharedData()
+{
+ query = 0;
+ deleteCLuceneQuery = true;
+}
+
+QCLuceneQueryPrivate::QCLuceneQueryPrivate(const QCLuceneQueryPrivate &other)
+ : QSharedData()
+{
+ query = _CL_POINTER(other.query);
+}
+
+QCLuceneQueryPrivate::~QCLuceneQueryPrivate()
+{
+ if (deleteCLuceneQuery)
+ _CLDECDELETE(query);
+}
+
+
+QCLuceneQuery::QCLuceneQuery()
+ : d(new QCLuceneQueryPrivate())
+{
+ // nothing todo, private
+}
+
+QCLuceneQuery::~QCLuceneQuery()
+{
+ // nothing todo
+}
+
+void QCLuceneQuery::setBoost(qreal boost)
+{
+ d->query->setBoost(qreal(boost));
+}
+
+qreal QCLuceneQuery::getBoost() const
+{
+ return qreal(d->query->getBoost());
+}
+
+QString QCLuceneQuery::getQueryName() const
+{
+ return TCharToQString(d->query->getQueryName());
+}
+
+bool QCLuceneQuery::instanceOf(const QString &other) const
+{
+ if (other == getQueryName())
+ return true;
+
+ return false;
+}
+
+QString QCLuceneQuery::toString(const QString &field) const
+{
+ TCHAR *fieldName = QStringToTChar(field);
+ QString retValue = TCharToQString(d->query->toString(fieldName));
+ delete [] fieldName;
+
+ return retValue;
+}
+
+quint32 QCLuceneQuery::hashCode() const
+{
+ return quint32(d->query->hashCode());
+}
+
+QString QCLuceneQuery::toString() const
+{
+ return TCharToQString(d->query->toString());
+}
+
+bool QCLuceneQuery::equals(const QCLuceneQuery &other) const
+{
+ return d->query->equals(other.d->query);
+}
+
+
+QCLucenePrefixQuery::QCLucenePrefixQuery(const QCLuceneTerm &prefix)
+ : QCLuceneQuery()
+ , prefix(prefix)
+{
+ d->query = new lucene::search::PrefixQuery(prefix.d->term);
+}
+
+QCLucenePrefixQuery::~QCLucenePrefixQuery()
+{
+ // nothing todo
+}
+
+QString QCLucenePrefixQuery::getClassName()
+{
+ return TCharToQString(lucene::search::PrefixQuery::getClassName());
+}
+
+QCLuceneTerm QCLucenePrefixQuery::getPrefix() const
+{
+ return prefix;
+}
+
+
+QCLuceneRangeQuery::QCLuceneRangeQuery(const QCLuceneTerm &lowerTerm,
+ const QCLuceneTerm &upperTerm,
+ bool inclusive)
+ : QCLuceneQuery()
+ , lowerTerm(lowerTerm)
+ , upperTerm(upperTerm)
+{
+ d->query = new lucene::search::RangeQuery(lowerTerm.d->term,
+ upperTerm.d->term, inclusive);
+}
+
+QCLuceneRangeQuery::~QCLuceneRangeQuery()
+{
+ // nothing todo
+}
+
+QString QCLuceneRangeQuery::getClassName()
+{
+ return TCharToQString(lucene::search::RangeQuery::getClassName());
+}
+
+QCLuceneTerm QCLuceneRangeQuery::getLowerTerm() const
+{
+ return lowerTerm;
+}
+
+QCLuceneTerm QCLuceneRangeQuery::getUpperTerm() const
+{
+ return upperTerm;
+}
+
+bool QCLuceneRangeQuery::isInclusive() const
+{
+ lucene::search::RangeQuery *query =
+ static_cast<lucene::search::RangeQuery*> (d->query);
+
+ if (query == 0)
+ return false;
+
+ return query->isInclusive();
+}
+
+QString QCLuceneRangeQuery::getField() const
+{
+ lucene::search::RangeQuery *query =
+ static_cast<lucene::search::RangeQuery*> (d->query);
+
+ if (query == 0)
+ return QString();
+
+ return TCharToQString(query->getField());
+}
+
+
+QCLuceneTermQuery::QCLuceneTermQuery(const QCLuceneTerm &term)
+ : QCLuceneQuery()
+ , term(term)
+{
+ d->query = new lucene::search::TermQuery(term.d->term);
+}
+
+QCLuceneTermQuery::~QCLuceneTermQuery()
+{
+ // nothing todo
+}
+
+QString QCLuceneTermQuery::getClassName()
+{
+ return TCharToQString(lucene::search::TermQuery::getClassName());
+}
+
+QCLuceneTerm QCLuceneTermQuery::getTerm() const
+{
+ return term;
+}
+
+
+QCLuceneBooleanQuery::QCLuceneBooleanQuery()
+ : QCLuceneQuery()
+{
+ d->query = new lucene::search::BooleanQuery();
+}
+
+QCLuceneBooleanQuery::~QCLuceneBooleanQuery()
+{
+ qDeleteAll(queries);
+}
+
+QString QCLuceneBooleanQuery::getClassName()
+{
+ return TCharToQString(lucene::search::BooleanQuery::getClassName());
+}
+
+quint32 QCLuceneBooleanQuery::getClauseCount() const
+{
+ lucene::search::BooleanQuery *query =
+ static_cast<lucene::search::BooleanQuery*> (d->query);
+
+ if (query == 0)
+ return 1024;
+
+ return quint32(query->getClauseCount());
+}
+
+quint32 QCLuceneBooleanQuery::getMaxClauseCount() const
+{
+ lucene::search::BooleanQuery *query =
+ static_cast<lucene::search::BooleanQuery*> (d->query);
+
+ if (query == 0)
+ return 1024;
+
+ return quint32(query->getMaxClauseCount());
+}
+
+void QCLuceneBooleanQuery::setMaxClauseCount(quint32 maxClauseCount)
+{
+ lucene::search::BooleanQuery *query =
+ static_cast<lucene::search::BooleanQuery*> (d->query);
+
+ if (query == 0)
+ return;
+
+ query->setMaxClauseCount(size_t(maxClauseCount));
+}
+
+void QCLuceneBooleanQuery::add(QCLuceneQuery *query, bool required, bool prohibited)
+{
+ add(query, false, required, prohibited);
+}
+
+void QCLuceneBooleanQuery::add(QCLuceneQuery *query, bool delQuery,
+ bool required, bool prohibited)
+{
+ lucene::search::BooleanQuery *booleanQuery =
+ static_cast<lucene::search::BooleanQuery*> (d->query);
+
+ if (booleanQuery == 0)
+ return;
+
+ booleanQuery->add(query->d->query, delQuery, required, prohibited);
+
+ if (delQuery) {
+ queries.append(query);
+ query->d->deleteCLuceneQuery = false;
+ }
+}
+
+
+QCLucenePhraseQuery::QCLucenePhraseQuery()
+ : QCLuceneQuery()
+{
+ d->query = new lucene::search::PhraseQuery();
+}
+
+QCLucenePhraseQuery::~QCLucenePhraseQuery()
+{
+ termList.clear();
+}
+
+QString QCLucenePhraseQuery::getClassName()
+{
+ return TCharToQString(lucene::search::RangeQuery::getClassName());
+}
+
+qint32 QCLucenePhraseQuery::getSlop() const
+{
+ lucene::search::PhraseQuery *phraseQuery =
+ static_cast<lucene::search::PhraseQuery*> (d->query);
+
+ if (phraseQuery == 0)
+ return 0;
+
+ return qint32(phraseQuery->getSlop());
+}
+
+void QCLucenePhraseQuery::setSlop(const qint32 slop)
+{
+ lucene::search::PhraseQuery *phraseQuery =
+ static_cast<lucene::search::PhraseQuery*> (d->query);
+
+ if (phraseQuery == 0)
+ return;
+
+ phraseQuery->setSlop(int32_t(slop));
+}
+
+void QCLucenePhraseQuery::addTerm(const QCLuceneTerm &term)
+{
+ lucene::search::PhraseQuery *phraseQuery =
+ static_cast<lucene::search::PhraseQuery*> (d->query);
+
+ if (phraseQuery == 0)
+ return;
+
+ termList.append(term);
+ phraseQuery->add(term.d->term);
+}
+
+void QCLucenePhraseQuery::addTerm(const QCLuceneTerm &term, qint32 position)
+{
+ lucene::search::PhraseQuery *phraseQuery =
+ static_cast<lucene::search::PhraseQuery*> (d->query);
+
+ if (phraseQuery == 0)
+ return;
+
+ termList.insert(position, term);
+ phraseQuery->add(term.d->term, int32_t(position));
+
+}
+
+QString QCLucenePhraseQuery::getFieldName() const
+{
+ lucene::search::PhraseQuery *phraseQuery =
+ static_cast<lucene::search::PhraseQuery*> (d->query);
+
+ if (phraseQuery == 0)
+ return QString();
+
+ return TCharToQString(phraseQuery->getFieldName());
+}
+
+QList<QCLuceneTerm> QCLucenePhraseQuery::getTerms() const
+{
+ return termList;
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qquery_p.h b/tools/assistant/lib/fulltextsearch/qquery_p.h
new file mode 100644
index 0000000..42eaf07
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qquery_p.h
@@ -0,0 +1,181 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QQUERY_P_H
+#define QQUERY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qterm_p.h"
+#include "qclucene_global_p.h"
+
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(search)
+ class Query;
+CL_NS_END
+CL_NS_USE(search)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneHits;
+class QCLuceneTermQuery;
+class QCLuceneRangeQuery;
+class QCLuceneQueryParser;
+class QCLucenePrefixQuery;
+class QCLuceneBooleanQuery;
+class QCLucenePhraseQuery;
+
+class QHELP_EXPORT QCLuceneQueryPrivate : public QSharedData
+{
+public:
+ QCLuceneQueryPrivate();
+ QCLuceneQueryPrivate(const QCLuceneQueryPrivate &other);
+
+ ~QCLuceneQueryPrivate();
+
+ Query *query;
+ bool deleteCLuceneQuery;
+
+private:
+ QCLuceneQueryPrivate &operator=(const QCLuceneQueryPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneQuery
+{
+public:
+ virtual ~QCLuceneQuery();
+
+ void setBoost(qreal boost);
+ qreal getBoost() const;
+ QString getQueryName() const;
+ bool instanceOf(const QString &other) const;
+ QString toString(const QString &field) const;
+ quint32 hashCode() const;
+ QString toString() const;
+ bool equals(const QCLuceneQuery &other) const;
+
+protected:
+ friend class QCLuceneHits;
+ friend class QCLuceneTermQuery;
+ friend class QCLuceneRangeQuery;
+ friend class QCLucenePrefixQuery;
+ friend class QCLuceneQueryParser;
+ friend class QCLuceneBooleanQuery;
+ friend class QCLucenePhraseQuery;
+ QSharedDataPointer<QCLuceneQueryPrivate> d;
+
+private:
+ QCLuceneQuery();
+};
+
+class QHELP_EXPORT QCLucenePrefixQuery : public QCLuceneQuery
+{
+public:
+ QCLucenePrefixQuery(const QCLuceneTerm &prefix);
+ ~QCLucenePrefixQuery();
+
+ static QString getClassName();
+
+ QCLuceneTerm getPrefix() const;
+
+private:
+ QCLuceneTerm prefix;
+};
+
+class QHELP_EXPORT QCLuceneRangeQuery : public QCLuceneQuery
+{
+public:
+ QCLuceneRangeQuery(const QCLuceneTerm &lowerTerm,
+ const QCLuceneTerm &upperTerm, bool inclusive);
+ ~QCLuceneRangeQuery();
+
+ static QString getClassName();
+
+ QCLuceneTerm getLowerTerm() const;
+ QCLuceneTerm getUpperTerm() const;
+
+ bool isInclusive() const;
+ QString getField() const;
+
+private:
+ QCLuceneTerm lowerTerm;
+ QCLuceneTerm upperTerm;
+};
+
+class QHELP_EXPORT QCLuceneTermQuery : public QCLuceneQuery
+{
+public:
+ QCLuceneTermQuery(const QCLuceneTerm &term);
+ ~QCLuceneTermQuery();
+
+ static QString getClassName();
+
+ QCLuceneTerm getTerm() const;
+
+private:
+ QCLuceneTerm term;
+};
+
+class QHELP_EXPORT QCLuceneBooleanQuery : public QCLuceneQuery
+{
+public:
+ QCLuceneBooleanQuery();
+ ~QCLuceneBooleanQuery();
+
+ static QString getClassName();
+
+ quint32 getClauseCount() const;
+ quint32 getMaxClauseCount() const;
+ void setMaxClauseCount(quint32 maxClauseCount);
+
+ void add(QCLuceneQuery *query, bool required, bool prohibited);
+ void add(QCLuceneQuery *query, bool delQuery, bool required, bool prohibited);
+
+private:
+ QList<QCLuceneQuery*> queries;
+};
+
+class QHELP_EXPORT QCLucenePhraseQuery : public QCLuceneQuery
+{
+public:
+ QCLucenePhraseQuery();
+ ~QCLucenePhraseQuery();
+
+ static QString getClassName();
+
+ qint32 getSlop() const;
+ void setSlop(const qint32 slop);
+
+ void addTerm(const QCLuceneTerm &term);
+ void addTerm(const QCLuceneTerm &term, qint32 position);
+
+ QString getFieldName() const;
+ QList<QCLuceneTerm> getTerms() const;
+
+private:
+ QList<QCLuceneTerm> termList;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUERY_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qqueryparser.cpp b/tools/assistant/lib/fulltextsearch/qqueryparser.cpp
new file mode 100644
index 0000000..ce1b512
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qqueryparser.cpp
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qqueryparser_p.h"
+#include "qquery_p.h"
+#include "qclucene_global_p.h"
+
+#include <CLucene.h>
+#include <CLucene/queryParser/QueryParser.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneQueryParserPrivate::QCLuceneQueryParserPrivate()
+ : QSharedData()
+{
+ queryParser = 0;
+ deleteCLuceneQueryParser = true;
+}
+
+QCLuceneQueryParserPrivate::QCLuceneQueryParserPrivate(const QCLuceneQueryParserPrivate &other)
+ : QSharedData()
+{
+ queryParser = _CL_POINTER(other.queryParser);
+}
+
+QCLuceneQueryParserPrivate::~QCLuceneQueryParserPrivate()
+{
+ if (deleteCLuceneQueryParser)
+ _CLDECDELETE(queryParser);
+}
+
+
+QCLuceneQueryParser::QCLuceneQueryParser(const QString &field,
+ QCLuceneAnalyzer &analyzer)
+ : d(new QCLuceneQueryParserPrivate())
+ , field(field)
+ , analyzer(analyzer)
+{
+ TCHAR *fieldName = QStringToTChar(field);
+
+ d->queryParser = new lucene::queryParser::QueryParser(fieldName,
+ analyzer.d->analyzer);
+
+ delete [] fieldName;
+}
+
+QCLuceneQueryParser::~QCLuceneQueryParser()
+{
+ // nothing todo
+}
+
+QCLuceneQuery* QCLuceneQueryParser::parse(const QString &query)
+{
+ TCHAR *string = QStringToTChar(query);
+
+ QCLuceneQuery *retValue = 0;
+ lucene::search::Query* q = d->queryParser->parse(string);
+ if (q) {
+ retValue = new QCLuceneQuery();
+ retValue->d->query = q;
+ }
+
+ delete [] string;
+ return retValue;
+}
+
+QCLuceneQuery* QCLuceneQueryParser::parse(QCLuceneReader &reader)
+{
+ QCLuceneQuery *retValue = 0;
+ lucene::search::Query* q = d->queryParser->parse(reader.d->reader);
+ if (q) {
+ retValue = new QCLuceneQuery();
+ retValue->d->query = q;
+ }
+
+ return retValue;
+}
+
+QCLuceneQuery* QCLuceneQueryParser::parse(const QString &query, const QString &field,
+ QCLuceneAnalyzer &analyzer)
+{
+ QCLuceneQueryParser parser(field, analyzer);
+ return parser.parse(query);
+}
+
+QCLuceneAnalyzer QCLuceneQueryParser::getAnalyzer()
+{
+ return analyzer;
+}
+
+QString QCLuceneQueryParser::getField()
+{
+ return field;
+}
+
+
+QCLuceneMultiFieldQueryParser::QCLuceneMultiFieldQueryParser(
+ const QStringList &fieldList, QCLuceneAnalyzer &analyzer)
+ : QCLuceneQueryParser(QLatin1String(""), analyzer)
+{
+ Q_UNUSED(fieldList)
+}
+
+QCLuceneMultiFieldQueryParser::~QCLuceneMultiFieldQueryParser()
+{
+ // nothing todo
+}
+
+QCLuceneQuery* QCLuceneMultiFieldQueryParser::parse(const QString &query,
+ const QStringList &fieldList,
+ QCLuceneAnalyzer &analyzer)
+{
+ QCLuceneBooleanQuery *retValue = new QCLuceneBooleanQuery();
+ foreach (const QString &field, fieldList) {
+ QCLuceneQuery *q = QCLuceneQueryParser::parse(query, field, analyzer);
+ if (!q) {
+ delete retValue;
+ retValue = 0; break;
+ } else {
+ retValue->add(q, true, false, false);
+ }
+ }
+
+ return retValue;
+}
+
+QCLuceneQuery* QCLuceneMultiFieldQueryParser::parse(const QString &query,
+ const QStringList &fieldList,
+ QList<FieldFlags> flags,
+ QCLuceneAnalyzer &analyzer)
+{
+ QCLuceneBooleanQuery *retValue = new QCLuceneBooleanQuery();
+ qint32 i = 0;
+ foreach (const QString &field, fieldList) {
+ QCLuceneQuery *q = QCLuceneQueryParser::parse(query, field, analyzer);
+ if (q) {
+ qint32 flag = flags.at(i);
+ switch (flag) {
+ case QCLuceneMultiFieldQueryParser::REQUIRED_FIELD: {
+ retValue->add(q, true, true, false);
+ } break;
+
+ case QCLuceneMultiFieldQueryParser::PROHIBITED_FIELD: {
+ retValue->add(q, true, false, true);
+ } break;
+
+ default: {
+ retValue->add(q, true, false, false);
+ } break;
+ }
+
+ ++i;
+ } else {
+ delete retValue;
+ retValue = 0; break;
+ }
+ }
+ return retValue;
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qqueryparser_p.h b/tools/assistant/lib/fulltextsearch/qqueryparser_p.h
new file mode 100644
index 0000000..976ee63
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qqueryparser_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QQUERYPARSER_P_H
+#define QQUERYPARSER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qreader_p.h"
+#include "qanalyzer_p.h"
+#include "qclucene_global_p.h"
+
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(queryParser)
+ class QueryParser;
+CL_NS_END
+CL_NS_USE(queryParser)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneQuery;
+class QCLuceneMultiFieldQueryParser;
+
+class QHELP_EXPORT QCLuceneQueryParserPrivate : public QSharedData
+{
+public:
+ QCLuceneQueryParserPrivate();
+ QCLuceneQueryParserPrivate(const QCLuceneQueryParserPrivate &other);
+
+ ~QCLuceneQueryParserPrivate();
+
+ QueryParser *queryParser;
+ bool deleteCLuceneQueryParser;
+
+private:
+ QCLuceneQueryParserPrivate &operator=(const QCLuceneQueryParserPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneQueryParser
+{
+public:
+ QCLuceneQueryParser(const QString &field, QCLuceneAnalyzer &analyzer);
+ virtual ~QCLuceneQueryParser();
+
+ QCLuceneQuery* parse(const QString &query);
+ QCLuceneQuery* parse(QCLuceneReader &reader);
+ static QCLuceneQuery* parse(const QString &query, const QString &field,
+ QCLuceneAnalyzer &analyzer);
+ QCLuceneAnalyzer getAnalyzer();
+ QString getField();
+
+protected:
+ friend class QCLuceneMultiFieldQueryParser;
+ QSharedDataPointer<QCLuceneQueryParserPrivate> d;
+
+private:
+ QString field;
+ QCLuceneAnalyzer analyzer;
+};
+
+class QHELP_EXPORT QCLuceneMultiFieldQueryParser : public QCLuceneQueryParser
+{
+public:
+ enum FieldFlags {
+ NORMAL_FIELD = 0,
+ REQUIRED_FIELD = 1,
+ PROHIBITED_FIELD = 2
+ };
+
+ QCLuceneMultiFieldQueryParser(const QStringList &fieldList,
+ QCLuceneAnalyzer &analyzer);
+ ~QCLuceneMultiFieldQueryParser();
+
+ static QCLuceneQuery *parse(const QString &query, const QStringList &fieldList,
+ QCLuceneAnalyzer &analyzer);
+ static QCLuceneQuery *parse(const QString &query, const QStringList &fieldList,
+ QList<FieldFlags> flags, QCLuceneAnalyzer &analyzer);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUERYPARSER_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qreader.cpp b/tools/assistant/lib/fulltextsearch/qreader.cpp
new file mode 100644
index 0000000..792056d
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qreader.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qreader_p.h"
+#include "qclucene_global_p.h"
+
+#include <CLucene.h>
+#include <CLucene/util/Reader.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneReaderPrivate::QCLuceneReaderPrivate()
+ : QSharedData()
+{
+ reader = 0;
+ deleteCLuceneReader = true;
+}
+
+QCLuceneReaderPrivate::QCLuceneReaderPrivate(const QCLuceneReaderPrivate &other)
+ : QSharedData()
+{
+ reader = _CL_POINTER(other.reader);
+}
+
+QCLuceneReaderPrivate::~QCLuceneReaderPrivate()
+{
+ if (deleteCLuceneReader)
+ _CLDECDELETE(reader);
+}
+
+
+QCLuceneReader::QCLuceneReader()
+ : d(new QCLuceneReaderPrivate())
+{
+ // nothing todo
+}
+
+QCLuceneReader::~QCLuceneReader()
+{
+ // nothing todo
+}
+
+
+QCLuceneStringReader::QCLuceneStringReader(const QString &value)
+ : QCLuceneReader()
+ , string(QStringToTChar(value))
+{
+ d->reader = new lucene::util::StringReader(string);
+}
+
+QCLuceneStringReader::QCLuceneStringReader(const QString &value, qint32 length)
+ : QCLuceneReader()
+ , string(QStringToTChar(value))
+{
+ d->reader = new lucene::util::StringReader(string, int32_t(length));
+}
+
+QCLuceneStringReader::QCLuceneStringReader(const QString &value, qint32 length,
+ bool copyData)
+ : QCLuceneReader()
+ , string(QStringToTChar(value))
+{
+ d->reader = new lucene::util::StringReader(string, int32_t(length), copyData);
+}
+
+QCLuceneStringReader::~QCLuceneStringReader()
+{
+ delete [] string;
+}
+
+
+QCLuceneFileReader::QCLuceneFileReader(const QString &path, const QString &encoding,
+ qint32 cacheLength, qint32 cacheBuffer)
+ : QCLuceneReader()
+{
+ const QByteArray tmpPath = path.toLocal8Bit();
+ const QByteArray tmpEncoding = encoding.toAscii();
+ d->reader = new lucene::util::FileReader(tmpPath.constData(),
+ tmpEncoding.constData(), int32_t(cacheLength), int32_t(cacheBuffer));
+}
+
+QCLuceneFileReader::~QCLuceneFileReader()
+{
+ // nothing todo
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qreader_p.h b/tools/assistant/lib/fulltextsearch/qreader_p.h
new file mode 100644
index 0000000..77c8007
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qreader_p.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QREADER_P_H
+#define QREADER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qclucene_global_p.h"
+
+#include <QtCore/QString>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(util)
+ class Reader;
+CL_NS_END
+CL_NS_USE(util)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneField;
+class QCLuceneAnalyzer;
+class QCLuceneDocument;
+class QCLuceneQueryParser;
+class QCLuceneStandardTokenizer;
+
+class QHELP_EXPORT QCLuceneReaderPrivate : public QSharedData
+{
+public:
+ QCLuceneReaderPrivate();
+ QCLuceneReaderPrivate(const QCLuceneReaderPrivate &other);
+
+ ~QCLuceneReaderPrivate();
+
+ Reader* reader;
+ bool deleteCLuceneReader;
+
+private:
+ QCLuceneReaderPrivate &operator=(const QCLuceneReaderPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneReader
+{
+public:
+ QCLuceneReader();
+ virtual ~QCLuceneReader();
+
+protected:
+ friend class QCLuceneField;
+ friend class QCLuceneAnalyzer;
+ friend class QCLuceneDocument;
+ friend class QCLuceneQueryParser;
+ friend class QCLuceneStandardTokenizer;
+ QSharedDataPointer<QCLuceneReaderPrivate> d;
+};
+
+class QCLuceneStringReader : public QCLuceneReader
+{
+public:
+ QCLuceneStringReader(const QString &value);
+ QCLuceneStringReader(const QString &value, qint32 length);
+ QCLuceneStringReader(const QString &value, qint32 length, bool copyData);
+
+ ~QCLuceneStringReader();
+
+private:
+ TCHAR *string;
+};
+
+class QHELP_EXPORT QCLuceneFileReader : public QCLuceneReader
+{
+public:
+ QCLuceneFileReader(const QString &path, const QString &encoding,
+ qint32 cacheLength = 13, qint32 cacheBuffer = 14);
+ ~QCLuceneFileReader();
+};
+
+QT_END_NAMESPACE
+
+#endif // QREADER_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qsearchable.cpp b/tools/assistant/lib/fulltextsearch/qsearchable.cpp
new file mode 100644
index 0000000..2d76b02
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qsearchable.cpp
@@ -0,0 +1,195 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qsearchable_p.h"
+
+#include <CLucene.h>
+#include <CLucene/search/SearchHeader.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneSearchablePrivate::QCLuceneSearchablePrivate()
+ : QSharedData()
+{
+ searchable = 0;
+ deleteCLuceneSearchable = true;
+}
+
+QCLuceneSearchablePrivate::QCLuceneSearchablePrivate(const QCLuceneSearchablePrivate &other)
+ : QSharedData()
+{
+ searchable = _CL_POINTER(other.searchable);
+}
+
+QCLuceneSearchablePrivate::~QCLuceneSearchablePrivate()
+{
+ if (deleteCLuceneSearchable)
+ _CLDECDELETE(searchable);
+}
+
+
+QCLuceneSearchable::QCLuceneSearchable()
+ : d(new QCLuceneSearchablePrivate())
+{
+ // nothing todo
+}
+
+QCLuceneSearchable::~QCLuceneSearchable()
+{
+ // nothing todo
+}
+
+
+QCLuceneSearcher::QCLuceneSearcher()
+ : QCLuceneSearchable()
+{
+ // nothing todo
+}
+
+QCLuceneSearcher::~QCLuceneSearcher()
+{
+ // nothing todo;
+}
+
+QCLuceneHits QCLuceneSearcher::search(const QCLuceneQuery &query)
+{
+ return search(query, QCLuceneFilter());
+}
+
+QCLuceneHits QCLuceneSearcher::search(const QCLuceneQuery &query,
+ const QCLuceneFilter &filter)
+{
+ return QCLuceneHits(*this, query, filter);
+}
+
+QCLuceneHits QCLuceneSearcher::search(const QCLuceneQuery &query,
+ const QCLuceneSort &sort)
+{
+ return QCLuceneHits(*this, query, QCLuceneFilter(), sort);
+}
+
+QCLuceneHits QCLuceneSearcher::search(const QCLuceneQuery &query,
+ const QCLuceneFilter &filter,
+ const QCLuceneSort &sort)
+{
+ return QCLuceneHits(*this, query, filter, sort);
+}
+
+
+QCLuceneIndexSearcher::QCLuceneIndexSearcher(const QString &path)
+ : QCLuceneSearcher()
+{
+ lucene::search::IndexSearcher *searcher =
+ new lucene::search::IndexSearcher(path);
+
+ reader.d->reader = searcher->getReader();
+ reader.d->deleteCLuceneIndexReader = false;
+
+ d->searchable = searcher;
+}
+
+QCLuceneIndexSearcher::QCLuceneIndexSearcher(const QCLuceneIndexReader &reader)
+ : QCLuceneSearcher()
+ , reader(reader)
+{
+ d->searchable = new lucene::search::IndexSearcher(reader.d->reader);
+}
+
+QCLuceneIndexSearcher::~QCLuceneIndexSearcher()
+{
+ // nothing todo
+}
+
+void QCLuceneIndexSearcher::close()
+{
+ d->searchable->close();
+}
+
+qint32 QCLuceneIndexSearcher::maxDoc() const
+{
+ return qint32(d->searchable->maxDoc());
+}
+
+QCLuceneIndexReader QCLuceneIndexSearcher::getReader()
+{
+ return reader;
+}
+
+bool QCLuceneIndexSearcher::doc(qint32 i, QCLuceneDocument &document)
+{
+ return d->searchable->doc(int32_t(i), document.d->document);
+}
+
+
+QCLuceneMultiSearcher::QCLuceneMultiSearcher(const QList<QCLuceneSearchable> searchables)
+: QCLuceneSearcher()
+{
+ lucene::search::Searchable** list=
+ _CL_NEWARRAY(lucene::search::Searchable*, searchables.count());
+
+ d->searchable = new lucene::search::MultiSearcher(list);
+
+ _CLDELETE_ARRAY(list);
+}
+
+QCLuceneMultiSearcher::~QCLuceneMultiSearcher()
+{
+ // nothing todo
+}
+
+void QCLuceneMultiSearcher::close()
+{
+ d->searchable->close();
+}
+
+qint32 QCLuceneMultiSearcher::maxDoc() const
+{
+ return qint32(d->searchable->maxDoc());
+}
+
+qint32 QCLuceneMultiSearcher::subDoc(qint32 index) const
+{
+ lucene::search::MultiSearcher *searcher =
+ static_cast<lucene::search::MultiSearcher*> (d->searchable);
+
+ if (searcher == 0)
+ return 0;
+
+ return qint32(searcher->subDoc(int32_t(index)));
+}
+
+qint32 QCLuceneMultiSearcher::subSearcher(qint32 index) const
+{
+ lucene::search::MultiSearcher *searcher =
+ static_cast<lucene::search::MultiSearcher*> (d->searchable);
+
+ if (searcher == 0)
+ return 0;
+
+ return qint32(searcher->subSearcher(int32_t(index)));
+}
+
+qint32 QCLuceneMultiSearcher::searcherIndex(qint32 index) const
+{
+ lucene::search::MultiSearcher *searcher =
+ static_cast<lucene::search::MultiSearcher*> (d->searchable);
+
+ if (searcher == 0)
+ return 0;
+
+ return qint32(searcher->searcherIndex(int32_t(index)));
+}
+
+bool QCLuceneMultiSearcher::doc(qint32 i, QCLuceneDocument &document)
+{
+ return d->searchable->doc(int32_t(i), document.d->document);
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qsearchable_p.h b/tools/assistant/lib/fulltextsearch/qsearchable_p.h
new file mode 100644
index 0000000..8e4da44
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qsearchable_p.h
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QSEARCHABLE_P_H
+#define QSEARCHABLE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qhits_p.h"
+#include "qsort_p.h"
+#include "qquery_p.h"
+#include "qfilter_p.h"
+#include "qdocument_p.h"
+#include "qindexreader_p.h"
+#include "qclucene_global_p.h"
+
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(search)
+ class Searcher;
+CL_NS_END
+CL_NS_USE(search)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneHits;
+class QCLuceneSearcher;
+class QCLuceneIndexSearcher;
+class QCLuceneMultiSearcher;
+
+class QHELP_EXPORT QCLuceneSearchablePrivate : public QSharedData
+{
+public:
+ QCLuceneSearchablePrivate();
+ QCLuceneSearchablePrivate(const QCLuceneSearchablePrivate &other);
+
+ ~QCLuceneSearchablePrivate();
+
+ Searcher *searchable;
+ bool deleteCLuceneSearchable;
+
+private:
+ QCLuceneSearchablePrivate &operator=(const QCLuceneSearchablePrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneSearchable
+{
+public:
+ virtual ~QCLuceneSearchable();
+
+protected:
+ friend class QCLuceneSearcher;
+ friend class QCLuceneIndexSearcher;
+ friend class QCLuceneMultiSearcher;
+ QSharedDataPointer<QCLuceneSearchablePrivate> d;
+
+private:
+ QCLuceneSearchable();
+};
+
+class QHELP_EXPORT QCLuceneSearcher : public QCLuceneSearchable
+{
+public:
+ QCLuceneSearcher();
+ virtual ~QCLuceneSearcher();
+
+ QCLuceneHits search(const QCLuceneQuery &query);
+ QCLuceneHits search(const QCLuceneQuery &query, const QCLuceneFilter &filter);
+ QCLuceneHits search(const QCLuceneQuery &query, const QCLuceneSort &sort);
+ QCLuceneHits search(const QCLuceneQuery &query, const QCLuceneFilter &filter,
+ const QCLuceneSort &sort);
+
+protected:
+ friend class QCLuceneHits;
+};
+
+class QHELP_EXPORT QCLuceneIndexSearcher : public QCLuceneSearcher
+{
+public:
+ QCLuceneIndexSearcher(const QString &path);
+ QCLuceneIndexSearcher(const QCLuceneIndexReader &reader);
+ ~QCLuceneIndexSearcher();
+
+ void close();
+ qint32 maxDoc() const;
+ QCLuceneIndexReader getReader();
+ bool doc(qint32 i, QCLuceneDocument &document);
+
+private:
+ QCLuceneIndexReader reader;
+};
+
+class QHELP_EXPORT QCLuceneMultiSearcher : public QCLuceneSearcher
+{
+public:
+ QCLuceneMultiSearcher(const QList<QCLuceneSearchable> searchables);
+ ~QCLuceneMultiSearcher();
+
+ void close();
+ qint32 maxDoc() const;
+ qint32 subDoc(qint32 index) const;
+ qint32 subSearcher(qint32 index) const;
+ qint32 searcherIndex(qint32 index) const;
+ bool doc(qint32 i, QCLuceneDocument &document);
+};
+
+QT_END_NAMESPACE
+
+#endif // QSEARCHABLE_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qsort.cpp b/tools/assistant/lib/fulltextsearch/qsort.cpp
new file mode 100644
index 0000000..06d7276
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qsort.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qsort_p.h"
+#include "qclucene_global_p.h"
+
+#include <CLucene.h>
+#include <CLucene/search/Sort.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneSortPrivate::QCLuceneSortPrivate()
+ : QSharedData()
+{
+ sort = 0;
+ deleteCLuceneSort = true;
+}
+
+QCLuceneSortPrivate::QCLuceneSortPrivate (const QCLuceneSortPrivate &other)
+ : QSharedData()
+{
+ sort = _CL_POINTER(other.sort);
+}
+
+QCLuceneSortPrivate::~QCLuceneSortPrivate()
+{
+ if (deleteCLuceneSort)
+ _CLDECDELETE(sort);
+}
+
+
+QCLuceneSort::QCLuceneSort()
+ : d(new QCLuceneSortPrivate())
+{
+ d->sort = new lucene::search::Sort();
+}
+
+QCLuceneSort::QCLuceneSort(const QStringList &fieldNames)
+ : d(new QCLuceneSortPrivate())
+{
+ d->sort = new lucene::search::Sort();
+ setSort(fieldNames);
+}
+
+QCLuceneSort::QCLuceneSort(const QString &field, bool reverse)
+ : d(new QCLuceneSortPrivate())
+{
+ d->sort = new lucene::search::Sort();
+ setSort(field, reverse);
+}
+
+QCLuceneSort::~QCLuceneSort()
+{
+ // nothing todo
+}
+
+QString QCLuceneSort::toString() const
+{
+ return TCharToQString(d->sort->toString());
+}
+
+void QCLuceneSort::setSort(const QStringList &fieldNames)
+{
+ TCHAR **nameArray = new TCHAR*[fieldNames.count()];
+ for (int i = 0; i < fieldNames.count(); ++i)
+ nameArray[i] = QStringToTChar(fieldNames.at(i));
+
+ d->sort->setSort((const TCHAR**)nameArray);
+
+ for (int i = 0; i < fieldNames.count(); ++i)
+ delete [] nameArray[i];
+ delete nameArray;
+}
+
+void QCLuceneSort::setSort(const QString &field, bool reverse)
+{
+ TCHAR *name = QStringToTChar(field);
+ d->sort->setSort(name, reverse);
+ delete [] name;
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qsort_p.h b/tools/assistant/lib/fulltextsearch/qsort_p.h
new file mode 100644
index 0000000..5ec2a06
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qsort_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QSORT_P_H
+#define QSORT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qclucene_global_p.h"
+
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(search)
+ class Sort;
+CL_NS_END
+CL_NS_USE(search)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneHits;
+class QCLuceneField;
+
+class QHELP_EXPORT QCLuceneSortPrivate : public QSharedData
+{
+public:
+ QCLuceneSortPrivate();
+ QCLuceneSortPrivate (const QCLuceneSortPrivate &other);
+
+ ~QCLuceneSortPrivate();
+
+ Sort *sort;
+ bool deleteCLuceneSort;
+
+private:
+ QCLuceneSortPrivate &operator=(const QCLuceneSortPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneSort
+{
+public:
+ QCLuceneSort();
+ QCLuceneSort(const QStringList &fieldNames);
+ QCLuceneSort(const QString &field, bool reverse = false);
+
+ virtual ~QCLuceneSort();
+
+ QString toString() const;
+ void setSort(const QStringList &fieldNames);
+ void setSort(const QString &field, bool reverse = false);
+
+protected:
+ friend class QCLuceneHits;
+ QSharedDataPointer<QCLuceneSortPrivate> d;
+};
+
+QT_END_NAMESPACE
+
+#endif // QSORT_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qterm.cpp b/tools/assistant/lib/fulltextsearch/qterm.cpp
new file mode 100644
index 0000000..156586f
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qterm.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qterm_p.h"
+#include "qclucene_global_p.h"
+
+#include <CLucene.h>
+#include <CLucene/index/IndexReader.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneTermPrivate::QCLuceneTermPrivate()
+ : QSharedData()
+{
+ term = 0;
+ deleteCLuceneTerm = true;
+}
+
+QCLuceneTermPrivate::QCLuceneTermPrivate(const QCLuceneTermPrivate &other)
+ : QSharedData()
+{
+ term = _CL_POINTER(other.term);
+}
+
+QCLuceneTermPrivate::~QCLuceneTermPrivate()
+{
+ if (deleteCLuceneTerm)
+ _CLDECDELETE(term);
+}
+
+
+QCLuceneTerm::QCLuceneTerm()
+ : d(new QCLuceneTermPrivate())
+{
+ d->term = new lucene::index::Term();
+}
+
+QCLuceneTerm::QCLuceneTerm(const QString &field, const QString &text)
+ : d(new QCLuceneTermPrivate())
+{
+ TCHAR *fieldName = QStringToTChar(field);
+ TCHAR *termText = QStringToTChar(text);
+
+ d->term = new lucene::index::Term(fieldName, termText);
+
+ delete [] fieldName;
+ delete [] termText;
+}
+
+QCLuceneTerm::QCLuceneTerm(const QCLuceneTerm &fieldTerm, const QString &text)
+ : d(new QCLuceneTermPrivate())
+{
+ TCHAR *termText = QStringToTChar(text);
+ d->term = new lucene::index::Term(fieldTerm.d->term, termText);
+ delete [] termText;
+}
+
+QCLuceneTerm::~QCLuceneTerm()
+{
+ // nothing todo
+}
+
+QString QCLuceneTerm::field() const
+{
+ return TCharToQString(d->term->field());
+}
+
+QString QCLuceneTerm::text() const
+{
+ return TCharToQString(d->term->text());
+}
+
+void QCLuceneTerm::set(const QString &field, const QString &text)
+{
+ set(field, text, true);
+}
+
+void QCLuceneTerm::set(const QCLuceneTerm &fieldTerm, const QString &text)
+{
+ set(fieldTerm.field(), text, false);
+}
+
+void QCLuceneTerm::set(const QString &field, const QString &text, bool internField)
+{
+ TCHAR *fieldName = QStringToTChar(field);
+ TCHAR *termText = QStringToTChar(text);
+
+ d->term->set(fieldName, termText, internField);
+
+ delete [] fieldName;
+ delete [] termText;
+}
+
+bool QCLuceneTerm::equals(const QCLuceneTerm &other) const
+{
+ return d->term->equals(other.d->term);
+}
+
+qint32 QCLuceneTerm::compareTo(const QCLuceneTerm &other) const
+{
+ return quint32(d->term->compareTo(other.d->term));
+}
+
+QString QCLuceneTerm::toString() const
+{
+ return TCharToQString(d->term->toString());
+}
+
+quint32 QCLuceneTerm::hashCode() const
+{
+ return quint32(d->term->hashCode());
+}
+
+quint32 QCLuceneTerm::textLength() const
+{
+ return quint32(d->term->textLength());
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qterm_p.h b/tools/assistant/lib/fulltextsearch/qterm_p.h
new file mode 100644
index 0000000..474c909
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qterm_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QTERM_P_H
+#define QTERM_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qclucene_global_p.h"
+
+#include <QtCore/QSharedData>
+#include <QtCore/QString>
+#include <QtCore/QSharedDataPointer>
+
+CL_NS_DEF(index)
+ class Term;
+CL_NS_END
+CL_NS_USE(index)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneTermQuery;
+class QCLuceneRangeQuery;
+class QCLucenePrefixQuery;
+class QCLuceneIndexReader;
+class QCLucenePhraseQuery;
+
+class QHELP_EXPORT QCLuceneTermPrivate : public QSharedData
+{
+public:
+ QCLuceneTermPrivate();
+ QCLuceneTermPrivate(const QCLuceneTermPrivate &other);
+
+ ~QCLuceneTermPrivate();
+
+ Term *term;
+ bool deleteCLuceneTerm;
+
+private:
+ QCLuceneTermPrivate &operator=(const QCLuceneTermPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneTerm
+{
+public:
+ QCLuceneTerm();
+ QCLuceneTerm(const QString &field, const QString &text);
+ QCLuceneTerm(const QCLuceneTerm &fieldTerm, const QString &text);
+
+ virtual ~QCLuceneTerm();
+
+ QString field() const;
+ QString text() const;
+
+ void set(const QString &field, const QString &text);
+ void set(const QCLuceneTerm &fieldTerm, const QString &text);
+ void set(const QString &field, const QString &text, bool internField);
+
+ bool equals(const QCLuceneTerm &other) const;
+ qint32 compareTo(const QCLuceneTerm &other) const;
+
+ QString toString() const;
+ quint32 hashCode() const;
+ quint32 textLength() const;
+
+protected:
+ friend class QCLuceneTermQuery;
+ friend class QCLuceneRangeQuery;
+ friend class QCLucenePrefixQuery;
+ friend class QCLuceneIndexReader;
+ friend class QCLucenePhraseQuery;
+ QSharedDataPointer<QCLuceneTermPrivate> d;
+};
+
+QT_END_NAMESPACE
+
+#endif // QTERM_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qtoken.cpp b/tools/assistant/lib/fulltextsearch/qtoken.cpp
new file mode 100644
index 0000000..fa5d62a
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qtoken.cpp
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qtoken_p.h"
+#include "qclucene_global_p.h"
+
+#include <CLucene.h>
+#include <CLucene/analysis/AnalysisHeader.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneTokenPrivate::QCLuceneTokenPrivate()
+ : QSharedData()
+{
+ token = 0;
+ deleteCLuceneToken = true;
+}
+
+QCLuceneTokenPrivate::QCLuceneTokenPrivate(const QCLuceneTokenPrivate &other)
+ : QSharedData()
+{
+ token = _CL_POINTER(other.token);
+}
+
+QCLuceneTokenPrivate::~QCLuceneTokenPrivate()
+{
+ if (deleteCLuceneToken)
+ _CLDECDELETE(token);
+}
+
+
+QCLuceneToken::QCLuceneToken()
+ : d(new QCLuceneTokenPrivate())
+ , tokenText(0)
+ , tokenType(0)
+{
+ d->token = new lucene::analysis::Token();
+}
+
+QCLuceneToken::QCLuceneToken(const QString &text, qint32 startOffset,
+ qint32 endOffset, const QString &defaultTyp)
+ : d(new QCLuceneTokenPrivate())
+ , tokenText(QStringToTChar(text))
+ , tokenType(QStringToTChar(defaultTyp))
+{
+ d->token = new lucene::analysis::Token(tokenText, int32_t(startOffset),
+ int32_t(endOffset), tokenType);
+}
+
+QCLuceneToken::~QCLuceneToken()
+{
+ delete [] tokenText;
+ delete [] tokenType;
+}
+
+quint32 QCLuceneToken::bufferLength() const
+{
+ return quint32(d->token->bufferLength());
+}
+
+void QCLuceneToken::growBuffer(quint32 size)
+{
+ d->token->growBuffer(size_t(size));
+}
+
+qint32 QCLuceneToken::positionIncrement() const
+{
+ return qint32(d->token->getPositionIncrement());
+}
+
+void QCLuceneToken::setPositionIncrement(qint32 positionIncrement)
+{
+ d->token->setPositionIncrement(int32_t(positionIncrement));
+}
+
+QString QCLuceneToken::termText() const
+{
+ return TCharToQString(d->token->termText());
+}
+
+void QCLuceneToken::setTermText(const QString &text)
+{
+ delete [] tokenText;
+ tokenText = QStringToTChar(text);
+ d->token->setText(tokenText);
+}
+
+quint32 QCLuceneToken::termTextLength() const
+{
+ return quint32(d->token->termTextLength());
+}
+
+void QCLuceneToken::resetTermTextLength() const
+{
+ d->token->resetTermTextLen();
+}
+
+qint32 QCLuceneToken::startOffset() const
+{
+ return quint32(d->token->startOffset());
+}
+
+void QCLuceneToken::setStartOffset(qint32 value)
+{
+ d->token->setStartOffset(int32_t(value));
+}
+
+qint32 QCLuceneToken::endOffset() const
+{
+ return quint32(d->token->endOffset());
+}
+
+void QCLuceneToken::setEndOffset(qint32 value)
+{
+ d->token->setEndOffset(int32_t(value));
+}
+
+QString QCLuceneToken::type() const
+{
+ return TCharToQString(d->token->type());
+}
+
+void QCLuceneToken::setType(const QString &type)
+{
+ delete [] tokenType;
+ tokenType = QStringToTChar(type);
+ d->token->setType(tokenType);
+}
+
+QString QCLuceneToken::toString() const
+{
+ return TCharToQString(d->token->toString());
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qtoken_p.h b/tools/assistant/lib/fulltextsearch/qtoken_p.h
new file mode 100644
index 0000000..1802f99
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qtoken_p.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QTOKEN_P_H
+#define QTOKEN_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qclucene_global_p.h"
+
+#include <QtCore/QString>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(analysis)
+ class Token;
+CL_NS_END
+CL_NS_USE(analysis)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneTokenizer;
+class QCLuceneTokenStream;
+class QCLuceneStandardTokenizer;
+
+class QHELP_EXPORT QCLuceneTokenPrivate : public QSharedData
+{
+public:
+ QCLuceneTokenPrivate();
+ QCLuceneTokenPrivate(const QCLuceneTokenPrivate &other);
+
+ ~QCLuceneTokenPrivate();
+
+ Token *token;
+ bool deleteCLuceneToken;
+
+private:
+ QCLuceneTokenPrivate &operator=(const QCLuceneTokenPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneToken
+{
+public:
+ QCLuceneToken();
+ QCLuceneToken(const QString &text, qint32 startOffset,
+ qint32 endOffset, const QString &defaultTyp = QLatin1String("word"));
+
+ virtual ~QCLuceneToken();
+
+ void set(const QString &text, qint32 startOffset,
+ qint32 endOffset, const QString &defaultTyp = QLatin1String("word"));
+
+ quint32 bufferLength() const;
+ void growBuffer(quint32 size);
+
+ qint32 positionIncrement() const;
+ void setPositionIncrement(qint32 positionIncrement);
+
+ QString termText() const;
+ void setTermText(const QString &text);
+
+ quint32 termTextLength() const;
+ void resetTermTextLength() const;
+
+ qint32 startOffset() const;
+ void setStartOffset(qint32 value);
+
+ qint32 endOffset() const;
+ void setEndOffset(qint32 value);
+
+ QString type() const;
+ void setType(const QString &type);
+
+ QString toString() const;
+
+protected:
+ friend class QCLuceneTokenizer;
+ friend class QCLuceneTokenStream;
+ friend class QCLuceneStandardTokenizer;
+ QSharedDataPointer<QCLuceneTokenPrivate> d;
+
+private:
+ TCHAR *tokenText;
+ TCHAR *tokenType;
+};
+
+QT_END_NAMESPACE
+
+#endif // QTOKEN_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qtokenizer.cpp b/tools/assistant/lib/fulltextsearch/qtokenizer.cpp
new file mode 100644
index 0000000..9a07387
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qtokenizer.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qtokenizer_p.h"
+#include "qclucene_global_p.h"
+
+#include <CLucene.h>
+#include <CLucene/analysis/AnalysisHeader.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneTokenizer::QCLuceneTokenizer()
+ : QCLuceneTokenStream()
+{
+ // nothing todo
+}
+
+QCLuceneTokenizer::QCLuceneTokenizer(const QCLuceneReader &reader)
+ : QCLuceneTokenStream()
+ , reader(reader)
+{
+ // nothing todo
+}
+
+QCLuceneTokenizer::~QCLuceneTokenizer()
+{
+ close();
+}
+
+void QCLuceneTokenizer::close()
+{
+ d->tokenStream->close();
+}
+
+bool QCLuceneTokenizer::next(QCLuceneToken &token)
+{
+ return d->tokenStream->next(token.d->token);
+}
+
+
+QCLuceneStandardTokenizer::QCLuceneStandardTokenizer(const QCLuceneReader &reader)
+ : QCLuceneTokenizer(reader)
+{
+ d->tokenStream =
+ new lucene::analysis::standard::StandardTokenizer(reader.d->reader);
+}
+
+QCLuceneStandardTokenizer::~QCLuceneStandardTokenizer()
+{
+ // nothing todo
+}
+
+bool QCLuceneStandardTokenizer::readApostrophe(const QString &string,
+ QCLuceneToken &token)
+{
+ lucene::analysis::standard::StandardTokenizer *stdTokenizer =
+ static_cast<lucene::analysis::standard::StandardTokenizer*> (d->tokenStream);
+
+ if (stdTokenizer == 0)
+ return false;
+
+ TCHAR* value = QStringToTChar(string);
+ lucene::util::StringBuffer buffer(value);
+ bool retValue = stdTokenizer->ReadApostrophe(&buffer, token.d->token);
+ delete [] value;
+
+ return retValue;
+}
+
+bool QCLuceneStandardTokenizer::readAt(const QString &string, QCLuceneToken &token)
+{
+ lucene::analysis::standard::StandardTokenizer *stdTokenizer =
+ static_cast<lucene::analysis::standard::StandardTokenizer*> (d->tokenStream);
+
+ if (stdTokenizer == 0)
+ return false;
+
+ TCHAR* value = QStringToTChar(string);
+ lucene::util::StringBuffer buffer(value);
+ bool retValue = stdTokenizer->ReadAt(&buffer, token.d->token);
+ delete [] value;
+
+ return retValue;
+}
+
+bool QCLuceneStandardTokenizer::readCompany(const QString &string,
+ QCLuceneToken &token)
+{
+ lucene::analysis::standard::StandardTokenizer *stdTokenizer =
+ static_cast<lucene::analysis::standard::StandardTokenizer*> (d->tokenStream);
+
+ if (stdTokenizer == 0)
+ return false;
+
+ TCHAR* value = QStringToTChar(string);
+ lucene::util::StringBuffer buffer(value);
+ bool retValue = stdTokenizer->ReadCompany(&buffer, token.d->token);
+ delete [] value;
+
+ return retValue;
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/fulltextsearch/qtokenizer_p.h b/tools/assistant/lib/fulltextsearch/qtokenizer_p.h
new file mode 100644
index 0000000..1e7916c
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qtokenizer_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QTOKENIZER_P_H
+#define QTOKENIZER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qtoken_p.h"
+#include "qreader_p.h"
+#include "qtokenstream_p.h"
+#include "qclucene_global_p.h"
+
+#include <QtCore/QChar>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+class QHELP_EXPORT QCLuceneTokenizer : public QCLuceneTokenStream
+{
+public:
+ QCLuceneTokenizer(const QCLuceneReader &reader);
+ virtual ~QCLuceneTokenizer();
+
+ void close();
+ bool next(QCLuceneToken &token);
+
+protected:
+ friend class QCLuceneStandardTokenizer;
+
+private:
+ QCLuceneTokenizer();
+ QCLuceneReader reader;
+};
+
+class QHELP_EXPORT QCLuceneStandardTokenizer : public QCLuceneTokenizer
+{
+public:
+ QCLuceneStandardTokenizer(const QCLuceneReader &reader);
+ ~QCLuceneStandardTokenizer();
+
+ bool readApostrophe(const QString &string, QCLuceneToken &token);
+ bool readAt(const QString &string, QCLuceneToken &token);
+ bool readCompany(const QString &string, QCLuceneToken &token);
+};
+
+class QCLuceneCharTokenizer : public QCLuceneTokenizer
+{
+
+};
+
+class QCLuceneLetterTokenizer : public QCLuceneCharTokenizer
+{
+
+};
+
+class QCLuceneLowerCaseTokenizer : public QCLuceneLetterTokenizer
+{
+
+};
+
+class QCLuceneWhitespaceTokenizer : public QCLuceneCharTokenizer
+{
+
+};
+
+class QCLuceneKeywordTokenizer : public QCLuceneTokenizer
+{
+
+};
+
+QT_END_NAMESPACE
+
+#endif // QTOKENIZER_P_H
diff --git a/tools/assistant/lib/fulltextsearch/qtokenstream.cpp b/tools/assistant/lib/fulltextsearch/qtokenstream.cpp
new file mode 100644
index 0000000..957a0c2
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qtokenstream.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#include "qtokenstream_p.h"
+
+#include <CLucene.h>
+#include <CLucene/analysis/AnalysisHeader.h>
+
+QT_BEGIN_NAMESPACE
+
+QCLuceneTokenStreamPrivate::QCLuceneTokenStreamPrivate()
+ : QSharedData()
+{
+ tokenStream = 0;
+ deleteCLuceneTokenStream = true;
+}
+
+QCLuceneTokenStreamPrivate::QCLuceneTokenStreamPrivate(const QCLuceneTokenStreamPrivate &other)
+ : QSharedData()
+{
+ tokenStream = _CL_POINTER(other.tokenStream);
+}
+
+QCLuceneTokenStreamPrivate::~QCLuceneTokenStreamPrivate()
+{
+ if (deleteCLuceneTokenStream)
+ _CLDECDELETE(tokenStream);
+}
+
+
+QCLuceneTokenStream::QCLuceneTokenStream()
+ : d(new QCLuceneTokenStreamPrivate())
+{
+ // nothing todo
+}
+
+QCLuceneTokenStream::~QCLuceneTokenStream()
+{
+ // nothing todo
+}
+
+void QCLuceneTokenStream::close()
+{
+ d->tokenStream->close();
+}
+
+bool QCLuceneTokenStream::next(QCLuceneToken &token)
+{
+ return d->tokenStream->next(token.d->token);
+}
+
+QT_END_NAMESPACE \ No newline at end of file
diff --git a/tools/assistant/lib/fulltextsearch/qtokenstream_p.h b/tools/assistant/lib/fulltextsearch/qtokenstream_p.h
new file mode 100644
index 0000000..ef6e715
--- /dev/null
+++ b/tools/assistant/lib/fulltextsearch/qtokenstream_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QCLucene library and is distributable under
+** the terms of the LGPL license as specified in the license.txt file.
+**
+****************************************************************************/
+
+#ifndef QTOKENSTREAM_P_H
+#define QTOKENSTREAM_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qtoken_p.h"
+#include "qclucene_global_p.h"
+
+#include <QtCore/QString>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedData>
+
+CL_NS_DEF(analysis)
+ class TokenStream;
+CL_NS_END
+CL_NS_USE(analysis)
+
+QT_BEGIN_NAMESPACE
+
+class QCLuceneAnalyzer;
+class QCLuceneTokenizer;
+class QCLuceneStopAnalyzer;
+class QCLuceneSimpleAnalyzer;
+class QCLuceneKeywordAnalyzer;
+class QCLuceneStandardAnalyzer;
+class QCLuceneWhitespaceAnalyzer;
+class QCLucenePerFieldAnalyzerWrapper;
+
+class QHELP_EXPORT QCLuceneTokenStreamPrivate : public QSharedData
+{
+public:
+ QCLuceneTokenStreamPrivate();
+ QCLuceneTokenStreamPrivate(const QCLuceneTokenStreamPrivate &other);
+
+ ~QCLuceneTokenStreamPrivate();
+
+ TokenStream *tokenStream;
+ bool deleteCLuceneTokenStream;
+
+private:
+ QCLuceneTokenStreamPrivate &operator=(const QCLuceneTokenStreamPrivate &other);
+};
+
+class QHELP_EXPORT QCLuceneTokenStream
+{
+public:
+ virtual ~QCLuceneTokenStream();
+
+ void close();
+ bool next(QCLuceneToken &token);
+
+protected:
+ friend class QCLuceneAnalyzer;
+ friend class QCLuceneTokenizer;
+ friend class QCLuceneStopAnalyzer;
+ friend class QCLuceneSimpleAnalyzer;
+ friend class QCLuceneKeywordAnalyzer;
+ friend class QCLuceneStandardAnalyzer;
+ friend class QCLuceneWhitespaceAnalyzer;
+ friend class QCLucenePerFieldAnalyzerWrapper;
+ QSharedDataPointer<QCLuceneTokenStreamPrivate> d;
+
+private:
+ QCLuceneTokenStream();
+};
+
+QT_END_NAMESPACE
+
+#endif // QTOKENSTREAM_P_H