From ebe5faeb0168a29ccffbefadd45fbdb17db459e9 Mon Sep 17 00:00:00 2001 From: reger Date: Mon, 5 Jan 2015 06:55:53 +0100 Subject: [PATCH] added url to bookmark icon link url is anyway needed, saves index lookup and works w/o commited url. Removed unused order parameter --- htroot/yacysearch.java | 36 ++++++++++++++++-------------------- htroot/yacysearchitem.java | 2 +- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index de9b32f98..f3b77f0cc 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -88,6 +88,7 @@ import net.yacy.search.ranking.RankingProfile; import net.yacy.server.serverObjects; import net.yacy.server.serverSwitch; import net.yacy.server.servletProperties; +import net.yacy.utils.crypt; public class yacysearch { @@ -586,32 +587,27 @@ public class yacysearch { prop.authenticationRequired(); return prop; } - final String bookmarkHash = post.get("bookmarkref", ""); // urlhash - try { - final DigestURL url = indexSegment.fulltext().getURL(bookmarkHash); - if ( url != null ) { - try { - final Bookmark bmk = sb.bookmarksDB.createBookmark(url.toNormalform(true), YMarkTables.USER_ADMIN); - bmk.setProperty(Bookmark.BOOKMARK_DESCRIPTION, querystring); - //bmk.setProperty(Bookmark.BOOKMARK_QUERY, originalquerystring); - bmk.addTag("/search"); // add to bookmark folder - bmk.addTag("searchresult"); // add tag - sb.bookmarksDB.saveBookmark(bmk); - - // do the same for YMarks ? - sb.tables.bookmarks.createBookmark( + //final String bookmarkHash = post.get("bookmarkref", ""); // urlhash + final String urlstr = crypt.simpleDecode(post.get("bookmarkurl")); + if (urlstr != null) { + try { + final Bookmark bmk = sb.bookmarksDB.createBookmark(urlstr, YMarkTables.USER_ADMIN); + bmk.setProperty(Bookmark.BOOKMARK_DESCRIPTION, "query="+querystring); + //bmk.setProperty(Bookmark.BOOKMARK_QUERY, originalquerystring); + bmk.addTag("/search"); // add to bookmark folder + bmk.addTag("searchresult"); // add tag + sb.bookmarksDB.saveBookmark(bmk); + + // do the same for YMarks ? + sb.tables.bookmarks.createBookmark( sb.loader, - url, + urlstr, ClientIdentification.yacyInternetCrawlerAgent, YMarkTables.USER_ADMIN, true, "searchresult", "/search"); - } catch (final Throwable e ) { - } - } - } catch (IOException e) { - ConcurrentLog.logException(e); + } catch (final Throwable e) { } } } diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java index 9ac02ddc4..9fd2c2efb 100644 --- a/htroot/yacysearchitem.java +++ b/htroot/yacysearchitem.java @@ -144,7 +144,7 @@ public class yacysearchitem { prop.put("content_authorized_bookmark", !bookmarkexists); // bookmark icon check for YMarks //prop.put("content_authorized_bookmark", sb.tables.bookmarks.hasBookmark("admin", urlhash) ? "0" : "1"); - prop.putHTML("content_authorized_bookmark_bookmarklink", "yacysearch.html?query=" + origQ.replace(' ', '+') + "&Enter=Search&count=" + theSearch.query.itemsPerPage() + "&offset=" + (theSearch.query.neededResults() - theSearch.query.itemsPerPage()) + "&order=" + crypt.simpleEncode(theSearch.query.ranking.toExternalString()) + "&resource=" + resource + "&time=3&bookmarkref=" + urlhash + "&urlmaskfilter=.*"); + prop.putHTML("content_authorized_bookmark_bookmarklink", "yacysearch.html?query=" + origQ.replace(' ', '+') + "&Enter=Search&count=" + theSearch.query.itemsPerPage() + "&offset=" + (theSearch.query.neededResults() - theSearch.query.itemsPerPage()) + "&resource=" + resource + "&time=3&bookmarkref=" + urlhash + "&bookmarkurl=" + crypt.simpleEncode(resultUrlstring) + "&urlmaskfilter=.*"); prop.put("content_authorized_recommend", (sb.peers.newsPool.getSpecific(NewsPool.OUTGOING_DB, NewsPool.CATEGORY_SURFTIPP_ADD, "url", resultUrlstring) == null) ? "1" : "0"); prop.putHTML("content_authorized_recommend_deletelink", "yacysearch.html?query=" + origQ.replace(' ', '+') + "&Enter=Search&count=" + theSearch.query.itemsPerPage() + "&offset=" + (theSearch.query.neededResults() - theSearch.query.itemsPerPage()) + "&order=" + crypt.simpleEncode(theSearch.query.ranking.toExternalString()) + "&resource=" + resource + "&time=3&deleteref=" + urlhash + "&urlmaskfilter=.*"); prop.putHTML("content_authorized_recommend_recommendlink", "yacysearch.html?query=" + origQ.replace(' ', '+') + "&Enter=Search&count=" + theSearch.query.itemsPerPage() + "&offset=" + (theSearch.query.neededResults() - theSearch.query.itemsPerPage()) + "&order=" + crypt.simpleEncode(theSearch.query.ranking.toExternalString()) + "&resource=" + resource + "&time=3&recommendref=" + urlhash + "&urlmaskfilter=.*");