mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
Fixed largest snippet get : don't reject ones starting with a space char
This commit is contained in:
parent
f511e16d50
commit
3ce44cf250
|
@ -373,11 +373,15 @@ public class OpensearchResponseWriter implements QueryResponseWriter, EmbeddedSo
|
|||
* @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("\"", "'");
|
||||
|
|
Loading…
Reference in New Issue
Block a user