From: Kasun Gajasinghe Date: Fri, 7 Oct 2011 09:48:44 +0000 (+0000) Subject: Automatically limit the size of the search description to something 140 characters X-Git-Tag: release/1.79.1~6^2~652 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb91c538c574662b94b73e7614afb746761df627;p=docbook-dsssl Automatically limit the size of the search description to something 140 characters --- 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. -