Class ClientUtils
java.lang.Object
org.apache.solr.client.solrj.util.ClientUtils
- Since:
- solr 1.3
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddSlices(Map<String, Slice> target, String collectionName, Collection<Slice> slices, boolean multiCollection) Constructs a slices map from a collection of slices and handles disambiguation if multiple collections are being queried simultaneouslystatic StringbuildRequestUrl(SolrRequest<?> solrRequest, String serverRootUrl, String collection) Create the full URL for a SolrRequest (excepting query parameters) as a Stringstatic StringReturns the (literal) value encoded properly, so it can be appended after aname=local-param key.static StringSee: Lucene query parser syntax for more information on Escaping Special Charactersstatic booleanshouldApplyDefaultCollection(String providedCollection, SolrRequest<?> request) Determines whether any SolrClient "default" collection should apply to the specified requeststatic Collection<ContentStream> toContentStreams(String str, String contentType) Take a string and make it an iterable ContentStreamstatic voidwriteXML(SolrInputDocument doc, Writer writer)
-
Field Details
-
TEXT_XML
- See Also:
-
TEXT_JSON
- See Also:
-
DEFAULT_PATH
- See Also:
-
-
Constructor Details
-
ClientUtils
public ClientUtils()
-
-
Method Details
-
toContentStreams
Take a string and make it an iterable ContentStream -
buildRequestUrl
public static String buildRequestUrl(SolrRequest<?> solrRequest, String serverRootUrl, String collection) throws MalformedURLException Create the full URL for a SolrRequest (excepting query parameters) as a String- Parameters:
solrRequest- theSolrRequestto build the URL forserverRootUrl- the root URL of the Solr server being targeted.collection- the collection to send the request to. May be null if no collection is needed.- Throws:
MalformedURLException- ifserverRootUrlcontains a malformed URL string
-
writeXML
- Throws:
IOException
-
escapeQueryChars
See: Lucene query parser syntax for more information on Escaping Special Characters -
encodeLocalParamVal
Returns the (literal) value encoded properly, so it can be appended after aname=local-param key.NOTE: This method assumes
$is a literal character that must be quoted. (It does not assume strings starting$should be treated as param references) -
addSlices
public static void addSlices(Map<String, Slice> target, String collectionName, Collection<Slice> slices, boolean multiCollection) Constructs a slices map from a collection of slices and handles disambiguation if multiple collections are being queried simultaneously -
shouldApplyDefaultCollection
public static boolean shouldApplyDefaultCollection(String providedCollection, SolrRequest<?> request) Determines whether any SolrClient "default" collection should apply to the specified request- Parameters:
providedCollection- a collection/core explicitly provided to the SolrClient (typically throughSolrClient.request(SolrRequest, String)request- theSolrRequestbeing executed
-