# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= clucene VERSION= 2.3.3.4 KEYWORDS= textproc VARIANTS= standard SDESC[standard]= C++ port of Lucene search engine HOMEPAGE= https://clucene.sourceforge.net/ CONTACT= nobody DOWNLOAD_GROUPS= main SITES[main]= SF/clucene/clucene-core-unstable/2.3 DISTFILE[1]= clucene-core-2.3.3.4.tar.gz:main DF_INDEX= 1 SPKGS[standard]= single OPTIONS_AVAILABLE= none OPTIONS_STANDARD= none BUILD_DEPENDS= boost-libraries:dev:standard USES= cmake iconv zlib c++:single DISTNAME= clucene-core-2.3.3.4 FPC_EQUIVALENT= textproc/clucene PLIST_SUB= SOVERSION=2.3.3.4 CMAKE_ARGS= -DBUILD_CONTRIBS_LIB:BOOL=ON post-patch: ${REINPLACE_CMD} \ -e 's|%%DATADIR%%|share/clucene|' \ -e 's|libdata|lib|' \ ${WRKSRC}/src/core/CMakeLists.txt ${ECHO_CMD} 'SET(CMAKE_NO_BUILTIN_CHRPATH OFF CACHE BOOL "" FORCE)' \ >> ${WRKSRC}/CMakeLists.txt post-install: ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/*.so [FILE:160:descriptions/desc.single] CLucene is a C++ port of Lucene: the high-performance, full-featured text search engine written in Java. CLucene is faster than lucene as it is written in C++. [FILE:106:distinfo] ddfdc433dd8ad31b5c5819cc4404a8d2127472a3b720d3e744e8c51d79732eab 2241498 clucene-core-2.3.3.4.tar.gz [FILE:7639:manifests/plist.single] include/CLucene.h include/CLucene/ CLConfig.h LuceneThreads.h SharedHeader.h StdHeader.h clucene-config.h include/CLucene/analysis/ AnalysisHeader.h Analyzers.h CachingTokenFilter.h LanguageBasedAnalyzer.h PorterStemmer.h include/CLucene/analysis/cjk/CJKAnalyzer.h include/CLucene/analysis/de/ GermanAnalyzer.h GermanStemFilter.h GermanStemmer.h include/CLucene/analysis/standard/ StandardAnalyzer.h StandardFilter.h StandardTokenizer.h StandardTokenizerConstants.h include/CLucene/debug/ error.h lucenebase.h mem.h include/CLucene/document/ DateField.h DateTools.h Document.h Field.h FieldSelector.h NumberTools.h include/CLucene/ext/boost/ assert.hpp checked_delete.hpp config.hpp current_function.hpp memory_order.hpp shared_ptr.hpp throw_exception.hpp version.hpp include/CLucene/ext/boost/config/ abi_prefix.hpp abi_suffix.hpp auto_link.hpp posix_features.hpp requires_threads.hpp select_compiler_config.hpp select_platform_config.hpp select_stdlib_config.hpp suffix.hpp user.hpp warning_disable.hpp include/CLucene/ext/boost/config/abi/ borland_prefix.hpp borland_suffix.hpp msvc_prefix.hpp msvc_suffix.hpp include/CLucene/ext/boost/config/compiler/ borland.hpp codegear.hpp comeau.hpp common_edg.hpp compaq_cxx.hpp digitalmars.hpp gcc.hpp gcc_xml.hpp greenhills.hpp hp_acc.hpp intel.hpp kai.hpp metrowerks.hpp mpw.hpp pgi.hpp sgi_mipspro.hpp sunpro_cc.hpp vacpp.hpp visualc.hpp include/CLucene/ext/boost/config/no_tr1/ cmath.hpp complex.hpp functional.hpp memory.hpp utility.hpp include/CLucene/ext/boost/config/platform/ aix.hpp amigaos.hpp beos.hpp bsd.hpp cygwin.hpp hpux.hpp irix.hpp linux.hpp macos.hpp qnxnto.hpp solaris.hpp vxworks.hpp win32.hpp include/CLucene/ext/boost/config/stdlib/ dinkumware.hpp libcomo.hpp libstdcpp3.hpp modena.hpp msl.hpp roguewave.hpp sgi.hpp stlport.hpp vacpp.hpp include/CLucene/ext/boost/detail/ algorithm.hpp allocator_utilities.hpp atomic_count.hpp binary_search.hpp call_traits.hpp catch_exceptions.hpp compressed_pair.hpp container_fwd.hpp dynamic_bitset.hpp endian.hpp has_default_constructor.hpp identifier.hpp indirect_traits.hpp interlocked.hpp is_function_ref_tester.hpp is_incrementable.hpp is_xxx.hpp iterator.hpp lcast_precision.hpp lightweight_mutex.hpp lightweight_test.hpp lightweight_thread.hpp limits.hpp named_template_params.hpp no_exceptions_support.hpp none_t.hpp numeric_traits.hpp ob_call_traits.hpp ob_compressed_pair.hpp quick_allocator.hpp reference_content.hpp scoped_enum_emulation.hpp select_type.hpp sp_typeinfo.hpp templated_streams.hpp utf8_codecvt_facet.hpp workaround.hpp include/CLucene/ext/boost/exception/ all.hpp current_exception_cast.hpp diagnostic_information.hpp enable_current_exception.hpp enable_error_info.hpp errinfo_api_function.hpp errinfo_at_line.hpp errinfo_errno.hpp errinfo_file_handle.hpp errinfo_file_name.hpp errinfo_file_open_mode.hpp errinfo_nested_exception.hpp errinfo_type_info_name.hpp error_info.hpp exception.hpp get_error_info.hpp info.hpp info_tuple.hpp to_string.hpp to_string_stub.hpp include/CLucene/ext/boost/exception/detail/ attribute_noreturn.hpp error_info_impl.hpp exception_ptr.hpp is_output_streamable.hpp object_hex_dump.hpp type_info.hpp include/CLucene/ext/boost/smart_ptr/ bad_weak_ptr.hpp enable_shared_from_this.hpp enable_shared_from_this2.hpp intrusive_ptr.hpp make_shared.hpp scoped_array.hpp scoped_ptr.hpp shared_array.hpp shared_ptr.hpp weak_ptr.hpp include/CLucene/ext/boost/smart_ptr/detail/ atomic_count.hpp atomic_count_gcc.hpp atomic_count_gcc_x86.hpp atomic_count_pthreads.hpp atomic_count_solaris.hpp atomic_count_sync.hpp atomic_count_win32.hpp lightweight_mutex.hpp lwm_nop.hpp lwm_pthreads.hpp lwm_win32_cs.hpp operator_bool.hpp quick_allocator.hpp shared_array_nmt.hpp shared_count.hpp shared_ptr_nmt.hpp sp_convertible.hpp sp_counted_base.hpp sp_counted_base_acc_ia64.hpp sp_counted_base_cw_ppc.hpp sp_counted_base_cw_x86.hpp sp_counted_base_gcc_ia64.hpp sp_counted_base_gcc_mips.hpp sp_counted_base_gcc_ppc.hpp sp_counted_base_gcc_sparc.hpp sp_counted_base_gcc_x86.hpp sp_counted_base_nt.hpp sp_counted_base_pt.hpp sp_counted_base_solaris.hpp sp_counted_base_spin.hpp sp_counted_base_sync.hpp sp_counted_base_w32.hpp sp_counted_impl.hpp sp_has_sync.hpp spinlock.hpp spinlock_gcc_arm.hpp spinlock_nt.hpp spinlock_pool.hpp spinlock_pt.hpp spinlock_sync.hpp spinlock_w32.hpp yield_k.hpp include/CLucene/highlighter/ Encoder.h Formatter.h Fragmenter.h HighlightScorer.h Highlighter.h QueryScorer.h QueryTermExtractor.h Scorer.h SimpleFragmenter.h SimpleHTMLEncoder.h SimpleHTMLFormatter.h TextFragment.h TokenGroup.h TokenSources.h WeightedTerm.h include/CLucene/index/ DirectoryIndexReader.h IndexDeletionPolicy.h IndexModifier.h IndexReader.h IndexWriter.h MergePolicy.h MergeScheduler.h MultiReader.h MultipleTermPositions.h Payload.h Term.h TermVector.h Terms.h include/CLucene/queryParser/ MultiFieldQueryParser.h QueryParser.h QueryParserConstants.h QueryParserTokenManager.h QueryToken.h include/CLucene/queryParser/legacy/ MultiFieldQueryParser.h QueryParser.h QueryToken.h include/CLucene/search/ BooleanClause.h BooleanQuery.h CachingSpanFilter.h CachingWrapperFilter.h ChainedFilter.h Compare.h ConstantScoreQuery.h DateFilter.h Explanation.h FieldCache.h FieldDoc.h FieldSortedHitQueue.h Filter.h FilterResultCache.h FilteredTermEnum.h FuzzyQuery.h Hits.h IndexSearcher.h MatchAllDocsQuery.h MultiPhraseQuery.h MultiSearcher.h MultiTermQuery.h PhraseQuery.h PrefixQuery.h Query.h QueryFilter.h RangeFilter.h RangeQuery.h Scorer.h ScorerDocQueue.h SearchHeader.h Searchable.h Similarity.h Sort.h SpanFilter.h SpanFilterResult.h SpanQueryFilter.h TermQuery.h WildcardQuery.h WildcardTermEnum.h include/CLucene/search/spans/ SpanFirstQuery.h SpanNearQuery.h SpanNotQuery.h SpanOrQuery.h SpanQuery.h SpanScorer.h SpanTermQuery.h SpanWeight.h Spans.h include/CLucene/snowball/ SnowballAnalyzer.h SnowballFilter.h libstemmer.h include/CLucene/snowball/include/libstemmer.h include/CLucene/snowball/libstemmer/modules.h include/CLucene/snowball/runtime/ api.h header.h include/CLucene/snowball/src_c/ stem_ISO_8859_1_danish.h stem_ISO_8859_1_dutch.h stem_ISO_8859_1_english.h stem_ISO_8859_1_finnish.h stem_ISO_8859_1_french.h stem_ISO_8859_1_german.h stem_ISO_8859_1_italian.h stem_ISO_8859_1_norwegian.h stem_ISO_8859_1_porter.h stem_ISO_8859_1_portuguese.h stem_ISO_8859_1_spanish.h stem_ISO_8859_1_swedish.h stem_KOI8_R_russian.h stem_UTF_8_danish.h stem_UTF_8_dutch.h stem_UTF_8_english.h stem_UTF_8_finnish.h stem_UTF_8_french.h stem_UTF_8_german.h stem_UTF_8_italian.h stem_UTF_8_norwegian.h stem_UTF_8_porter.h stem_UTF_8_portuguese.h stem_UTF_8_russian.h stem_UTF_8_spanish.h stem_UTF_8_swedish.h include/CLucene/store/ Directory.h FSDirectory.h IndexInput.h IndexOutput.h Lock.h LockFactory.h RAMDirectory.h include/CLucene/util/ Array.h BitSet.h CLStreams.h Equators.h PriorityQueue.h Reader.h VoidList.h VoidMap.h arrayinputstream.h byteinputstream.h gzipcompressstream.h gzipinputstream.h streamarray.h lib/ libclucene-contribs-lib.so libclucene-contribs-lib.so.%%SOVERSION%% libclucene-contribs-lib.so.1 libclucene-core.so libclucene-core.so.%%SOVERSION%% libclucene-core.so.1 libclucene-shared.so libclucene-shared.so.%%SOVERSION%% libclucene-shared.so.1 lib/pkgconfig/libclucene-core.pc share/clucene/CLuceneConfig.cmake [FILE:320:patches/patch-CMakeLists.txt] --- CMakeLists.txt.orig 2011-03-17 00:21:07 UTC +++ CMakeLists.txt @@ -163,7 +163,7 @@ IF ( BUILD_CONTRIBS ) SET(BUILD_CONTRIBS_LIB 1) ENDIF ( BUILD_CONTRIBS ) IF ( BUILD_CONTRIBS_LIB ) - ADD_SUBDIRECTORY (src/contribs-lib EXCLUDE_FROM_ALL) + ADD_SUBDIRECTORY (src/contribs-lib) ENDIF ( BUILD_CONTRIBS_LIB ) [FILE:450:patches/patch-src__contribs-lib__CLucene__analysis__cjk__CJKAnalyzer.h] --- src/contribs-lib/CLucene/analysis/cjk/CJKAnalyzer.h.orig 2011-03-17 00:21:07 UTC +++ src/contribs-lib/CLucene/analysis/cjk/CJKAnalyzer.h @@ -39,7 +39,7 @@ private: * character buffer, store the characters which are used to compose
* the returned Token */ - TCHAR buffer[LUCENE_MAX_WORD_LEN]; + TCHAR buffer[LUCENE_MAX_WORD_LEN+1]; /** * I/O buffer, used to store the content of the input(one of the
[FILE:996:patches/patch-src__contribs-lib__CLucene__analysis__de__GermanStemmer.cpp] --- src/contribs-lib/CLucene/analysis/de/GermanStemmer.cpp.orig 2011-03-17 00:21:07 UTC +++ src/contribs-lib/CLucene/analysis/de/GermanStemmer.cpp @@ -16,7 +16,7 @@ CL_NS_USE2(analysis,de) } TCHAR* GermanStemmer::stem(const TCHAR* term, size_t length) { - if (length < 0) { + if (length <= 0) { length = _tcslen(term); } @@ -38,7 +38,7 @@ CL_NS_USE2(analysis,de) } bool GermanStemmer::isStemmable(const TCHAR* term, size_t length) const { - if (length < 0) { + if (length <= 0) { length = _tcslen(term); } for (size_t c = 0; c < length; c++) { @@ -144,7 +144,7 @@ CL_NS_USE2(analysis,de) { buffer.setCharAt( i, _T('$') ); buffer.deleteChars( i + 1, i + 3 ); - substCount =+ 2; + substCount += 2; } else if ( c == _T('c') && buffer.charAt( i + 1 ) == _T('h') ) { buffer.setCharAt( i, 0xa7 ); // section sign in UTF-16 [FILE:2092:patches/patch-src__contribs-lib__CLucene__highlighter__Highlighter.cpp] --- src/contribs-lib/CLucene/highlighter/Highlighter.cpp.orig 2011-03-17 00:21:07 UTC +++ src/contribs-lib/CLucene/highlighter/Highlighter.cpp @@ -214,8 +214,9 @@ CL_NS_USE(util) int32_t startOffset; int32_t endOffset; int32_t lastEndOffset = 0; + int len; _textFragmenter->start(text); - TCHAR substringBuffer[LUCENE_MAX_WORD_LEN]; + TCHAR substringBuffer[LUCENE_MAX_WORD_LEN+1]; TokenGroup* tokenGroup=_CLNEW TokenGroup(); @@ -229,8 +230,9 @@ CL_NS_USE(util) startOffset = tokenGroup->getStartOffset(); endOffset = tokenGroup->getEndOffset(); - _tcsncpy(substringBuffer,text+startOffset,endOffset-startOffset); - substringBuffer[endOffset-startOffset]=_T('\0'); + len = cl_min(endOffset-startOffset,LUCENE_MAX_WORD_LEN); + _tcsncpy(substringBuffer,text+startOffset,len); + substringBuffer[len]=_T('\0'); TCHAR* encoded = _encoder->encodeText(substringBuffer); TCHAR* markedUpText=_formatter->highlightTerm(encoded, tokenGroup); @@ -238,9 +240,7 @@ CL_NS_USE(util) //store any whitespace etc from between this and last group if (startOffset > lastEndOffset){ - int len = startOffset-lastEndOffset; - if ( len > LUCENE_MAX_FIELD_LEN ) - len = LUCENE_MAX_FIELD_LEN; + len = cl_min(startOffset-lastEndOffset,LUCENE_MAX_FIELD_LEN); _tcsncpy(buffer,text+lastEndOffset,len); buffer[len]=_T('\0'); @@ -287,8 +287,9 @@ CL_NS_USE(util) startOffset = tokenGroup->getStartOffset(); endOffset = tokenGroup->getEndOffset(); - _tcsncpy(substringBuffer,text+startOffset,endOffset-startOffset); - substringBuffer[endOffset-startOffset]=_T('\0'); + len = cl_min(endOffset-startOffset,LUCENE_MAX_WORD_LEN); + _tcsncpy(substringBuffer,text+startOffset,len); + substringBuffer[len]=_T('\0'); TCHAR* encoded = _encoder->encodeText(substringBuffer); TCHAR* markedUpText=_formatter->highlightTerm(encoded, tokenGroup); @@ -393,6 +394,7 @@ CL_NS_USE(util) } } ) + return NULL; } [FILE:381:patches/patch-src__contribs-lib__CLucene__highlighter__WeightedTerm.cpp] --- src/contribs-lib/CLucene/highlighter/WeightedTerm.cpp.orig 2011-03-17 00:21:07 UTC +++ src/contribs-lib/CLucene/highlighter/WeightedTerm.cpp @@ -73,7 +73,7 @@ CL_NS_DEF2(search,highlight) * @param weight the weight associated with this term */ void WeightedTerm::setWeight(float_t weight) { - this->_weight = _weight; + _weight = weight; cachedHashCode = 0; } [FILE:2580:patches/patch-src__contribs-lib__CLucene__snowball__Snowball.cpp] --- src/contribs-lib/CLucene/snowball/Snowball.cpp.orig 2011-03-17 00:21:07 UTC +++ src/contribs-lib/CLucene/snowball/Snowball.cpp @@ -19,16 +19,31 @@ CL_NS_USE2(analysis,standard) CL_NS_DEF2(analysis,snowball) + class SnowballAnalyzer::SavedStreams : public TokenStream { + public: + StandardTokenizer* tokenStream; + TokenStream* filteredTokenStream; + + SavedStreams():tokenStream(NULL), filteredTokenStream(NULL) {} + void close(){} + Token* next(Token* token) {return NULL;} + }; + /** Builds the named analyzer with no stop words. */ SnowballAnalyzer::SnowballAnalyzer(const TCHAR* language) { this->language = STRDUP_TtoT(language); stopSet = NULL; } - SnowballAnalyzer::~SnowballAnalyzer(){ - _CLDELETE_CARRAY(language); - if ( stopSet != NULL ) - _CLDELETE(stopSet); + SnowballAnalyzer::~SnowballAnalyzer() { + SavedStreams* streams = reinterpret_cast(getPreviousTokenStream()); + if (streams != NULL) { + _CLDELETE(streams->filteredTokenStream); + _CLDELETE(streams); + } + _CLDELETE_CARRAY(language); + if (stopSet != NULL) + _CLDELETE(stopSet); } /** Builds the named analyzer with the given stop words. @@ -62,12 +77,29 @@ CL_NS_DEF2(analysis,snowball) result = _CLNEW SnowballFilter(result, language, true); return result; } - - - - - - + + TokenStream* SnowballAnalyzer::reusableTokenStream(const TCHAR* fieldName, CL_NS(util)::Reader* reader) { + SavedStreams* streams = reinterpret_cast(getPreviousTokenStream()); + + if (streams == NULL) { + streams = _CLNEW SavedStreams(); + BufferedReader* bufferedReader = reader->__asBufferedReader(); + + if (bufferedReader == NULL) + streams->tokenStream = _CLNEW StandardTokenizer(_CLNEW FilteredBufferedReader(reader, false), true); + else + streams->tokenStream = _CLNEW StandardTokenizer(bufferedReader); + + streams->filteredTokenStream = _CLNEW StandardFilter(streams->tokenStream, true); + streams->filteredTokenStream = _CLNEW LowerCaseFilter(streams->filteredTokenStream, true); + if (stopSet != NULL) + streams->filteredTokenStream = _CLNEW StopFilter(streams->filteredTokenStream, true, stopSet); + streams->filteredTokenStream = _CLNEW SnowballFilter(streams->filteredTokenStream, language, true); + setPreviousTokenStream(streams); + } else + streams->tokenStream->reset(reader); + return streams->filteredTokenStream; + } /** Construct the named stemming filter. * [FILE:791:patches/patch-src__contribs-lib__CLucene__snowball__SnowballAnalyzer.h] --- src/contribs-lib/CLucene/snowball/SnowballAnalyzer.h.orig 2011-03-17 00:21:07 UTC +++ src/contribs-lib/CLucene/snowball/SnowballAnalyzer.h @@ -22,6 +22,7 @@ CL_NS_DEF2(analysis,snowball) class CLUCENE_CONTRIBS_EXPORT SnowballAnalyzer: public Analyzer { TCHAR* language; CLTCSetList* stopSet; + class SavedStreams; public: /** Builds the named analyzer with no stop words. */ @@ -37,6 +38,8 @@ public: StandardFilter}, a {@link LowerCaseFilter} and a {@link StopFilter}. */ TokenStream* tokenStream(const TCHAR* fieldName, CL_NS(util)::Reader* reader); TokenStream* tokenStream(const TCHAR* fieldName, CL_NS(util)::Reader* reader, bool deleteReader); + + TokenStream* reusableTokenStream(const TCHAR* fieldName, CL_NS(util)::Reader* reader); }; CL_NS_END2 [FILE:868:patches/patch-src__contribs-lib__CLucene__snowball__libstemmer__libstemmer.c] --- src/contribs-lib/CLucene/snowball/libstemmer/libstemmer.c.orig 2011-03-17 00:21:07 UTC +++ src/contribs-lib/CLucene/snowball/libstemmer/libstemmer.c @@ -35,9 +35,8 @@ sb_stemmer_new(const char * algorithm, c { stemmer_encoding enc; struct stemmer_modules * module; - struct sb_stemmer * stemmer = - (struct sb_stemmer *) malloc(sizeof(struct sb_stemmer)); - if (stemmer == NULL) return NULL; + struct sb_stemmer * stemmer; + enc = sb_getenc(charenc); if (enc == ENC_UNKNOWN) return NULL; @@ -46,6 +45,9 @@ sb_stemmer_new(const char * algorithm, c } if (module->name == NULL) return NULL; + stemmer = (struct sb_stemmer *) malloc(sizeof(struct sb_stemmer)); + if (stemmer == NULL) return NULL; + stemmer->create = module->create; stemmer->close = module->close; stemmer->stem = module->stem; [FILE:985:patches/patch-src__contribs-lib__CMakeLists.txt] --- src/contribs-lib/CMakeLists.txt.orig 2011-03-17 00:21:07 UTC +++ src/contribs-lib/CMakeLists.txt @@ -106,9 +106,26 @@ add_library(clucene-contribs-lib SHARED ) TARGET_LINK_LIBRARIES(clucene-contribs-lib ${clucene_contrib_extra_libs}) +#install public headers. +FOREACH(file ${HEADERS}) + get_filename_component(apath ${file} PATH) + get_filename_component(aname ${file} NAME) + file(RELATIVE_PATH relpath ${CMAKE_SOURCE_DIR}/src/contribs-lib ${apath}) + IF ( NOT aname MATCHES "^_.*" ) + install(FILES ${file} + DESTINATION include/${relpath} + COMPONENT development) + ENDIF ( NOT aname MATCHES "^_.*" ) +ENDFOREACH(file) + #set properties on the libraries SET_TARGET_PROPERTIES(clucene-contribs-lib PROPERTIES VERSION ${CLUCENE_VERSION} SOVERSION ${CLUCENE_SOVERSION} COMPILE_DEFINITIONS_DEBUG _DEBUG ) + +#and install library +install(TARGETS clucene-contribs-lib + DESTINATION ${LIB_DESTINATION} + COMPONENT runtime ) [FILE:394:patches/patch-src__core__CLucene__analysis__AnalysisHeader.cpp] --- src/core/CLucene/analysis/AnalysisHeader.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/analysis/AnalysisHeader.cpp @@ -212,7 +212,7 @@ TCHAR* Token::toString() const{ sb.append(_T(",")); sb.appendInt( _endOffset ); - if (!_tcscmp( _type, _T("word")) == 0 ){ + if (_tcscmp( _type, _T("word")) != 0) { sb.append(_T(",type=")); sb.append(_type); } [FILE:504:patches/patch-src__core__CLucene__index__DocumentsWriter.cpp] --- src/core/CLucene/index/DocumentsWriter.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/index/DocumentsWriter.cpp @@ -125,7 +125,7 @@ DocumentsWriter::~DocumentsWriter(){ if (this->postingsFreeListDW.values){ if (this->postingsFreeCountDW < this->postingsFreeListDW.length) { memset(this->postingsFreeListDW.values + this->postingsFreeCountDW - , NULL + , 0 , sizeof(Posting*)); } postingsFreeListDW.deleteUntilNULL(); [FILE:695:patches/patch-src__core__CLucene__index__DocumentsWriterThreadState.cpp] --- src/core/CLucene/index/DocumentsWriterThreadState.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/index/DocumentsWriterThreadState.cpp @@ -994,7 +994,7 @@ void DocumentsWriter::ThreadState::Field const TCHAR* tokenText = token->termBuffer(); const int32_t tokenTextLen = token->termLength(); - int32_t code = 0; + uint32_t code = 0; // Compute hashcode int32_t downto = tokenTextLen; @@ -1203,7 +1203,8 @@ void DocumentsWriter::ThreadState::Field const int32_t newMask = newSize-1; ValueArray newHash(newSize); - int32_t hashPos, code; + int32_t hashPos; + uint32_t code; const TCHAR* pos = NULL; const TCHAR* start = NULL; Posting* p0; [FILE:536:patches/patch-src__core__CLucene__index__IndexFileDeleter.cpp] --- src/core/CLucene/index/IndexFileDeleter.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/index/IndexFileDeleter.cpp @@ -129,7 +129,7 @@ IndexFileDeleter::IndexFileDeleter(Direc string& fileName = files.at(i); - if (filter->accept(NULL, fileName.c_str()) && !fileName.compare(IndexFileNames::SEGMENTS_GEN) == 0) { + if (filter->accept(NULL, fileName.c_str()) && fileName.compare(IndexFileNames::SEGMENTS_GEN) != 0) { // Add this file to refCounts with initial count 0: getRefCount(fileName.c_str()); [FILE:2342:patches/patch-src__core__CLucene__index__IndexWriter.cpp] --- src/core/CLucene/index/IndexWriter.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/index/IndexWriter.cpp @@ -53,7 +53,6 @@ const int32_t IndexWriter::DEFAULT_MERGE DEFINE_MUTEX(IndexWriter::MESSAGE_ID_LOCK) int32_t IndexWriter::MESSAGE_ID = 0; -const int32_t IndexWriter::MAX_TERM_LENGTH = DocumentsWriter::MAX_TERM_LENGTH; class IndexWriter::Internal{ public: @@ -814,7 +813,7 @@ void IndexWriter::optimize(int32_t maxNu ensureOpen(); if (maxNumSegments < 1) - _CLTHROWA(CL_ERR_IllegalArgument, "maxNumSegments must be >= 1; got " + maxNumSegments); + _CLTHROWA(CL_ERR_IllegalArgument, (string("maxNumSegments must be >= 1; got ") + Misc::toString(maxNumSegments)).c_str()); if (infoStream != NULL) message("optimize: index now " + segString()); @@ -1392,7 +1391,7 @@ bool IndexWriter::doFlush(bool _flushDoc // Check if the doc stores must be separately flushed // because other segments, besides the one we are about // to flush, reference it - if (_flushDocStores && (!flushDocs || !docWriter->getSegment().compare(docWriter->getDocStoreSegment())==0 )) { + if (_flushDocStores && (!flushDocs || docWriter->getSegment().compare(docWriter->getDocStoreSegment()) != 0)) { // We must separately flush the doc store if (infoStream != NULL) message(" flush shared docStore segment " + docStoreSegment); @@ -1631,7 +1630,7 @@ bool IndexWriter::commitMerge(MergePolic // Load deletes present @ start of merge, for this segment: BitVector previousDeletes(previousInfo->dir, previousInfo->getDelFileName().c_str()); - if (!currentInfo->getDelFileName().compare(previousInfo->getDelFileName())==0 ){ + if (currentInfo->getDelFileName().compare(previousInfo->getDelFileName()) != 0) { // This means this segment has had new deletes // committed since we started the merge, so we // must merge them: @@ -1928,7 +1927,7 @@ void IndexWriter::_mergeInit(MergePolicy mergeDocStores = true; else if (lastDocStoreSegment.empty()) lastDocStoreSegment = docStoreSegment; - else if (!lastDocStoreSegment.compare(docStoreSegment)==0 ) + else if (lastDocStoreSegment.compare(docStoreSegment) != 0) mergeDocStores = true; // Segments' docScoreOffsets must be in-order, [FILE:624:patches/patch-src__core__CLucene__index__IndexWriter.h] --- src/core/CLucene/index/IndexWriter.h.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/index/IndexWriter.h @@ -384,14 +384,6 @@ public: */ static const int32_t DEFAULT_MAX_MERGE_DOCS; - /** - * Absolute hard maximum length for a term. If a term - * arrives from the analyzer longer than this length, it - * is skipped and a message is printed to infoStream, if - * set (see {@link #setInfoStream}). - */ - static const int32_t MAX_TERM_LENGTH; - /* Determines how often segment indices are merged by addDocument(). With * smaller values, less RAM is used while indexing, and searches on [FILE:399:patches/patch-src__core__CLucene__index__TermInfosReader.cpp] --- src/core/CLucene/index/TermInfosReader.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/index/TermInfosReader.cpp @@ -111,7 +111,7 @@ CL_NS_DEF(index) //destroy their elements #ifdef _DEBUG for ( int32_t i=0; i") }; -const int32_t QueryParser::jj_la1_0[] = {0x180,0x180,0xe00,0xe00,0x1f69f80,0x48000,0x10000,0x1f69000,0x1348000,0x80000,0x80000,0x10000,0x18000000,0x2000000,0x18000000,0x10000,0x80000000,0x20000000,0x80000000,0x10000,0x80000,0x10000,0x1f68000}; +const int32_t QueryParser::jj_la1_0[] = {0x180,0x180,0xe00,0xe00,0x1f69f80,0x48000,0x10000,0x1f69000,0x1348000,0x80000,0x80000,0x10000,0x18000000,0x2000000,0x18000000,0x10000,int32_t(0x80000000),0x20000000,int32_t(0x80000000),0x10000,0x80000,0x10000,0x1f68000}; const int32_t QueryParser::jj_la1_1[] = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x0,0x0,0x0}; struct QueryParser::JJCalls { [FILE:2469:patches/patch-src__core__CLucene__queryParser__QueryParserTokenManager.cpp] --- src/core/CLucene/queryParser/QueryParserTokenManager.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/queryParser/QueryParserTokenManager.cpp @@ -15,9 +15,9 @@ CL_NS_DEF(queryParser) -const int64_t QueryParserTokenManager::jjbitVec2[]={0x0L, 0x0L, _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff)}; +const int64_t QueryParserTokenManager::jjbitVec2[]={0x0L, 0x0L, int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff))}; const int64_t QueryParserTokenManager::jjbitVec0[] = { - _ILONGLONG(0xfffffffffffffffe), _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff) + int64_t(_ILONGLONG(0xfffffffffffffffe)), int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff)) }; const int32_t QueryParserTokenManager::jjnextStates[]={ 15, 17, 18, 29, 32, 23, 33, 30, 20, 21, 32, 23, 33, 31, 34, 27, @@ -544,7 +544,10 @@ int32_t QueryParserTokenManager::jjMoveN kind = 0x7fffffff; } ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 36 - (jjnewStateCnt = startsAt))) + i = jjnewStateCnt; + jjnewStateCnt = startsAt; + startsAt = 36 - jjnewStateCnt; + if (i == startsAt) return curPos; try { curChar = input_stream->readChar(); } catch(CLuceneError& e) { @@ -756,7 +759,10 @@ int32_t QueryParserTokenManager::jjMoveN kind = 0x7fffffff; } ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt))) + i = jjnewStateCnt; + jjnewStateCnt = startsAt; + startsAt = 7 - jjnewStateCnt; + if (i == startsAt) return curPos; try { curChar = input_stream->readChar(); } catch(CLuceneError& e) { @@ -854,7 +860,10 @@ int32_t QueryParserTokenManager::jjMoveN kind = 0x7fffffff; } ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt))) + i = jjnewStateCnt; + jjnewStateCnt = startsAt; + startsAt = 3 - jjnewStateCnt; + if (i == startsAt) return curPos; try { curChar = input_stream->readChar(); } catch(CLuceneError& e) { @@ -1066,7 +1075,10 @@ int32_t QueryParserTokenManager::jjMoveN kind = 0x7fffffff; } ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt))) + i = jjnewStateCnt; + jjnewStateCnt = startsAt; + startsAt = 7 - jjnewStateCnt; + if (i == startsAt) return curPos; try { curChar = input_stream->readChar(); } catch(CLuceneError& e) { [FILE:412:patches/patch-src__core__CLucene__queryParser__legacy__Lexer.cpp] --- src/core/CLucene/queryParser/legacy/Lexer.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/queryParser/legacy/Lexer.cpp @@ -117,7 +117,7 @@ bool Lexer::GetNextToken(QueryToken* tok if( _istspace(ch)!=0 ) { continue; } - TCHAR buf[2] = {ch,'\0'}; + TCHAR buf[2] = {TCHAR(ch),'\0'}; switch(ch) { case '+': token->set(buf, QueryToken::PLUS); [FILE:696:patches/patch-src__core__CLucene__search__ConstantScoreQuery.cpp] --- src/core/CLucene/search/ConstantScoreQuery.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/search/ConstantScoreQuery.cpp @@ -25,14 +25,17 @@ class ConstantScorer : public Scorer { BitSet* bits; const float_t theScore; int32_t _doc; + bool shouldDelete; public: ConstantScorer(Similarity* similarity, IndexReader* reader, Weight* w, Filter* filter) : Scorer(similarity), bits(filter->bits(reader)), theScore(w->getValue()), _doc(-1) { + shouldDelete = filter->shouldDeleteBitSet(bits); } virtual ~ConstantScorer() { - _CLLDELETE(bits); + if ( shouldDelete) + _CLLDELETE(bits); } bool next() { [FILE:349:patches/patch-src__core__CLucene__store__FSDirectory.cpp] --- src/core/CLucene/store/FSDirectory.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/store/FSDirectory.cpp @@ -219,9 +219,8 @@ CL_NS_USE(util) _CLDECDELETE(handle); //printf("handle=%d\n", handle->__cl_refcount); - if ( dounlock ){ - mutex->unlock(); - }else{ + mutex->unlock(); + if ( !dounlock ) { delete mutex; } } [FILE:435:patches/patch-src__core__CLucene__store__IndexInput.cpp] --- src/core/CLucene/store/IndexInput.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/store/IndexInput.cpp @@ -41,8 +41,8 @@ CL_NS_USE(util) } int64_t IndexInput::readLong() { - int64_t i = ((int64_t)readInt() << 32); - return (i | ((int64_t)readInt() & 0xFFFFFFFFL)); + uint64_t i = ((uint64_t)readInt() << 32); + return (i | ((uint64_t)readInt() & 0xFFFFFFFFL)); } int64_t IndexInput::readVLong() { [FILE:2407:patches/patch-src__core__CLucene__util__BitSet.cpp] --- src/core/CLucene/util/BitSet.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/util/BitSet.cpp @@ -32,6 +32,25 @@ const uint8_t BitSet::BYTE_COUNTS[256] = 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8}; +const uint8_t BitSet::BYTE_OFFSETS[256] = { + 8, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0}; + + BitSet::BitSet( const BitSet& copy ) : _size( copy._size ), _count(-1) @@ -180,19 +199,32 @@ BitSet* BitSet::clone() const { return factor * (4 + (8+40)*count()) < size(); } - int32_t BitSet::nextSetBit(int32_t fromIndex) const { + int32_t BitSet::nextSetBit(int32_t fromIndex) const + { if (fromIndex < 0) _CLTHROWT(CL_ERR_IndexOutOfBounds, _T("fromIndex < 0")); if (fromIndex >= _size) return -1; - while (true) { - if ((bits[fromIndex >> 3] & (1 << (fromIndex & 7))) != 0) - return fromIndex; - if (++fromIndex == _size) - return -1; + int _max = ( _size+7 ) >> 3; + + unsigned int i = (int)( fromIndex>>3 ); + unsigned int subIndex = fromIndex & 0x7; // index within the byte + uint8_t byte = bits[i] >> subIndex; // skip all the bits to the right of index + + if ( byte != 0 ) + { + return ( ( i<<3 ) + subIndex + BYTE_OFFSETS[ byte ] ); + } + + while( ++i < _max ) + { + byte = bits[i]; + if ( byte != 0 ) + return ( ( i<<3 ) + BYTE_OFFSETS[ byte ] ); } + return -1; } CL_NS_END [FILE:438:patches/patch-src__core__CLucene__util__BitSet.h] --- src/core/CLucene/util/BitSet.h.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/util/BitSet.h @@ -39,6 +39,7 @@ class CLUCENE_EXPORT BitSet:LUCENE_BASE /** Indicates if the bit vector is sparse and should be saved as a d-gaps list, or dense, and should be saved as a bit set. */ bool isSparse(); static const uint8_t BYTE_COUNTS[256]; + static const uint8_t BYTE_OFFSETS[256]; protected: BitSet( const BitSet& copy ); [FILE:806:patches/patch-src__core__CLucene__util__MD5Digester.cpp] --- src/core/CLucene/util/MD5Digester.cpp.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/util/MD5Digester.cpp @@ -72,18 +72,16 @@ static unsigned char PADDING[64] = // PrintMD5: Converts a completed md5 digest into a char* string. char* PrintMD5(uint8_t md5Digest[16]) { - char chBuffer[256]; - char chEach[10]; + const char toHex[] = "0123456789abcdef"; + char chBuffer[16 * 2 + 1]; int nCount; - memset(chBuffer,0,256); - memset(chEach, 0, 10); - for (nCount = 0; nCount < 16; nCount++) { - cl_sprintf(chEach, 10, "%02x", md5Digest[nCount]); - strncat(chBuffer, chEach, sizeof(chEach)); + chBuffer[nCount * 2] = toHex[(md5Digest[nCount] & 0xf0) >> 4]; + chBuffer[nCount * 2 + 1] = toHex[md5Digest[nCount] & 0x0f]; } + chBuffer[nCount * 2] = '\0'; return STRDUP_AtoA(chBuffer); } [FILE:839:patches/patch-src__core__CLucene__util__VoidMap.h] --- src/core/CLucene/util/VoidMap.h.orig 2011-03-17 00:21:07 UTC +++ src/core/CLucene/util/VoidMap.h @@ -11,8 +11,13 @@ #include "CLucene/LuceneThreads.h" #if defined(_CL_HAVE_TR1_UNORDERED_MAP) && defined(_CL_HAVE_TR1_UNORDERED_SET) +#if defined(_LIBCPP_VERSION) + #include + #include +#else #include #include +#endif #elif defined(_CL_HAVE_HASH_MAP) && defined(_CL_HAVE_HASH_SET) //hashing is all or nothing! #include @@ -83,7 +88,7 @@ public: _vt get( _kt k) const { const_iterator itr = base::find(k); if ( itr==base::end() ) - return (_vt)NULL; + return static_cast<_vt>(0); else return itr->second; } @@ -316,6 +321,7 @@ public: if ( _this::dk || _this::dv ) _this::remove(k); + (*this)[k] = v;; } }; [FILE:1093:patches/patch-src__core__CMakeLists.txt] --- src/core/CMakeLists.txt.orig 2011-03-17 00:21:07 UTC +++ src/core/CMakeLists.txt @@ -252,13 +252,13 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ set(CLUCENE_SOVERSION ${CLUCENE_SOVERSION}) ") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CLuceneConfig.cmake" - DESTINATION ${LIB_DESTINATION}/CLuceneConfig.cmake) + DESTINATION %%DATADIR%%) # install pkg-config file IF(NOT WIN32) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libclucene-core.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libclucene-core.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libclucene-core.pc - DESTINATION ${LIB_DESTINATION}/pkgconfig ) + DESTINATION libdata/pkgconfig ) ENDIF(NOT WIN32) @@ -274,9 +274,6 @@ ELSE ( LUCENE_SYS_INCLUDES ) install(FILES ${clucene-shared_BINARY_DIR}/CLucene/clucene-config.h DESTINATION include/CLucene COMPONENT development) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CLuceneConfig.cmake - DESTINATION include/CLucene - COMPONENT development) ENDIF ( LUCENE_SYS_INCLUDES ) [FILE:559:patches/patch-src__core__libclucene-core.pc.cmake] --- src/core/libclucene-core.pc.cmake.orig 2011-03-17 00:21:07 UTC +++ src/core/libclucene-core.pc.cmake @@ -6,6 +6,6 @@ includedir=${prefix}/include:${prefix}/i Name: libclucene Description: CLucene - a C++ search engine, ported from the popular Apache Lucene Version: @CLUCENE_VERSION_MAJOR@.@CLUCENE_VERSION_MINOR@.@CLUCENE_VERSION_REVISION@.@CLUCENE_VERSION_PATCH@ -Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core +Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core -lclucene-shared Cflags: -I${prefix}/include -I${prefix}/include/CLucene/ext ~ [FILE:289:patches/patch-src__shared__CLucene__LuceneThreads.h] --- src/shared/CLucene/LuceneThreads.h.orig 2011-03-17 00:21:07 UTC +++ src/shared/CLucene/LuceneThreads.h @@ -7,6 +7,9 @@ #ifndef _LuceneThreads_h #define _LuceneThreads_h +#if defined(_CL_HAVE_PTHREAD) +#include +#endif CL_NS_DEF(util) class CLuceneThreadIdCompare; [FILE:1062:patches/patch-src__shared__CMakeLists.txt] --- src/shared/CMakeLists.txt.orig 2011-03-17 00:21:07 UTC +++ src/shared/CMakeLists.txt @@ -42,7 +42,7 @@ INCLUDE (CheckAtomicFunctions) find_package(ZLIB) IF ( ZLIB_FOUND ) SET ( EXTRA_LIBS ${EXTRA_LIBS} ${ZLIB_LIBRARY} ) -ELSEIF ( ZLIB_FOUND ) +ELSE ( ZLIB_FOUND ) MESSAGE( "ZLIB not found, using local: ${clucene-ext_SOURCE_DIR}/zlib" ) SET(ZLIB_INCLUDE_DIR ${clucene-ext_SOURCE_DIR}/zlib ) SET(ZLIB_LIBRARY ${clucene-ext_BINARY_DIR}) @@ -62,7 +62,7 @@ CHECK_OPTIONAL_HEADERS ( string.h sys/ti stdint.h unistd.h io.h direct.h sys/dir.h sys/ndir.h dirent.h wctype.h fcntl.h stat.h sys/stat.h stdexcept errno.h fcntl.h windef.h windows.h wchar.h hash_map hash_set ext/hash_map ext/hash_map tr1/unordered_set tr1/unordered_map - sys/timeb.h tchar.h strings.h stdexcept sys/mman.h winerror.h ) + tchar.h strings.h stdexcept sys/mman.h winerror.h ) ######################################################################## [FILE:470:patches/patch-src__shared__cmake__CheckHashmaps.cmake] --- src/shared/cmake/CheckHashmaps.cmake.orig 2011-03-17 00:21:07 UTC +++ src/shared/cmake/CheckHashmaps.cmake @@ -35,8 +35,12 @@ MACRO(HASHMAP_TEST HashingValue namespac #elif defined(_CL_HAVE_EXT_HASH_MAP) #include #elif defined(_CL_HAVE_TR1_UNORDERED_MAP) +#if defined(_LIBCPP_VERSION) + #include +#else #include #endif +#endif int main() { ${namespace}::${_CL_HASH_MAP} a; return 0;