String ZookeeperQuorum="192.168.10.1",192.168.10.2,192.168.10.3"; CloudSolrServer server=new CloudSolrServer(ZookeeperQuorum); server.setDefaultCollection("yourCollection"); SolrInputDocument doc = new SolrInputDocument(); doc.addField("id","111"); doc.addField("intfield",100); doc.addField("StringField","some data"); server.connect(); server.add(doc); server.commit();
Then, a doc with id=111 will be created, and in that doc we will see "intfield"=100 and "StringField"="some data".
沒有留言:
張貼留言