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 "Solrj" by Tom Gullo
Date Fri, 29 Jul 2011 17:37:20 GMT
Dear Wiki user,

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

The "Solrj" page has been changed by Tom Gullo:
http://wiki.apache.org/solr/Solrj?action=diff&rev1=59&rev2=60

      }
  }}}
  
+ == Use Groovy and Grape ==
+ {{{
+ 
+ @Grab(group='org.apache.solr', module='solr-solrj', version='1.4.1')
+ @Grab(group='org.slf4j', module='slf4j-jdk14', version='1.5.5')
+ import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer
+ import org.apache.solr.common.SolrInputDocument
+ 
+ String url = "http://localhost:8983/solr"
+ def server = new CommonsHttpSolrServer( url );
+ 
+ def doc = new SolrInputDocument()
+ 
+ doc.addField("id", 2)
+ doc.addField("word_s", "Cow")
+ doc.addField("desc_t", "Farm Animal")
+ 
+ server.add(doc)
+ server.commit()
+ 
+ println 'done'
+ 
+ 
+ }}}
+ 

Mime
View raw message