Skip to content
Permalink
Browse files

Fixed largest snippet get : don't reject ones starting with a space char

  • Loading branch information...
luccioman committed May 14, 2018
1 parent f511e16 commit 3ce44cf25042747c74e35a10abb63e9d1a68ff82
Showing with 8 additions and 4 deletions.
  1. +8 −4 source/net/yacy/cora/federate/solr/responsewriter/OpensearchResponseWriter.java
@@ -373,11 +373,15 @@ public static void removeSubsumedTitle(LinkedHashSet<String> snippets, String ti
* @param snippets snippets list eventually empty
* @return the largest snippet containing at least a space character among the list, or null
*/
public static String getLargestSnippet(LinkedHashSet<String> snippets) {
if (snippets == null || snippets.size() == 0) return null;
public static String getLargestSnippet(final LinkedHashSet<String> snippets) {
if (snippets == null || snippets.size() == 0) {
return null;
}
String l = null;
for (String s: snippets) {
if ((l == null || s.length() > l.length()) && s.indexOf(' ') > 0) l = s;
for (final String s: snippets) {
if ((l == null || s.length() > l.length()) && s.length() > 1 && s.indexOf(' ', 1) > 0) {
l = s;
}
}
if(l != null) {
l = l.replaceAll("\"", "'");

0 comments on commit 3ce44cf

Please sign in to comment.
You can’t perform that action at this time.