我想使用 solr 来索引 MySql 数据库,这样我就可以在我的网站上执行更快的数据搜索。任何人都可以帮我编写代码。我不知道如何在我的代码中实现 solr。
问问题
1600 次
2 回答
0
you many want to check for Solr Data Import Handler module which will help you index data from MySQL into Solr without writing any java code.
If you have downloaded Solr, You can check out the example solr-4.3.0/example/example-DIH
(Refer to the readme.txt) which will give you an idea of how the DIH is configured and the indexing can be done.
CommonsHttpSolrServer commonsHttpSolrServer = new CommonsHttpSolrServer("http://localhost:8983/solr");
QueryRequest request = new QueryRequest(params);
request.setPath("/dataimport");
ModifiableSolrParams params = new ModifiableSolrParams();
params.set("command", "full-import");
commonsHttpSolrServer.request(request);
NOTE - The request sent is asynchronous, so you would receive an immediate response and would need to check the status to know if it was complete.
于 2013-06-27T08:59:53.980 回答
0
你的问题太笼统了。但是,您可以先看看Solr 中的DataImport。
于 2013-06-27T08:59:01.570 回答