Skip to content

Commit

Permalink
Reduce number of default max. search navigator lines (from 10000)
Browse files Browse the repository at this point in the history
to 100 + make it configurable
  • Loading branch information
reger committed Oct 29, 2016
1 parent 065bcfb commit af39a76
Show file tree
Hide file tree
Showing 7 changed files with 1,303 additions and 1,284 deletions.
2,567 changes: 1,285 additions & 1,282 deletions defaults/yacy.init

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions htroot/ConfigSearchPage_p.html
Expand Up @@ -158,6 +158,8 @@ <h3>about#[about.headline]#</h3>
</div></td>
</tr>
</table>
<label for="search.navigation.maxcount">max. items</label>
<input type="text" id="search.navigation.maxcount" name="search.navigation.maxcount" size="4" value="#[search.navigation.maxcount]#">
</fieldset>
</div>
</td>
Expand Down
8 changes: 8 additions & 0 deletions htroot/ConfigSearchPage_p.java
Expand Up @@ -37,6 +37,7 @@
import net.yacy.data.WorkTables;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.search.query.QueryParams;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;

Expand Down Expand Up @@ -93,6 +94,12 @@ public static serverObjects respond(final RequestHeader header, final serverObje
if (post.getBoolean("search.navigation.date")) nav += "date,";
if (nav.endsWith(",")) nav = nav.substring(0, nav.length() - 1);
sb.setConfig("search.navigation", nav);
// maxcount default
int navmaxcnt = post.getInt("search.navigation.maxcount", QueryParams.FACETS_STANDARD_MAXCOUNT);
if (navmaxcnt > 5) {
sb.setConfig(SwitchboardConstants.SEARCH_NAVIGATION_MAXCOUNT, navmaxcnt);
if (navmaxcnt != QueryParams.FACETS_STANDARD_MAXCOUNT) QueryParams.FACETS_STANDARD_MAXCOUNT = navmaxcnt;
}
}
if (post.containsKey("searchpage_default")) {
// load defaults from defaults/yacy.init file
Expand Down Expand Up @@ -174,6 +181,7 @@ public static serverObjects respond(final RequestHeader header, final serverObje
prop.put("search.navigation.namespace", sb.getConfig("search.navigation", "").indexOf("namespace",0) >= 0 ? 1 : 0);
prop.put("search.navigation.topics", sb.getConfig("search.navigation", "").indexOf("topics",0) >= 0 ? 1 : 0);
prop.put("search.navigation.date", sb.getConfig("search.navigation", "").indexOf("date",0) >= 0 ? 1 : 0);
prop.put("search.navigation.maxcount", sb.getConfigInt(SwitchboardConstants.SEARCH_NAVIGATION_MAXCOUNT, QueryParams.FACETS_STANDARD_MAXCOUNT));

prop.put("about.headline", sb.getConfig("about.headline", "About"));
prop.put("about.body", sb.getConfig("about.body", ""));
Expand Down
4 changes: 4 additions & 0 deletions source/net/yacy/search/Switchboard.java
Expand Up @@ -200,6 +200,7 @@
import net.yacy.search.index.Segment;
import net.yacy.search.index.Segment.ReferenceReportCache;
import net.yacy.search.query.AccessTracker;
import net.yacy.search.query.QueryParams;
import net.yacy.search.query.SearchEvent;
import net.yacy.search.query.SearchEventCache;
import net.yacy.search.ranking.RankingProfile;
Expand Down Expand Up @@ -1164,6 +1165,9 @@ public void run() {

this.trail = new LinkedBlockingQueue<String>();

// set configurable ui defaults
QueryParams.FACETS_STANDARD_MAXCOUNT = sb.getConfigInt(SwitchboardConstants.SEARCH_NAVIGATION_MAXCOUNT, QueryParams.FACETS_STANDARD_MAXCOUNT); // max number of navigator/facet lines

this.log.config("Finished Switchboard Initialization");
}

Expand Down
2 changes: 2 additions & 0 deletions source/net/yacy/search/SwitchboardConstants.java
Expand Up @@ -491,6 +491,8 @@ public final class SwitchboardConstants {
public static final String SEARCH_VERIFY = "search.verify";
public static final String SEARCH_VERIFY_DELETE = "search.verify.delete";

public static final String SEARCH_NAVIGATION_MAXCOUNT = "search.navigation.maxcount"; // max lines displayed in standard search navigators/facets

/**
* ranking+evaluation
*/
Expand Down
2 changes: 1 addition & 1 deletion source/net/yacy/search/query/QueryParams.java
Expand Up @@ -80,7 +80,7 @@

public final class QueryParams {

public static int FACETS_STANDARD_MAXCOUNT = 10000;
public static int FACETS_STANDARD_MAXCOUNT = 100; // max count of item lines in navigator
public static int FACETS_DATE_MAXCOUNT = 640;

public enum Searchdom {
Expand Down
Expand Up @@ -89,7 +89,7 @@ public void testAdd() throws Exception {

assertNotNull("getReference failed", wc);

// TODO: ReferenceContainer used for rwi results. As it distance doesn't persist after adding ref to container making the distance ranking obsolete -> remove or fix
// TODO: ReferenceContainer used for rwi results. As distance doesn't persist after adding ref to container making the distance ranking obsolete -> remove or fix
System.out.println("-----------------------------------------------------------");
System.out.println("WordReference (word distance) before add to container: " + wentry.distance());
System.out.println("WordReference (word distance) after get from container: " + wc.distance());
Expand Down

0 comments on commit af39a76

Please sign in to comment.