summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-02-22 11:31:30 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-02-23 10:31:20 +0000
commit3ea0a0a45e7256304f95935706c8bdf3940d0b0e (patch)
tree31023752d7c6d19a45efcc599128a26a00e0c237 /l10ntools
parent98d6d98f5cd0fdc856ddf50757bd93da8cb808a4 (diff)
ja help overflows clucene's default limits
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/help/HelpIndexer.cxx4
-rw-r--r--l10ntools/source/help/HelpIndexer_main.cxx12
2 files changed, 14 insertions, 2 deletions
diff --git a/l10ntools/source/help/HelpIndexer.cxx b/l10ntools/source/help/HelpIndexer.cxx
index 8b8db1493f40..38d5639f18cb 100644
--- a/l10ntools/source/help/HelpIndexer.cxx
+++ b/l10ntools/source/help/HelpIndexer.cxx
@@ -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;
diff --git a/l10ntools/source/help/HelpIndexer_main.cxx b/l10ntools/source/help/HelpIndexer_main.cxx
index 73b80aeb3ac5..cd30bbfcc0b6 100644
--- a/l10ntools/source/help/HelpIndexer_main.cxx
+++ b/l10ntools/source/help/HelpIndexer_main.cxx
@@ -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;