From 735eb70525abeb8e35bc369e3cc4f7418d0b59bb Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Tue, 19 Mar 2013 11:23:18 +0100 Subject: [PATCH] better search timing; prevents '0 results' for very large local indexes >> 10 mio documents --- htroot/yacysearchitem.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java index b96dd8028e..2f4486092e 100644 --- a/htroot/yacysearchitem.java +++ b/htroot/yacysearchitem.java @@ -104,11 +104,13 @@ public static serverObjects respond(final RequestHeader header, final serverObje prop.put("navurlBase", QueryParams.navurlBase("html", theSearch.query, null).toString()); final String target_special_pattern = sb.getConfig(SwitchboardConstants.SEARCH_TARGET_SPECIAL_PATTERN, ""); + long timeout = item == 0 ? 10000 : (theSearch.query.isLocal() ? 1000 : 3000); + if (theSearch.query.contentdom == Classification.ContentDomain.TEXT || theSearch.query.contentdom == Classification.ContentDomain.ALL) { // text search // generate result object - final ResultEntry result = theSearch.oneResult(item, theSearch.query.isLocal() ? 1000 : 3000); + final ResultEntry result = theSearch.oneResult(item, timeout); if (result == null) return prop; // no content final String resultUrlstring = result.urlstring(); final DigestURI resultURL = result.url(); @@ -261,7 +263,7 @@ public static serverObjects respond(final RequestHeader header, final serverObje prop.put("content", theSearch.query.contentdom.getCode() + 1); // switch on specific content //final MediaSnippet ms = theSearch.result().oneImage(item); - final ResultEntry ms = theSearch.oneResult(item, theSearch.query.isLocal() ? 1000 : 5000); + final ResultEntry ms = theSearch.oneResult(item, timeout); if (ms == null) { prop.put("content_item", "0"); } else { @@ -297,7 +299,7 @@ public static serverObjects respond(final RequestHeader header, final serverObje // any other media content // generate result object - final ResultEntry ms = theSearch.oneResult(item, theSearch.query.isLocal() ? 1000 : 5000); + final ResultEntry ms = theSearch.oneResult(item, timeout); prop.put("content", theSearch.query.contentdom.getCode() + 1); // switch on specific content if (ms == null) { prop.put("content_item", "0");