apply remote result count config value to Bookmark Autosearch

+ prepare to make the widely unused Bookmark feature optional
pull/41/merge
reger 9 years ago
parent 5d635879f8
commit ed3e16e092

@ -157,31 +157,33 @@ public class AutoSearch extends AbstractBusyThread {
* @return true if new query from bookmark was added * @return true if new query from bookmark was added
*/ */
private boolean checkBookmarkDB() { private boolean checkBookmarkDB() {
int added = 0; if (Switchboard.getSwitchboard().bookmarksDB != null) {
Iterator<Bookmark> it = Switchboard.getSwitchboard().bookmarksDB.getBookmarksIterator(); int added = 0;
if (it != null) { Iterator<Bookmark> it = Switchboard.getSwitchboard().bookmarksDB.getBookmarksIterator();
while (it.hasNext()) { if (it != null) {
Bookmark bmk = it.next(); while (it.hasNext()) {
// get search bookmarks only Bookmark bmk = it.next();
if (bmk.getFoldersString().startsWith("/search")) { // get search bookmarks only
// take only new created or edited bookmarks if (bmk.getFoldersString().startsWith("/search")) {
if (bmk.getTimeStamp() >= this.lastInitTime) { // take only new created or edited bookmarks
final String query = bmk.getQuery(); if (bmk.getTimeStamp() >= this.lastInitTime) {
if (query != null && !query.isEmpty()) { final String query = bmk.getQuery();
{ if (query != null && !query.isEmpty()) {
querystack.add(query); {
added++; querystack.add(query);
ConcurrentLog.info(AutoSearch.class.getName(), "add query from Bookmarks: query=" + query); added++;
ConcurrentLog.info(AutoSearch.class.getName(), "add query from Bookmarks: query=" + query);
}
} }
} }
} }
} }
} }
} if (added > 0) {
if (added > 0) { this.lastInitTime = System.currentTimeMillis();
this.lastInitTime = System.currentTimeMillis(); saveasPropFile();
saveasPropFile(); return true;
return true; }
} }
return false; return false;
} }
@ -243,7 +245,7 @@ public class AutoSearch extends AbstractBusyThread {
// use remote defaults and ranking (to query their index right) // use remote defaults and ranking (to query their index right)
solrQuery.set(CommonParams.Q, currentQuery + " AND (" + CollectionSchema.httpstatus_i.name() + ":200)"); // except this yacy special solrQuery.set(CommonParams.Q, currentQuery + " AND (" + CollectionSchema.httpstatus_i.name() + ":200)"); // except this yacy special
solrQuery.set("q.op", "AND"); // except ... no one word matches please solrQuery.set("q.op", "AND"); // except ... no one word matches please
solrQuery.set(CommonParams.ROWS, "20"); solrQuery.set(CommonParams.ROWS, sb.getConfig(SwitchboardConstants.REMOTESEARCH_MAXCOUNT_USER, "20"));
this.setName("Protocol.solrQuery(" + solrQuery.getQuery() + " to " + seed.hash + ")"); this.setName("Protocol.solrQuery(" + solrQuery.getQuery() + " to " + seed.hash + ")");
try { try {
RemoteInstance instance = new RemoteInstance("http://" + seed.getPublicAddress(seed.getIP()) + "/solr/", null, null, 10000); // this is a 'patch configuration' which considers 'solr' as default collection RemoteInstance instance = new RemoteInstance("http://" + seed.getPublicAddress(seed.getIP()) + "/solr/", null, null, 10000); // this is a 'patch configuration' which considers 'solr' as default collection
@ -278,7 +280,7 @@ public class AutoSearch extends AbstractBusyThread {
rssSearchServiceURL, rssSearchServiceURL,
currentQuery, currentQuery,
0, 0,
20, sb.getConfigInt(SwitchboardConstants.REMOTESEARCH_MAXCOUNT_USER, 20),
CacheStrategy.IFFRESH, CacheStrategy.IFFRESH,
false, // just local, as we ask others too false, // just local, as we ask others too
ClientIdentification.yacyInternetCrawlerAgent); ClientIdentification.yacyInternetCrawlerAgent);

Loading…
Cancel
Save