ja help overflows clucene's default limits

This commit is contained in:
Caolán McNamara 2012-02-22 11:31:30 +00:00
parent 98d6d98f5c
commit 3ea0a0a45e
2 changed files with 14 additions and 2 deletions

View file

@ -74,6 +74,10 @@ bool HelpIndexer::indexDocuments() {
rtl::OString indexDirStr = rtl::OUStringToOString(ustrSystemPath, osl_getThreadTextEncoding());
lucene::index::IndexWriter writer(indexDirStr.getStr(), analyzer, true);
//Double limit of tokens allowed, otherwise we'll get a too-many-tokens
//exception for ja help. Could alternative ignore the exception and get
//truncated results as per java-Lucene apparently
writer.setMaxFieldLength(lucene::index::IndexWriter::DEFAULT_MAX_FIELD_LENGTH*2);
// Index the identified help files
Document doc;

View file

@ -97,8 +97,16 @@ int main(int argc, char **argv) {
rtl::OUString(module.c_str(), module.size(), osl_getThreadTextEncoding()),
sDir, sDir);
if (!indexer.indexDocuments()) {
std::wcerr << indexer.getErrorMessage().getStr() << std::endl;
try
{
if (!indexer.indexDocuments()) {
std::cerr << rtl::OUStringToOString(indexer.getErrorMessage(), osl_getThreadTextEncoding()).getStr() << std::endl;
return 2;
}
}
catch (CLuceneError &e)
{
std::cerr << e.what() << std::endl;
return 2;
}
return 0;