|
From: <ust...@us...> - 2009-04-16 16:57:14
|
Revision: 2993
http://clucene.svn.sourceforge.net/clucene/?rev=2993&view=rev
Author: ustramooner
Date: 2009-04-16 16:57:04 +0000 (Thu, 16 Apr 2009)
Log Message:
-----------
fix for new stream mechanism
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/index/FieldsWriter.cpp
Modified: branches/lucene2_3_2/src/core/CLucene/index/FieldsWriter.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/index/FieldsWriter.cpp 2009-04-16 16:46:14 UTC (rev 2992)
+++ branches/lucene2_3_2/src/core/CLucene/index/FieldsWriter.cpp 2009-04-16 16:57:04 UTC (rev 2993)
@@ -169,7 +169,7 @@
//how do wemake sure we read the entire index in now???
//todo: we need to have a max amount, and guarantee its all in or throw an error..
//todo: make this value configurable....
- int32_t rl = stream->read(sd, sz, 0);
+ int32_t rl = stream->read(sd, sz, 1);
if ( rl < 0 ){
fieldsStream->writeVInt(0); //todo: could we detect this earlier and not actually write the field??
@@ -183,11 +183,15 @@
}else if ( field->stringValue() == NULL ){ //we must be using readerValue
CND_PRECONDITION(!field->isIndexed(), "Cannot store reader if it is indexed too")
- Reader* r = field->readerValue();
+ Reader* r = field->readerValue();
+ int32_t sz = r->size();
+ if ( sz < 0 )
+ sz = 10000000; //todo: we should warn the developer here....
+
//read the entire string
const TCHAR* rv;
- int64_t rl = r->read(rv, LUCENE_INT32_MAX_SHOULDBE, 0);
+ int64_t rl = r->read(rv, sz, 1);
if ( rl > LUCENE_INT32_MAX_SHOULDBE )
_CLTHROWA(CL_ERR_Runtime,"Field length too long");
else if ( rl < 0 )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|