## org.apache.solr.client.solrj.util
Class ClientUtils

    java.lang.Object
      org.apache.solr.client.solrj.util.ClientUtils

    public class ClientUtils

extends Object

TODO? should this go in common?

Since:
  solr 1.3
Version:
  $Id: ClientUtils.java 679647 2008-07-25 02:46:02Z ryan $

Field Summary
`static Collection<String>` `fmts`
`static String` `TEXT_XML`
`static TimeZone` `UTC`

Constructor Summary
`ClientUtils()`

Method Summary
`static String` `escapeQueryChars(String input)` See: http://lucene.apache.org/java/docs/queryparsersyntax.html#Escaping Special Characters
`static DateFormat` `getThreadLocalDateFormat()` Returns a formatter that can be use by the current thread if needed to convert Date objects to the Internal representation.
`static Date` `parseDate(String d)` Returns a formatter that can be use by the current thread if needed to convert Date objects to the Internal representation.
`static Collection<org.apache.solr.common.util.ContentStream>` `toContentStreams(String str, String contentType)` Take a string and make it an iterable ContentStream
`static String` `toQueryString(org.apache.solr.common.params.SolrParams params, boolean xml)`
`static org.apache.solr.common.SolrDocument` `toSolrDocument(org.apache.solr.common.SolrInputDocument d)`
`static org.apache.solr.common.SolrInputDocument` `toSolrInputDocument(org.apache.solr.common.SolrDocument d)`
`static String` `toXML(org.apache.solr.common.SolrInputDocument doc)`
`static void` `writeXML(org.apache.solr.common.SolrInputDocument doc, Writer writer)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TEXT_XML

    public static final String TEXT_XML

See Also:
  Constant Field Values

### fmts

    public static final Collection<String> fmts

### UTC

    public static TimeZone UTC

Constructor Detail

### ClientUtils

    public ClientUtils()

Method Detail

### toContentStreams

    public static Collection<org.apache.solr.common.util.ContentStream> toContentStreams(String str,
                                                                                         String contentType)

  Take a string and make it an iterable ContentStream

### toSolrInputDocument

    public static org.apache.solr.common.SolrInputDocument toSolrInputDocument(org.apache.solr.common.SolrDocument d)

  Parameters:
    `d` - SolrDocument to convert
  Returns:
    a SolrInputDocument with the same fields and values as the SolrDocument. All boosts are 1.0f

### toSolrDocument

    public static org.apache.solr.common.SolrDocument toSolrDocument(org.apache.solr.common.SolrInputDocument d)

  Parameters:
    `d` - SolrInputDocument to convert
  Returns:
    a SolrDocument with the same fields and values as the SolrInputDocument

### writeXML

    public static void writeXML(org.apache.solr.common.SolrInputDocument doc,
                                Writer writer)
                         throws IOException

  Throws:
    `IOException`

### toXML

    public static String toXML(org.apache.solr.common.SolrInputDocument doc)

### parseDate

    public static Date parseDate(String d)
                          throws ParseException,
                                 org.apache.commons.httpclient.util.DateParseException

  Returns a formatter that can be use by the current thread if needed to convert Date objects to the Internal representation.

  Throws:
    `ParseException`
    `org.apache.commons.httpclient.util.DateParseException`

### getThreadLocalDateFormat

    public static DateFormat getThreadLocalDateFormat()

  Returns a formatter that can be use by the current thread if needed to convert Date objects to the Internal representation.

### escapeQueryChars

    public static String escapeQueryChars(String input)

  See: http://lucene.apache.org/java/docs/queryparsersyntax.html#Escaping Special Characters

### toQueryString

    public static String toQueryString(org.apache.solr.common.params.SolrParams params,
                                       boolean xml)

Copyright © 2008 Apache Software Foundation. All Rights Reserved.