From 2da96fad876647f241ba8acb262f3655cfd6c8b2 Mon Sep 17 00:00:00 2001 From: dockes Date: Sat, 30 Aug 2008 07:38:43 +0000 Subject: [PATCH] truncate simple file names at max term length --- src/rcldb/rcldb.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp index f249ae8c..90f791e1 100644 --- a/src/rcldb/rcldb.cpp +++ b/src/rcldb/rcldb.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.139 2008-08-28 15:44:37 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.140 2008-08-30 07:38:43 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -922,6 +922,10 @@ bool Db::addOrUpdate(const string &udi, const string &parent_udi, // We also add a term for the filename extension if any. if (dumb_string(doc.utf8fn, noacc) && !noacc.empty()) { string::size_type pos = noacc.rfind('.'); + // We should truncate after extracting the extension, but this is + // a pathological case anyway + if (noacc.size() > 230) + utf8truncate(noacc, 230); if (pos != string::npos && pos != noacc.length() -1) { newdocument.add_term(string("XE") + noacc.substr(pos+1)); }