Skip to content

Commit

Permalink
-made snippet-timeout for text and media configurable
Browse files Browse the repository at this point in the history
-Now completely working OpenSearch plugin!

Please have a look at the search-field of modern browsers (IE 7+, FF2+). It should change its colour when you visit the index/search-page of a peer and you should be able to add your YaCy-peer as search source very easily now.
Credits for adapting the plugin to make it work go to Philipp Redeker.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3212 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
rramthun committed Jan 15, 2007
1 parent 52c6461 commit 00ca6ec
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions htroot/index.html
Expand Up @@ -4,6 +4,7 @@
<title>YaCy '#[clientname]#': Search Page</title>
#%env/templates/metas.template%#
<link rel="alternate" type="application/rss+xml" title="Search for #[former]#" href="yacysearch.rss?search=#[former]#" />
<link rel="search" type="application/opensearchdescription+xml" title="YaCy Search on '#[clientname]#'" href="opensearchdescription.xml" />
</head>
<body id="index" onload="document.getElementById('search').focus()">
#(display)#
Expand Down
9 changes: 5 additions & 4 deletions htroot/opensearchdescription.xml

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions htroot/xml/snippet.java
Expand Up @@ -23,6 +23,12 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();

//get the timeout for snippet-fetching
int mediasnippet_timeout = 15000;
int textsnippet_timeout = 10000;
mediasnippet_timeout = Integer.parseInt((env.getConfig("timeout_text", "15000")));
textsnippet_timeout = Integer.parseInt((env.getConfig("timeout_media", "10000")));

// getting url
String urlString = post.get("url", "");
URL url = new URL(urlString);
Expand Down Expand Up @@ -53,7 +59,7 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
// find snippet
if (media.equals("text")) {
// attach text snippet
plasmaSnippetCache.TextSnippet snippet = switchboard.snippetCache.retrieveTextSnippet(url, queryHashes, true, pre, 260, 10000);
plasmaSnippetCache.TextSnippet snippet = switchboard.snippetCache.retrieveTextSnippet(url, queryHashes, true, pre, 260, textsnippet_timeout);
prop.put("status",snippet.getSource());
if (snippet.getSource() < 11) {
//prop.put("text", (snippet.exists()) ? snippet.getLineMarked(queryHashes) : "unknown");
Expand All @@ -70,7 +76,7 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
prop.put("links", 0);
} else {
// attach media information
ArrayList mediaSnippets = switchboard.snippetCache.retrieveMediaSnippets(url, queryHashes, media, true, 1000);
ArrayList mediaSnippets = switchboard.snippetCache.retrieveMediaSnippets(url, queryHashes, media, true, mediasnippet_timeout);
plasmaSnippetCache.MediaSnippet ms;
for (int i = 0; i < mediaSnippets.size(); i++) {
ms = (plasmaSnippetCache.MediaSnippet) mediaSnippets.get(i);
Expand Down
5 changes: 5 additions & 0 deletions yacy.init
Expand Up @@ -816,6 +816,11 @@ searchProcessRemoteCount_f = 100
searchProcessRemoteTime_s = 5
searchProcessRemoteCount_s = 10

# timeouts for snippet fetching in ms
# timeout_text is for text-snippets, timeout_media for media, e.g. images
timeout_text = 10000
timeout_media = 15000

# path to ranking directory containing ranking reference files
rankingPath = DATA/RANKING

Expand Down

0 comments on commit 00ca6ec

Please sign in to comment.