176 lines
6.6 KiB
Diff
176 lines
6.6 KiB
Diff
From: Jan Engelhardt <jengelh@inai.de>
|
|
Date: 2012-06-22 01:14:57.789674760 +0200
|
|
|
|
Make ZCP compilation succeed if distribution uses clucene-core 2.x.
|
|
|
|
---
|
|
ECtools/zarafa-search/ECAnalyzers.cpp | 14 +++++-----
|
|
ECtools/zarafa-search/ECAnalyzers.h | 5 +--
|
|
ECtools/zarafa-search/ECIndexDB.cpp | 4 +--
|
|
configure.ac | 45 +---------------------------------
|
|
4 files changed, 13 insertions(+), 55 deletions(-)
|
|
|
|
Index: zarafa-7.1.4/ECtools/zarafa-search/ECAnalyzers.cpp
|
|
===================================================================
|
|
--- zarafa-7.1.4.orig/ECtools/zarafa-search/ECAnalyzers.cpp
|
|
+++ zarafa-7.1.4/ECtools/zarafa-search/ECAnalyzers.cpp
|
|
@@ -78,24 +78,24 @@ EmailFilter::~EmailFilter() {
|
|
* @param token Output token
|
|
* @return false if no more token was available
|
|
*/
|
|
-bool EmailFilter::next(lucene::analysis::Token *token) {
|
|
+lucene::analysis::Token *EmailFilter::next(lucene::analysis::Token *token) {
|
|
// See if we had any stored tokens
|
|
if(part < parts.size()) {
|
|
token->set(parts[part].c_str(), 0, 0, _T("<EMAIL>"));
|
|
token->setPositionIncrement(0);
|
|
part++;
|
|
- return true;
|
|
+ return token;
|
|
} else {
|
|
// No more stored token, get a new one
|
|
if(!input->next(token))
|
|
- return false;
|
|
+ return NULL;
|
|
|
|
// Split EMAIL tokens into the various parts
|
|
if(wcscmp(token->type(), L"<EMAIL>") == 0) {
|
|
// Split into user, domain, com
|
|
- parts = tokenize((std::wstring)token->_termText, (std::wstring)L".@");
|
|
+ parts = tokenize((std::wstring)token->termBuffer(), (std::wstring)L".@");
|
|
// Split into user, domain.com
|
|
- std::vector<std::wstring> moreparts = tokenize((std::wstring)token->_termText, (std::wstring)L"@");
|
|
+ std::vector<std::wstring> moreparts = tokenize((std::wstring)token->termBuffer(), (std::wstring)L"@");
|
|
parts.insert(parts.end(), moreparts.begin(), moreparts.end());
|
|
|
|
// Only add parts once (unique parts)
|
|
@@ -105,7 +105,7 @@ bool EmailFilter::next(lucene::analysis:
|
|
part = 0;
|
|
}
|
|
|
|
- return true;
|
|
+ return token;
|
|
}
|
|
}
|
|
|
|
@@ -124,7 +124,7 @@ ECAnalyzer::~ECAnalyzer()
|
|
* @param reader Reader to read the bytestream to tokenize
|
|
* @return A TokenStream outputting the tokens to be indexed
|
|
*/
|
|
-lucene::analysis::TokenStream* ECAnalyzer::tokenStream(const TCHAR* fieldName, lucene::util::Reader* reader)
|
|
+lucene::analysis::TokenStream *ECAnalyzer::tokenStream(const TCHAR *fieldName, CL_NS(util)::BufferedReader *reader)
|
|
{
|
|
lucene::analysis::TokenStream* ret = _CLNEW lucene::analysis::standard::StandardTokenizer(reader);
|
|
ret = _CLNEW lucene::analysis::standard::StandardFilter(ret,true);
|
|
Index: zarafa-7.1.4/ECtools/zarafa-search/ECAnalyzers.h
|
|
===================================================================
|
|
--- zarafa-7.1.4.orig/ECtools/zarafa-search/ECAnalyzers.h
|
|
+++ zarafa-7.1.4/ECtools/zarafa-search/ECAnalyzers.h
|
|
@@ -50,7 +50,6 @@
|
|
#ifndef ANALYZERS_H
|
|
|
|
#include "CLucene/StdHeader.h"
|
|
-#include "CLucene/util/Reader.h"
|
|
#include "CLucene/analysis/standard/StandardAnalyzer.h"
|
|
#include "CLucene/analysis/AnalysisHeader.h"
|
|
|
|
@@ -68,7 +67,7 @@ class EmailFilter: public lucene::analys
|
|
public:
|
|
EmailFilter(lucene::analysis::TokenStream* in, bool deleteTokenStream);
|
|
virtual ~EmailFilter();
|
|
- bool next(lucene::analysis::Token* token);
|
|
+ lucene::analysis::Token *next(lucene::analysis::Token *token);
|
|
private:
|
|
lucene::analysis::Token curtoken;
|
|
|
|
@@ -86,7 +85,7 @@ public:
|
|
ECAnalyzer();
|
|
virtual ~ECAnalyzer();
|
|
|
|
- virtual lucene::analysis::TokenStream* tokenStream(const TCHAR* fieldName, CL_NS(util)::Reader* reader);
|
|
+ virtual lucene::analysis::TokenStream *tokenStream(const TCHAR *fieldName, CL_NS(util)::BufferedReader *reader);
|
|
};
|
|
|
|
#endif
|
|
Index: zarafa-7.1.4/ECtools/zarafa-search/ECIndexDB.cpp
|
|
===================================================================
|
|
--- zarafa-7.1.4.orig/ECtools/zarafa-search/ECIndexDB.cpp
|
|
+++ zarafa-7.1.4/ECtools/zarafa-search/ECIndexDB.cpp
|
|
@@ -68,7 +68,7 @@
|
|
#include <string>
|
|
#include <algorithm>
|
|
|
|
-#include <CLucene/util/Reader.h>
|
|
+#include <CLucene/util/CLStreams.h>
|
|
|
|
using namespace kyotocabinet;
|
|
|
|
@@ -305,7 +305,7 @@ HRESULT ECIndexDB::AddTerm(folderid_t fo
|
|
unsigned int len;
|
|
unsigned int keylen;
|
|
|
|
- lucene::util::StringReader reader(wstrTerm.c_str());
|
|
+ CL_NS(util)::StringReader reader(wstrTerm.c_str());
|
|
|
|
stream = m_lpAnalyzer->tokenStream(L"", &reader);
|
|
|
|
Index: zarafa-7.1.4/configure.ac
|
|
===================================================================
|
|
--- zarafa-7.1.4.orig/configure.ac
|
|
+++ zarafa-7.1.4/configure.ac
|
|
@@ -432,52 +432,11 @@ AC_SUBST(ICAL_LIBS)
|
|
CXXFLAGS=$CXXFLAGS_system
|
|
|
|
# Check for CLucene availability
|
|
-AC_ARG_WITH(clucene-lib-prefix,
|
|
- AC_HELP_STRING([--with-clucene-lib-prefix=PATH],[path to the clucene config file, e.g. /usr/lib/]),
|
|
- [CLUCENE_LIB_PREFIX=${withval}],[CLUCENE_LIB_PREFIX=/usr/lib])
|
|
-AC_ARG_WITH(clucene-include-prefix,
|
|
- AC_HELP_STRING([--with-clucene-include-prefix=PATH],[path to the clucene include files, e.g. /usr/include/]),
|
|
- [CLUCENE_INCLUDE_PREFIX=${withval}],[CLUCENE_INCLUDE_PREFIX=/usr/include])
|
|
-have_clucene=no
|
|
-# preprocessor doesn't check in /usr/lib{,64}/ for include files
|
|
-if test "x$CLUCENE_LIB_PREFIX" != "x"; then
|
|
- CXXFLAGS="$CXXFLAGS -I$CLUCENE_LIB_PREFIX"
|
|
- CPPFLAGS="$CPPFLAGS -I$CLUCENE_LIB_PREFIX"
|
|
-fi
|
|
-if test "x$CLUCENE_INCLUDE_PREFIX" != "x"; then
|
|
- CXXFLAGS="$CXXFLAGS -I$CLUCENE_INCLUDE_PREFIX"
|
|
- CPPFLAGS="$CPPFLAGS -I$CLUCENE_INCLUDE_PREFIX"
|
|
-fi
|
|
-# force add pthread in lucene test
|
|
-CXXFLAGS="$CXXFLAGS -pthread"
|
|
-if test -e "${CLUCENE_LIB_PREFIX}/libclucene.a"; then
|
|
-# lucene::index::IndexReader::open(const char *) in c++ style
|
|
-AC_CHECK_LIB(clucene, [_ZN6lucene5index11IndexReader4openEPKc],
|
|
- [ CLUCENE_LIBS="${CLUCENE_LIB_PREFIX}/libclucene.a"
|
|
- have_clucene=static
|
|
- ])
|
|
-else
|
|
-AC_CHECK_LIB(clucene, [_ZN6lucene5index11IndexReader4openEPKc],
|
|
- [ CLUCENE_LIBS="-lclucene"
|
|
- have_clucene=dynamic
|
|
- ])
|
|
-fi
|
|
-AC_MSG_CHECKING([library type for clucene])
|
|
-AC_MSG_RESULT([$have_clucene])
|
|
-AC_CHECK_HEADERS([CLucene.h],
|
|
- [ CLUCENE_CFLAGS="-DLUCENE_DISABLE_MEMTRACKING" ],
|
|
- [ have_clucene=no ])
|
|
-if test "x$CLUCENE_LIB_PREFIX" != "x"; then
|
|
- CLUCENE_CFLAGS="$CLUCENE_CFLAGS -I$CLUCENE_LIB_PREFIX"
|
|
-fi
|
|
-if test "x$CLUCENE_INCLUDE_PREFIX" != "x"; then
|
|
- CLUCENE_CFLAGS="$CLUCENE_CFLAGS -I$CLUCENE_INCLUDE_PREFIX"
|
|
-fi
|
|
+PKG_CHECK_MODULES([CLUCENE], [libclucene-core >= 2.3.3],
|
|
+ [have_clucene=dynamic], [have_clucene=no])
|
|
AM_CONDITIONAL([WITH_CLUCENE], [test "$have_clucene" != "no"])
|
|
AC_SUBST(CLUCENE_CFLAGS)
|
|
AC_SUBST(CLUCENE_LIBS)
|
|
-CXXFLAGS=$CXXFLAGS_system
|
|
-CPPFLAGS=$CPPFLAGS_system
|
|
|
|
# Check for google perftools tcmalloc availability
|
|
if test "$want_tcmalloc_full" = "yes"; then
|