Permalink
Browse files

Disable manual search results resorting when resorting is done with JS

Also added a constant for the js resorting setting key.
  • Loading branch information...
luccioman committed Sep 13, 2017
1 parent 4ccd383 commit 9e86d183b83ab838e9de3b20512f0bde1082ea4e
Showing with 12 additions and 5 deletions.
  1. +6 −5 htroot/yacysearch.java
  2. +6 −0 source/net/yacy/search/SwitchboardConstants.java
@@ -828,16 +828,17 @@ public static serverObjects respond(
prop.put("num-results_globalresults_remoteIndexCount", Formatter.number(theSearch.remote_rwi_available.get() + theSearch.remote_solr_available.get(), true));
prop.put("num-results_globalresults_remotePeerCount", Formatter.number(theSearch.remote_rwi_peerCount.get() + theSearch.remote_solr_peerCount.get(), true));
/* In p2p mode only, add a link allowing user to resort already drained results,
final boolean jsResort = sb.getConfigBool(SwitchboardConstants.SEARCH_JS_RESORT, SwitchboardConstants.SEARCH_JS_RESORT_DEFAULT);
prop.put("jsResort", jsResort);
prop.put("num-results_jsResort", jsResort);
/* In p2p mode only and if JavaScript resorting is not enabled, add a link allowing user to resort already drained results,
* eventually including fetched results with higher ranks from the Solr and RWI stacks */
prop.put("resortEnabled", global && !stealthmode && theSearch.resortCacheAllowed.availablePermits() > 0 ? 1 : 0);
prop.put("resortEnabled", !jsResort && global && !stealthmode && theSearch.resortCacheAllowed.availablePermits() > 0 ? 1 : 0);
prop.put("resortEnabled_url",
QueryParams.navurlBase(RequestHeader.FileType.HTML, theQuery, null, true).append("&startRecord=")
.append(startRecord).append("&resortCachedResults=true").toString());
prop.put("jsResort", sb.getConfigBool("search.jsresort", false) );
prop.put("num-results_jsResort", sb.getConfigBool("search.jsresort", false) );
// generate the search result lines; the content will be produced by another servlet
for ( int i = 0; i < theQuery.itemsPerPage(); i++ ) {
prop.put("results_" + i + "_item", startRecord + i);
@@ -546,6 +546,12 @@
public static final String SEARCH_TARGET_SPECIAL_PATTERN = "search.target.special.pattern"; // ie 'own' addresses in topframe, 'other' in iframe
public static final String SEARCH_VERIFY = "search.verify";
public static final String SEARCH_VERIFY_DELETE = "search.verify.delete";
/** Key of the setting controlling whether search results resorting by browser JavaScript is enabled */
public static final String SEARCH_JS_RESORT = "search.jsresort";
/** Default setting value controlling whether search results resorting by browser JavaScript is enabled */
public static final boolean SEARCH_JS_RESORT_DEFAULT = false;
public static final String SEARCH_NAVIGATION_MAXCOUNT = "search.navigation.maxcount"; // max lines displayed in standard search navigators/facets

0 comments on commit 9e86d18

Please sign in to comment.