From bb91c538c574662b94b73e7614afb746761df627 Mon Sep 17 00:00:00 2001 From: Kasun Gajasinghe Date: Fri, 7 Oct 2011 09:48:44 +0000 Subject: [PATCH] Automatically limit the size of the search description to something 140 characters --- .../src/com/nexwave/nquindexer/WriteJSFiles.java | 13 +++++++++---- xsl/webhelp/docsrc/readme.xml | 4 ---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/xsl-webhelpindexer/src/com/nexwave/nquindexer/WriteJSFiles.java b/xsl-webhelpindexer/src/com/nexwave/nquindexer/WriteJSFiles.java index 859fe6b76..f0fd3eaa2 100755 --- a/xsl-webhelpindexer/src/com/nexwave/nquindexer/WriteJSFiles.java +++ b/xsl-webhelpindexer/src/com/nexwave/nquindexer/WriteJSFiles.java @@ -128,10 +128,15 @@ public class WriteJSFiles { tempShortdesc = tempShortdesc.replaceAll("\\\\", "\\\\\\\\"); } if (tempShortdesc != null) { - String stripNonAlphabeticalChars = stripNonAlphabeticalChars(tempShortdesc); - //stripNonAlphabeticalChars = stripWords(stripNonAlphabeticalChars); - stripNonAlphabeticalChars = stripNonAlphabeticalChars + "..."; - out.write("fil[\"" + i + "\"]" + "= \"" + tempPath + "@@@" + tempTitle + "@@@" + stripNonAlphabeticalChars + "\";\n"); + String strippedNonAlphaCharsShortDesc = stripNonAlphabeticalChars(tempShortdesc); + //Limit the characters to 140 + if (strippedNonAlphaCharsShortDesc.length() > 140) { //why 140? Think Twitter ;-) + strippedNonAlphaCharsShortDesc = strippedNonAlphaCharsShortDesc.substring(0,137); + //another 3 letters "..." get added at next execution line + } + //strippedNonAlphaCharsShortDesc = stripWords(strippedNonAlphaCharsShortDesc); + strippedNonAlphaCharsShortDesc = strippedNonAlphaCharsShortDesc + "..."; + out.write("fil[\"" + i + "\"]" + "= \"" + tempPath + "@@@" + tempTitle + "@@@" + strippedNonAlphaCharsShortDesc + "\";\n"); i++; } else { out.write("fil[\"" + i + "\"]" + "= \"" + tempPath + "@@@" + tempTitle + "@@@null" + "\";\n"); diff --git a/xsl/webhelp/docsrc/readme.xml b/xsl/webhelp/docsrc/readme.xml index b6a384b4e..e79047611 100644 --- a/xsl/webhelp/docsrc/readme.xml +++ b/xsl/webhelp/docsrc/readme.xml @@ -219,10 +219,6 @@ Automatically use the first non-heading content as the summary in the search results. - - Automatically limit the size of the search description to something 140 - characters. - -- 2.40.0