lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "javabin" by NoblePaul
Date Mon, 22 Jun 2009 05:17:18 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The following page has been changed by NoblePaul:
http://wiki.apache.org/solr/javabin

------------------------------------------------------------------------------
  javabin is a custom binary format used to write out solr's response in a [https://issues.apache.org/jira/browse/SOLR-486?focusedCommentId=12588875#action_12588875
fast and efficient] manner. [http://issues.apache.org/jira/browse/SOLR-486 SOLR-486] is the
jira issue .
  
  Currently only a [http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/common/util/NamedListCodec.java?revision=685640&view=markup
java library] is available to write/read this format .  This is the default format used by
SolrJ and this is the format used for inter-Solr communication in distributed search. Use
`wt=javabin` in request parameter to get the output in this format.
- 
+ [[TableOfContents]]
  == Supported Types ==
  It supports all the data types needed in Solr Response
   * null
@@ -24, +24 @@

   * org.apache.solr.common.util.!NamedList
   * org.apache.solr.common.util.!SimpleOrderedMap
   * Object[] (items must be of any known type)
+ 
+ == How to marshal/unmarshal ==
+ {{{
+ //example 
+ Map m= new HashMap();
+ m.put("hello", "world");
+ OutputStream os = new ByteArrayOutputStream();
+ new JavaBinCodec().marshal(m,os);
+ 
+ bytes b = ((ByteArrayOutputStream)os).toByteArray()
+ 
+ //now read the Object back
+ InputStream is =new ByteArrayInputStream(b);
+ Map m1 = new JavaBinCodec().unmarshal(is);
+ 
+ }}}
   
+ == How do I write any custom types ? ==
+ Any custom Object has to be first converted to one of the supported types then marshal it.
+ 
  
  
  ----

Mime
View raw message