File trunk.diff of Package strigi
Index: src/luceneindexer/jsgzipcompressstream.cpp
===================================================================
--- src/luceneindexer/jsgzipcompressstream.cpp (.../tags/strigi/strigi/0.5.11) (revision 838616)
+++ src/luceneindexer/jsgzipcompressstream.cpp (.../trunk/kdesupport/strigi) (revision 838616)
@@ -17,6 +17,7 @@
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
+#include <CLucene/StdHeader.h>
#include "jsgzipcompressstream.h"
#include <CLucene/util/jstreamsconfig.h>
#include <zlib.h>
Index: src/luceneindexer/cluceneindexmanager.cpp
===================================================================
--- src/luceneindexer/cluceneindexmanager.cpp (.../tags/strigi/strigi/0.5.11) (revision 838616)
+++ src/luceneindexer/cluceneindexmanager.cpp (.../trunk/kdesupport/strigi) (revision 838616)
@@ -30,10 +30,12 @@
#include "indexplugin.h"
#include <iostream>
#include <sys/types.h>
+#include <sys/stat.h>
#include <time.h>
#include "timeofday.h"
#include "stgdirent.h" //our dirent compatibility header... uses native if available
+using namespace std;
/* define and export the index factory */
REGISTER_STRIGI_INDEXMANAGER(CLuceneIndexManager)
Index: src/luceneindexer/cluceneindexwriter.cpp
===================================================================
--- src/luceneindexer/cluceneindexwriter.cpp (.../tags/strigi/strigi/0.5.11) (revision 838616)
+++ src/luceneindexer/cluceneindexwriter.cpp (.../trunk/kdesupport/strigi) (revision 838616)
@@ -102,10 +102,21 @@
AnalyzerConfiguration::FieldType type, const TCHAR* name,
const TCHAR* value) {
CLuceneDocData* doc = static_cast<CLuceneDocData*>(idx->writerData());
- Field* field = new Field(name, value,
- (type & AnalyzerConfiguration::Stored) == AnalyzerConfiguration::Stored,
- (type & AnalyzerConfiguration::Indexed) == AnalyzerConfiguration::Indexed,
- (type & AnalyzerConfiguration::Tokenized) == AnalyzerConfiguration::Tokenized);
+ int config = 0;
+ if ( (type & AnalyzerConfiguration::Stored) == AnalyzerConfiguration::Stored )
+ config |= Field::STORE_YES;
+ else
+ config |= Field::STORE_NO;
+
+ if ( (type & AnalyzerConfiguration::Indexed) == AnalyzerConfiguration::Indexed ){
+ if ( (type & AnalyzerConfiguration::Tokenized) == AnalyzerConfiguration::Tokenized )
+ config |= Field::INDEX_TOKENIZED;
+ else
+ config |= Field::INDEX_UNTOKENIZED;
+ }else
+ config |= Field::INDEX_NO;
+
+ Field* field = new Field(name, value, config);
doc->doc.add(*field);
}
void
@@ -177,7 +188,7 @@
const TCHAR* mappedFn = mapId(_T(""));
#if defined(_UCS2)
#ifndef STRIGI_USE_CLUCENE_COMPRESSEDFIELDS
- doc->doc.add(*Field::Text(mappedFn, c.c_str(), false));
+ doc->doc.add(*new Field(mappedFn, c.c_str(), Field::STORE_YES | Field::INDEX_TOKENIZED));
#else
// lets store the content as utf8. remember, the stream is required
// until the document is added, so a static construction of stringreader
@@ -193,7 +204,7 @@
Field::STORE_NO | Field::INDEX_TOKENIZED));
#endif
#else //_UCS2
- doc->doc.add(*Field::Text(mappedFn, doc->content.c_str()) );
+ doc->doc.add(*new Field(mappedFn, doc->content.c_str(), Field::STORE_YES | Field::INDEX_TOKENIZED) );
#endif
}
lucene::index::IndexWriter* writer = manager->refWriter();
@@ -237,7 +248,7 @@
if (!reader->isDeleted(i)) {
Document* d = reader->document(i);
const TCHAR* t = d->get(systemlocation());
- if (t && _tcsncmp(t, prefixText, prefixLen) == 0) {
+ if (t && wcsncmp(t, prefixText, prefixLen) == 0) {
try {
reader->deleteDocument(i);
} catch (CLuceneError& err) {
@@ -305,7 +316,7 @@
else if ( strncmp(ext,".f",2)==0 ){
const char* n = ext+2;
- if ( *n && _istdigit(*n) )
+ if ( *n && isdigit(*n) )
return true;
}
@@ -335,6 +346,9 @@
if (!locked) {
return;
}
+ /*
+ //this is a hack and will not work with new versions of the index..
+ //furthermore, segmentinfos is a private class.
lucene::index::SegmentInfos infos;
try {
//Have SegmentInfos read the segments file in directory
@@ -383,6 +397,7 @@
_CLDELETE_CaARRAY(files[i]);
}
_CLDELETE_ARRAY(files);
+ */
}
void
Index: src/luceneindexer/cluceneindexreader.cpp
===================================================================
--- src/luceneindexer/cluceneindexreader.cpp (.../tags/strigi/strigi/0.5.11) (revision 838616)
+++ src/luceneindexer/cluceneindexreader.cpp (.../trunk/kdesupport/strigi) (revision 838616)
@@ -33,6 +33,7 @@
#include "tcharutils.h"
#include <CLucene/search/QueryFilter.h>
#include <CLucene/index/Terms.h>
+#include <CLucene/store/RAMDirectory.h>
#include "fieldtypes.h"
#include <sstream>
#include <iostream>
@@ -57,6 +58,8 @@
using Strigi::Variant;
using Strigi::FieldRegister;
+using namespace std;
+
class HitCounter : public HitCollector {
private:
int32_t m_count;
@@ -725,7 +728,6 @@
} catch (CLuceneError& err) {
printf("could not query: %s\n", err.what());
}
- char cstr[CL_MAX_DIR];
wstring field = utf8toucs2(fieldname);
int32_t max = INT_MIN;
int32_t min = INT_MAX;
@@ -737,7 +739,7 @@
const TCHAR* v = d->get(field.c_str());
if (v) {
int val = (int)strtol(wchartoutf8( v ).c_str(), &end, 10);
- if (end == cstr || *end != 0) {
+ if ( *end != 0) {
_CLDELETE(hits);
return h;
}
@@ -802,7 +804,7 @@
lastTerm = enumerator->term(false);
if (lastTerm) {
if (prefixLen > lastTerm->textLength()
- || _tcsncmp(lastTerm->text(), prefixtext, prefixLen)
+ || wcsncmp(lastTerm->text(), prefixtext, prefixLen)
!= 0) {
break;
}
Index: src/streamanalyzer/eventplugins/riffeventanalyzer.cpp
===================================================================
--- src/streamanalyzer/eventplugins/riffeventanalyzer.cpp (.../tags/strigi/strigi/0.5.11) (revision 838616)
+++ src/streamanalyzer/eventplugins/riffeventanalyzer.cpp (.../trunk/kdesupport/strigi) (revision 838616)
@@ -24,6 +24,7 @@
#include "streameventanalyzer.h"
#include "analyzerplugin.h"
#include <stack>
+#include <iostream>
namespace Strigi {
class RegisteredField;
@@ -133,6 +134,7 @@
a->addValue(f->resolutionHeightField, readLittleEndianUInt32(c+36));
return true;
}
+
bool
RiffEventAnalyzer::processStrh() {
AnalysisResult* a = analysisresult;
@@ -249,7 +251,7 @@
uint32_t length) {
const RiffChunk &chunk = chunks.top();
- // short WAVE intermezze ...
+ // short WAVE intermezzo ...
if (chunk.type == 0x61746164) { // data
if (bytes_per_second) {
float wav_seconds = chunk.size / (float)bytes_per_second;
@@ -312,7 +314,7 @@
if (r.size % 2 == 1) {
r.size++;
}
- if (r.size > 0) {
+ if (r.size > 0 || r.type == 0x46464952) {
chunks.push(r);
// is this a RIFF or a LIST?
if (r.type == 0x46464952 || r.type == 0x5453494C) {
@@ -320,6 +322,9 @@
} else {
state = ChunkBody;
}
+ } else {
+ valid = false;
+ return;
}
pos += 8;
} else if (state == StartOfChunkList) {
Index: src/streamanalyzer/CMakeLists.txt
===================================================================
--- src/streamanalyzer/CMakeLists.txt (.../tags/strigi/strigi/0.5.11) (revision 838616)
+++ src/streamanalyzer/CMakeLists.txt (.../trunk/kdesupport/strigi) (revision 838616)
@@ -98,6 +98,7 @@
indexreader.h
indexmanager.h
indexplugin.h
+ indexpluginloader.h
indexwriter.h
variant.h
query.h