Solr Customization using Java for modified output?

2019-08-22 04:53发布

问题:

I am developing an application uaing Solr. Everything is going fine and I am looking ahead to integrate Solr with CodeIgniter or some other framework for frontend. But there is a problem. I am performing some calculations on output rows thrown by Solr and showing them to users. It is really not feasible to do in PHP ( as it takes really long time). I have an existing code written in Java and hence, I find no reason in porting this application to PHP. How can I do that? Is there anyway I can insert my Java code on a certain query to modify output? Please note, operations I am performing are on Solr results only, so getting results is a must and then operations on them. Please suggest me how can I do that?

回答1:

If I understand you are developing a Front-end in PHP but want to reuse Java code to handle solr results to be presented on your front-end... Probably you have two ways to go:

  1. Crete simple Java "web service" that processes your Solr results and give them to your PHP front-end (so the PHP application needs to call the Java web service, that has the code you refer to)... for that you could use something like: Jersey (https://jersey.java.net/) to create a java web service.
  2. (probably the best one, if you are writing your Web applicaiton in PHP) you should look in more detail on Solr PHP clients (http://wiki.apache.org/solr/SolPHP).