SOLR-1881: add url-scheme for SearchHandler config

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@986815 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2010-08-18 17:41:40 +00:00
parent b573c16001
commit 8668ae733e
3 changed files with 19 additions and 2 deletions

View File

@ -228,6 +228,9 @@ New Features
* SOLR-2049: Add hl.multiValuedSeparatorChar for FastVectorHighlighter, per LUCENE-2603. (koji)
* SOLR-1881: add a url-scheme config string to SearchHandler to specify alternate
URL prefixes for distributed search shard requests. (Sami Siren via yonik)
Optimizations
----------------------

View File

@ -543,6 +543,9 @@
<arr name="last-components">
<str>spellcheck</str>
</arr>
<!--
<str name="url-scheme">httpx</str>
-->
</requestHandler>

View File

@ -64,9 +64,14 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware
// cannot be established within x ms. with a
// java.net.SocketTimeoutException: Connection timed out
static final String INIT_CONNECTION_TIMEOUT = "shard-connection-timeout";
// URL scheme to be used in distributed search.
static final String INIT_URL_SCHEME = "url-scheme";
static int soTimeout = 0; //current default values
static int connectionTimeout = 0; //current default values
public static String scheme = "http://"; //current default values
protected static Logger log = LoggerFactory.getLogger(SearchHandler.class);
protected List<SearchComponent> components = null;
@ -148,6 +153,12 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware
soTimeout = (Integer) so;
log.info("Setting shard-socket-timeout to: " + soTimeout);
}
Object urlScheme = initArgs.get(INIT_URL_SCHEME);
if (urlScheme != null) {
SearchHandler.scheme = (String) urlScheme + "://";
log.info("Setting url-scheme to: " + urlScheme);
}
}
public List<SearchComponent> getComponents() {
@ -403,7 +414,7 @@ class HttpCommComponent {
try {
// String url = "http://" + shard + "/select";
String url = "http://" + shard;
String url = SearchHandler.scheme + shard;
params.remove(CommonParams.WT); // use default (currently javabin)
params.remove(CommonParams.VERSION);