2019年11月23日 | Leave a comment 解决: docker run –name s1 -p 8983:8983 -d solr , 管理界面 http://localhost:8983/solr docker exec s1 bin/solr create -c book 设置 schema , 最好通过 http api (web admin ui 8.3 要注意勾选再取消勾选才会禁用 multivalued ) curl --request POST \ --url http://localhost:8983/solr/book/schema \ --header 'content-type: application/json' \ --data '{"add-field":{"name":"category","type":"text_general","multiValued":false,"stored":true,"indexed":true}}' 1234 curl --request POST \ --url http://localhost:8983/solr/book/schema \ --header 'content-type: application/json' \ --data '{"add-field":{"name":"category","type":"text_general","multiValued":false,"stored":true,"indexed":true}}' solrj 更新查询 //更新 Book b1 = ****; solrClient.addBean("book", b1); solrClient.commit("book"); //查询 var q = new SolrQuery("*:*"); //如果不addField 会取回所有字段 q.addField("name"); var resp = s.solrClient.query("book", q); var books = resp.getBeans(Book.class); System.out.println(books); 1234567891011 //更新Book b1 = ****;solrClient.addBean("book", b1);solrClient.commit("book"); //查询var q = new SolrQuery("*:*");//如果不addField 会取回所有字段 q.addField("name");var resp = s.solrClient.query("book", q);var books = resp.getBeans(Book.class);System.out.println(books); dd 参考: http://lucene.apache.org/solr/guide/ https://hub.docker.com/_/solr