|
From: <ust...@us...> - 2008-12-07 22:29:49
|
Revision: 2944
http://clucene.svn.sourceforge.net/clucene/?rev=2944&view=rev
Author: ustramooner
Date: 2008-12-07 22:29:45 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
fix for various pedantic warnings
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/index/SegmentInfos.cpp
branches/lucene2_3_2/src/core/CLucene/queryParser/MultiFieldQueryParser.cpp
branches/lucene2_3_2/src/test/CLMonolithic_Test.cpp
branches/lucene2_3_2/src/test/analysis/TestAnalyzers.cpp
branches/lucene2_3_2/src/test/debug/TestError.cpp
branches/lucene2_3_2/src/test/index/TestHighFreqTerms.cpp
branches/lucene2_3_2/src/test/index/TestIndexWriter.cpp
branches/lucene2_3_2/src/test/index/TestUtf8.cpp
branches/lucene2_3_2/src/test/queryParser/TestMultiFieldQueryParser.cpp
branches/lucene2_3_2/src/test/search/TestSearch.cpp
branches/lucene2_3_2/src/test/search/TestTermVector.cpp
branches/lucene2_3_2/src/test/testall.cpp
Modified: branches/lucene2_3_2/src/core/CLucene/index/SegmentInfos.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/index/SegmentInfos.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/core/CLucene/index/SegmentInfos.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -44,8 +44,8 @@
this->dir = _dir;
}
-SegmentInfo::SegmentInfo(const char* _name, const int32_t _docCount, CL_NS(store)::Directory* _dir,
- bool _isCompoundFile, bool _hasSingleNormFile,
+SegmentInfo::SegmentInfo(const char* _name, const int32_t _docCount, CL_NS(store)::Directory* _dir,
+ bool _isCompoundFile, bool _hasSingleNormFile,
int32_t _docStoreOffset, const char* _docStoreSegment, bool _docStoreIsCompoundFile)
:
docCount(_docCount),
@@ -940,7 +940,7 @@
// try it if so:
const char* prevSegmentFileName = IndexFileNames::fileNameFromGeneration( IndexFileNames::SEGMENTS, "", gen-1 );
- bool prevExists;
+ bool prevExists=false;
if (directory != NULL)
prevExists = directory->fileExists(prevSegmentFileName);
//todo: File implementation below
Modified: branches/lucene2_3_2/src/core/CLucene/queryParser/MultiFieldQueryParser.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/queryParser/MultiFieldQueryParser.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/core/CLucene/queryParser/MultiFieldQueryParser.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -37,7 +37,7 @@
int32_t i = 0;
while ( fields[i] != NULL ){
Query* q = QueryParser::parse(query, fields[i], analyzer);
- if (q && (q->getQueryName()!="BooleanQuery" || ((BooleanQuery*)q)->getClauseCount() > 0)) {
+ if (q && (q->getQueryName()!=BooleanQuery::getClassName() || ((BooleanQuery*)q)->getClauseCount() > 0)) {
//todo: Move to using BooleanClause::Occur
bQuery->add(q, true, false, false);
} else {
@@ -57,7 +57,7 @@
while ( fields[i] != NULL )
{
Query* q = QueryParser::parse(query, fields[i], analyzer);
- if (q && (q->getQueryName()!="BooleanQuery" || ((BooleanQuery*)q)->getClauseCount() > 0)) {
+ if (q && (q->getQueryName()!=BooleanQuery::getClassName() || ((BooleanQuery*)q)->getClauseCount() > 0)) {
uint8_t flag = flags[i];
switch (flag)
{
Modified: branches/lucene2_3_2/src/test/CLMonolithic_Test.cpp
===================================================================
--- branches/lucene2_3_2/src/test/CLMonolithic_Test.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/CLMonolithic_Test.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -25,6 +25,7 @@
#include "debug/TestError.cpp"
#include "document/TestDocument.cpp"
#include "queryParser/TestQueryParser.cpp"
+#include "queryParser/TestMultiFieldQueryParser.cpp"
#include "search/TestSearch.cpp"
#include "search/TestSort.cpp"
#include "search/TestTermVector.cpp"
Modified: branches/lucene2_3_2/src/test/analysis/TestAnalyzers.cpp
===================================================================
--- branches/lucene2_3_2/src/test/analysis/TestAnalyzers.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/analysis/TestAnalyzers.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -10,7 +10,6 @@
Reader* reader = _CLNEW StringReader(input);
TokenStream* ts = a->tokenStream(_T("dummy"), reader );
- int32_t i = 0;
const TCHAR* pos = output;
TCHAR buffer[80];
const TCHAR* last = output;
Modified: branches/lucene2_3_2/src/test/debug/TestError.cpp
===================================================================
--- branches/lucene2_3_2/src/test/debug/TestError.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/debug/TestError.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -13,7 +13,6 @@
const char* msg = "test";
CLuceneError err ( 0,msg,false );
CLuceneError err2 = err;
- CLuceneError* err3 = &err;
CuAssert ( tc,_T ( "Error did not copy properly" ),err.what() !=err2.what() );
CuAssert ( tc,_T ( "Error values did not correspond" ),strcmp ( err.what(),err2.what() ) ==0 );
Modified: branches/lucene2_3_2/src/test/index/TestHighFreqTerms.cpp
===================================================================
--- branches/lucene2_3_2/src/test/index/TestHighFreqTerms.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/index/TestHighFreqTerms.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -32,7 +32,6 @@
};
void _TestHighFreqTerms(const char* index, size_t numTerms) {
- uint64_t start = Misc::currentTimeMillis();
IndexReader* reader = IndexReader::open(index);
Modified: branches/lucene2_3_2/src/test/index/TestIndexWriter.cpp
===================================================================
--- branches/lucene2_3_2/src/test/index/TestIndexWriter.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/index/TestIndexWriter.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -33,7 +33,6 @@
//test the ram loading
RAMDirectory ram2(&ram);
IndexReader* reader2 = IndexReader::open(&ram2);
- SegmentReader* segreader = (SegmentReader*)reader2;
Term* term = _CLNEW Term(_T("field"),fld);
TermEnum* en = reader2->terms(term);
CLUCENE_ASSERT(en->next());
Modified: branches/lucene2_3_2/src/test/index/TestUtf8.cpp
===================================================================
--- branches/lucene2_3_2/src/test/index/TestUtf8.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/index/TestUtf8.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -46,7 +46,6 @@
void testUTF8(CuTest *tc) {
RAMDirectory ram;
- Directory* pram = &ram;
StandardAnalyzer a;
IndexWriter ndx(&ram,&a,true);
_Index(tc, &ndx,"arabic");
Modified: branches/lucene2_3_2/src/test/queryParser/TestMultiFieldQueryParser.cpp
===================================================================
--- branches/lucene2_3_2/src/test/queryParser/TestMultiFieldQueryParser.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/queryParser/TestMultiFieldQueryParser.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -6,7 +6,7 @@
------------------------------------------------------------------------------*/
#include "test.h"
-class QPTestFilter: public TokenFilter {
+class MQPTestFilter: public TokenFilter {
public:
bool inPhrase;
@@ -16,7 +16,7 @@
* Filter which discards the token 'stop' and which expands the
* token 'phrase' into 'phrase1 phrase2'
*/
- QPTestFilter(TokenStream* in):
+ MQPTestFilter(TokenStream* in):
TokenFilter(in,true),
inPhrase(false),
savedStart(0),
@@ -46,14 +46,14 @@
}
};
-class QPTestAnalyzer: public Analyzer {
+class MQPTestAnalyzer: public Analyzer {
public:
- QPTestAnalyzer() {
+ MQPTestAnalyzer() {
}
/** Filters LowerCaseTokenizer with StopFilter. */
TokenStream* tokenStream(const TCHAR* fieldName, Reader* reader) {
- return _CLNEW QPTestFilter(_CLNEW LowerCaseTokenizer(reader));
+ return _CLNEW MQPTestFilter(_CLNEW LowerCaseTokenizer(reader));
}
};
@@ -74,7 +74,7 @@
void assertStopQueryEquals(CuTest *tc, const TCHAR* qtxt, const TCHAR* expectedRes) {
const TCHAR* fields[] = {_T("b"), _T("t"), NULL };
//Occur occur[] = {Occur.SHOULD, Occur.SHOULD};
- QPTestAnalyzer *a = _CLNEW QPTestAnalyzer();
+ MQPTestAnalyzer *a = _CLNEW MQPTestAnalyzer();
MultiFieldQueryParser mfqp(fields, a);
Query *q = mfqp.parse(qtxt);
Modified: branches/lucene2_3_2/src/test/search/TestSearch.cpp
===================================================================
--- branches/lucene2_3_2/src/test/search/TestSearch.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/search/TestSearch.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -351,9 +351,9 @@
Term* t = _CLNEW Term(_T("contents"), _T("a"));
query.add(_CLNEW TermQuery(t),true,false, false);
_CLDECDELETE(t);
- Hits* hits = searcher.search(&query);
- for ( int32_t x=0;x<hits->length();x++ ){
- Document& doc = hits->doc(x);
+ Hits* hits = searcher.search(&query);
+ for ( int32_t x=0;x<hits->length();x++ ){
+ hits->doc(x);
}
_CLDELETE(hits);
searcher.close();
Modified: branches/lucene2_3_2/src/test/search/TestTermVector.cpp
===================================================================
--- branches/lucene2_3_2/src/test/search/TestTermVector.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/search/TestTermVector.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -21,10 +21,10 @@
for (int32_t i = 0; i < hits->length(); i++)
{
- ObjectArray<TermFreqVector*> vector;
- CLUCENE_ASSERT(tv_searcher->getReader()->getTermFreqVectors(hits->id(i), (Array<TermFreqVector*>&)vector));
- CLUCENE_ASSERT(vector.length== 1);
- vector.deleteValues();
+ ObjectArray<TermFreqVector*> vector;
+ CLUCENE_ASSERT(tv_searcher->getReader()->getTermFreqVectors(hits->id(i), *(Array<TermFreqVector*>*)(&vector)));
+ CLUCENE_ASSERT(vector.length== 1);
+ vector.deleteValues();
}
_CLDELETE(hits);
@@ -172,6 +172,7 @@
float_t tf = sim->tf(freq);
float_t idf = sim->idf(term, &knownSearcher);
//float_t qNorm = sim.queryNorm()
+ idf += tf; //remove warning
int termsCount=0;
const TCHAR** terms = vector->getTerms();
@@ -181,6 +182,8 @@
//This is fine since we don't have stop words
float_t lNorm = sim->lengthNorm(_T("field"), termsCount);
+ lNorm ++;//remove warning
+
//float_t coord = sim.coord()
//System.out.println("TF: " + tf + " IDF: " + idf + " LenNorm: " + lNorm);
const TCHAR** vTerms = vector->getTerms();
@@ -212,6 +215,7 @@
//doc 3 should be the first hit b/c it is the shortest match
CLUCENE_ASSERT(hits->length() == 3);
float_t score = hits->score(0);
+ score++;
CLUCENE_ASSERT(2==hits->id(0) );
CLUCENE_ASSERT(3==hits->id(1) );
Modified: branches/lucene2_3_2/src/test/testall.cpp
===================================================================
--- branches/lucene2_3_2/src/test/testall.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/testall.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -40,7 +40,7 @@
#endif
#endif
int ret_result = 0;
- int i;
+ int i=0;
int exclude = 0;
int list_provided = 0;
CuSuiteList *alltests = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|