Skip to content

Commit

Permalink
Improved previous merge "Show ranking in HTML UI".
Browse files Browse the repository at this point in the history
- added the new setting as configurable in the "Debug/Analysis" settings
page. Debug/analysis is its main purpose for now as there is currently
no nice and "understansable" ranking score info servlet (see forum
discussion http://forum.yacy-websuche.de/viewtopic.php?f=8&t=5884 ) 
- render in the "Search Page Layout" page preview when enabled
- added constants
  • Loading branch information
luccioman committed May 11, 2017
1 parent efe1232 commit d90b001
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 5 deletions.
1 change: 1 addition & 0 deletions defaults/yacy.init
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ search.result.show.hostbrowser = true
search.result.show.vocabulary = false
search.result.show.vocabulary.omit =
search.result.show.snapshots = false
# when true, display the raw ranking score value
search.result.show.ranking = false


Expand Down
8 changes: 8 additions & 0 deletions htroot/ConfigSearchPage_p.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ <h4 class="linktitle">
<td>&nbsp;|&nbsp;<a href="proxy.html" target="LayouTest">View via Proxy</a></td>
<td>&nbsp;|&nbsp;<a href="HostBrowser.html" target="LayouTest"><img src="env/grafics/minitree.png" width="15" height="8" title="Browse index" alt="Browse index"/></a></td>
<td>&nbsp;|&nbsp;<a href="yacysearch.html" target="LayouTest">Snapshots</a></td>
#(search.result.show.ranking)#::<td>&nbsp;|&nbsp;<span title="Raw ranking score value">Ranking: 1.12195955E9</span>#(/search.result.show.ranking)#
</tr>
<tr>
<td></td>
Expand All @@ -257,6 +258,13 @@ <h4 class="linktitle">
</td>
<td align="center"><input type="checkbox" name="search.result.show.hostbrowser" value="true" #(search.result.show.hostbrowser)#::checked="checked" #(/search.result.show.hostbrowser)# /></td>
<td align="center"><input type="checkbox" name="search.result.show.snapshots" value="true" #(search.result.show.snapshots)#::checked="checked" #(/search.result.show.snapshots)# /></td>
#(search.result.show.ranking)#::<td align="center">
<span class="info" style="padding-left: 10px"><img src="env/grafics/i16.gif" alt="info"/><span>
Ranking score value, mainly for debug/analysis purpose, configured in <a href="Settings_p.html?page=debug">Debug/Analysis Settings</a><br>
Menu: System Administration > Advanced Settings > Debug/Analysis Settings
</span></span>
</td>
#(/search.result.show.ranking)#
</tr>
</table>
</p>
Expand Down
1 change: 1 addition & 0 deletions htroot/ConfigSearchPage_p.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public static serverObjects respond(final RequestHeader header, final serverObje
prop.put("search.result.show.proxy", sb.getConfigBool("search.result.show.proxy", false) ? 1 : 0);
prop.put("search.result.show.hostbrowser", sb.getConfigBool("search.result.show.hostbrowser", false) ? 1 : 0);
prop.put("search.result.show.snapshots", sb.getConfigBool("search.result.show.snapshots", false) ? 1 : 0);
prop.put("search.result.show.ranking", sb.getConfigBool(SwitchboardConstants.SEARCH_RESULT_SHOW_RANKING, SwitchboardConstants.SEARCH_RESULT_SHOW_RANKING_DEFAULT) ? 1 : 0);

prop.put("search.navigation.location", sb.getConfig("search.navigation", "").indexOf("location",0) >= 0 ? 1 : 0);
// prop.put("search.navigation.filetype", sb.getConfig("search.navigation", "").indexOf("filetype",0) >= 0 ? 1 : 0);
Expand Down
3 changes: 3 additions & 0 deletions htroot/SettingsAck_p.java
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,9 @@ else if (!filter.equals("*")){
tickedCheckbox = post.containsKey("searchTestLocalSolr");
env.setConfig(SwitchboardConstants.DEBUG_SEARCH_REMOTE_SOLR_TESTLOCAL, tickedCheckbox);

tickedCheckbox = post.containsKey("searchShowRanking");
env.setConfig(SwitchboardConstants.SEARCH_RESULT_SHOW_RANKING, tickedCheckbox);

/* For easier user understanding, the following flags controlling data sources selection
* are rendered in the UI as checkboxes corresponding to enabled value when ticked */
tickedCheckbox = post.containsKey("searchLocalDHT");
Expand Down
20 changes: 20 additions & 0 deletions htroot/Settings_Debug.inc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,26 @@

</fieldset>

<fieldset>
<legend>Ranking information</legend>

<div class="form-group">
<div class="col-sm-4">
<div class="checkbox">
<label>
<input name="searchShowRanking" id="searchShowRanking"
type="checkbox" #(searchShowRankingChecked)#::checked#(/searchShowRankingChecked)#
aria-describedby="searchShowRankingInfo"/>
Show search results scores
</label>
</div>
</div>
<div class="col-sm-8" id="searchShowRankingInfo">
When checked, the raw ranking score value is displayed for each text search result in the HTML results page.
</div>
</div>
</fieldset>

<div class="col-sm-6">
<input type="submit" class="btn btn-primary" name="debugAnalysisSettings" value="Submit" aria-describedby="submitInfo"/>
<em id="submitInfo">Changes will take effect immediately.</em>
Expand Down
10 changes: 6 additions & 4 deletions htroot/Settings_p.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ else if (page.equals("crawler")) {
prop.put("server.https_port.ssl", sb.getConfig(SwitchboardConstants.SERVER_SSLPORT,"8443"));
prop.put("port.shutdown", sb.getConfig(SwitchboardConstants.SERVER_SHUTDOWNPORT, "-1"));

// debug/analysis
prop.put("solrBinaryResponseChecked", env.getConfigBool(SwitchboardConstants.REMOTE_SOLR_BINARY_RESPONSE_ENABLED,
SwitchboardConstants.REMOTE_SOLR_BINARY_RESPONSE_ENABLED_DEFAULT) ? 1 : 0);

// Referrer Policy
final String metaPolicy = env.getConfig(SwitchboardConstants.REFERRER_META_POLICY,
SwitchboardConstants.REFERRER_META_POLICY_DEFAULT);
Expand All @@ -229,6 +225,10 @@ else if (page.equals("crawler")) {
prop.put("searchResultNoReferrerChecked", env.getConfigBool(SwitchboardConstants.SEARCH_RESULT_NOREFERRER,
SwitchboardConstants.SEARCH_RESULT_NOREFERRER_DEFAULT) ? 1 : 0);

// debug/analysis
prop.put("solrBinaryResponseChecked", env.getConfigBool(SwitchboardConstants.REMOTE_SOLR_BINARY_RESPONSE_ENABLED,
SwitchboardConstants.REMOTE_SOLR_BINARY_RESPONSE_ENABLED_DEFAULT) ? 1 : 0);

/* For easier user understanding, the following flags controlling data sources selection
* are rendered in the UI as checkboxes corresponding to enabled value when ticked */
prop.put("searchLocalDHTChecked", !env.getConfigBool(SwitchboardConstants.DEBUG_SEARCH_LOCAL_DHT_OFF, false) ? 1 : 0);
Expand All @@ -239,6 +239,8 @@ else if (page.equals("crawler")) {
prop.put("searchTestLocalDHTChecked", env.getConfigBool(SwitchboardConstants.DEBUG_SEARCH_REMOTE_DHT_TESTLOCAL, false) ? 1 : 0);
prop.put("searchTestLocalSolrChecked", env.getConfigBool(SwitchboardConstants.DEBUG_SEARCH_REMOTE_SOLR_TESTLOCAL, false) ? 1 : 0);

prop.put("searchShowRankingChecked", env.getConfigBool(SwitchboardConstants.SEARCH_RESULT_SHOW_RANKING, SwitchboardConstants.SEARCH_RESULT_SHOW_RANKING_DEFAULT) ? 1 : 0);

// return rewrite properties
return prop;
}
Expand Down
2 changes: 1 addition & 1 deletion htroot/yacysearchitem.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h4 class="linktitle">
#(showHostBrowser)#::&nbsp;|&nbsp;<a href="HostBrowser.html?path=#[link]#"><img src="env/grafics/minitree.png" width="15" height="8" title="Browse index" alt="Browse index"/></a>#(/showHostBrowser)#
#(showVocabulary)#::<br/>#{vocabulary}##[name]#:#[terms]# #{/vocabulary}##(/showVocabulary)#
#(showSnapshots)#::<a href="#[link]#">Snapshots</a>#(/showSnapshots)#
#(showRanking)#::&nbsp;|&nbsp;Ranking: #[ranking]##(/showRanking)#
#(showRanking)#::&nbsp;|&nbsp;<span title="Raw ranking score value">Ranking: #[ranking]#</span>#(/showRanking)#
</p>
</div>
::
Expand Down
6 changes: 6 additions & 0 deletions source/net/yacy/search/SwitchboardConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,12 @@ public final class SwitchboardConstants {

/** Default setting value controlling whether a noreferrer link type should be added to search result links */
public static final boolean SEARCH_RESULT_NOREFERRER_DEFAULT = false;

/** Key of the setting controlling whether the ranking score value should be displayed for each search result in the HTML results page */
public static final String SEARCH_RESULT_SHOW_RANKING = "search.result.show.ranking";

/** Default setting value controlling whether the ranking score value should be displayed for each search result in the HTML results page */
public static final boolean SEARCH_RESULT_SHOW_RANKING_DEFAULT = false;

/**
* ranking+evaluation
Expand Down

0 comments on commit d90b001

Please sign in to comment.