+ fixed compilation with clucene 2.3

This commit is contained in:
kelson42 2012-02-07 23:41:03 +00:00
parent 1fb5194906
commit 0b50729e03
3 changed files with 10 additions and 3 deletions

View File

@ -21,6 +21,7 @@
#define KIWIX_CLUCENE_INDEXER_H #define KIWIX_CLUCENE_INDEXER_H
#include <CLucene.h> #include <CLucene.h>
#include <assert.h>
#include "indexer.h" #include "indexer.h"
#define MAX_BUFFER_SIZE 4200000 #define MAX_BUFFER_SIZE 4200000

View File

@ -53,12 +53,15 @@ void CluceneSearcher::terminate()
} }
std::string toString(const TCHAR* s){ std::string toString(const TCHAR* s){
/* Comment out for CLucene 2.3
int32_t len = _tcslen(s); int32_t len = _tcslen(s);
char* buf = new char[len+1]; char* buf = new char[len+1];
STRCPY_WtoA(buf,s,len+1); STRCPY_WtoA(buf,s,len+1);
string ret = buf; string ret = buf;
delete[] buf; delete[] buf;
return ret; */
return "";
// return ret;
} }
/* Search strings in the database */ /* Search strings in the database */
@ -66,6 +69,7 @@ std::string toString(const TCHAR* s){
const unsigned int resultEnd, const bool verbose) { const unsigned int resultEnd, const bool verbose) {
// Parse query // Parse query
/* Comment out for Clucene 2.3
lucene::analysis::standard::StandardAnalyzer* analyzer = new lucene::analysis::standard::StandardAnalyzer(); lucene::analysis::standard::StandardAnalyzer* analyzer = new lucene::analysis::standard::StandardAnalyzer();
QueryParser* parser = new QueryParser(_T("content"), analyzer); QueryParser* parser = new QueryParser(_T("content"), analyzer);
STRCPY_AtoT(buffer, search.c_str(), MAX_BUFFER_SIZE); STRCPY_AtoT(buffer, search.c_str(), MAX_BUFFER_SIZE);
@ -96,6 +100,7 @@ std::string toString(const TCHAR* s){
i + 1, d->get(_T("title")), d->get(_T("url")), i + 1, d->get(_T("title")), d->get(_T("url")),
hits->score(i)); hits->score(i));
} }
*/
/* /*
Result result; Result result;
result.url = doc.get_data(); result.url = doc.get_data();
@ -105,8 +110,8 @@ std::string toString(const TCHAR* s){
this->results.push_back(result); this->results.push_back(result);
*/ */
delete hits; // delete hits;
delete query; // delete query;
return; return;
} }

View File

@ -21,6 +21,7 @@
#define KIWIX_CLUCENE_SEARCHER_H #define KIWIX_CLUCENE_SEARCHER_H
#include <CLucene.h> #include <CLucene.h>
#include <assert.h>
#include <CLucene/queryParser/MultiFieldQueryParser.h> #include <CLucene/queryParser/MultiFieldQueryParser.h>
#include "searcher.h" #include "searcher.h"