Revision 57207
Added by Katerina Iatropoulou over 4 years ago
SearchRequestController.java | ||
---|---|---|
6 | 6 |
import eu.dnetlib.data.search.utils.cql.ParameterQueryEnhancer; |
7 | 7 |
import eu.dnetlib.data.search.utils.vocabulary.VocabularyManager; |
8 | 8 |
import eu.dnetlib.domain.data.FormattedSearchResult; |
9 |
import eu.dnetlib.functionality.cql.CqlTranslatorImpl; |
|
9 | 10 |
import io.micrometer.core.annotation.Timed; |
10 | 11 |
import io.micrometer.prometheus.PrometheusMeterRegistry; |
11 | 12 |
import org.apache.commons.collections.ListUtils; |
12 | 13 |
import org.apache.commons.lang.IncompleteArgumentException; |
13 | 14 |
import org.apache.commons.lang.StringEscapeUtils; |
14 | 15 |
import org.apache.log4j.Logger; |
16 |
import org.apache.solr.client.solrj.SolrServerException; |
|
17 |
import org.apache.solr.client.solrj.impl.CloudSolrClient; |
|
18 |
import org.apache.solr.client.solrj.response.QueryResponse; |
|
19 |
import org.apache.solr.common.params.SolrParams; |
|
20 |
import org.apache.solr.common.util.NamedList; |
|
15 | 21 |
import org.springframework.beans.factory.annotation.Autowired; |
16 | 22 |
import org.springframework.context.annotation.EnableAspectJAutoProxy; |
17 | 23 |
import org.springframework.http.HttpStatus; |
... | ... | |
23 | 29 |
import org.springframework.web.bind.annotation.RequestMapping; |
24 | 30 |
import org.springframework.web.bind.annotation.RequestMethod; |
25 | 31 |
import org.springframework.web.bind.annotation.ResponseBody; |
32 |
import org.z3950.zing.cql.CQLParseException; |
|
26 | 33 |
|
27 | 34 |
import javax.annotation.Resource; |
35 |
import javax.servlet.ServletOutputStream; |
|
28 | 36 |
import javax.servlet.http.HttpServletRequest; |
29 | 37 |
import javax.servlet.http.HttpServletResponse; |
38 |
import java.io.IOException; |
|
30 | 39 |
import java.io.PrintWriter; |
31 | 40 |
import java.text.SimpleDateFormat; |
32 | 41 |
import java.util.*; |
... | ... | |
739 | 748 |
return request.getParameter("format"); |
740 | 749 |
} */ |
741 | 750 |
|
742 |
/*public void test(HttpServletRequest request, HttpServletResponse response) throws IOException, SolrServerException {
|
|
751 |
/*public static void main() throws IOException, SolrServerException {
|
|
743 | 752 |
|
744 | 753 |
long time = System.currentTimeMillis(); |
745 | 754 |
|
746 |
CloudSolrServer solrClient = new CloudSolrServer("openaire-solr-beta.vls.icm.edu.pl:9983"); |
|
755 |
CloudSolrClient solrClient = new CloudSolrClient.Builder(). |
|
756 |
withZkHost(Arrays.asList(new String[]{"quorum0.t.hadoop.research-infrastructures.eu:2182", |
|
757 |
"quorum1.t.hadoop.research-infrastructures.eu:2182", |
|
758 |
"quorum2.t.hadoop.research-infrastructures.eu:2182", |
|
759 |
"quorum3.t.hadoop.research-infrastructures.eu:2182", |
|
760 |
"quorum4.t.hadoop.research-infrastructures.eu:2182/solr-dev-openaire"})).build(); |
|
747 | 761 |
solrClient.setDefaultCollection("DMF-index-openaire"); |
748 | 762 |
|
749 |
response.setContentType("text/html"); |
|
750 |
ServletOutputStream out=response.getOutputStream(); |
|
763 |
// response.setContentType("text/html");
|
|
764 |
// ServletOutputStream out=response.getOutputStream();
|
|
751 | 765 |
|
752 | 766 |
NamedList<String> queryOpts = new NamedList<String>(); |
753 | 767 |
|
... | ... | |
792 | 806 |
|
793 | 807 |
for (int i = 0; i < resp.getResults().size(); i++) { |
794 | 808 |
String result = ((ArrayList<String>) resp.getResults().get(i).get("__result")).get(0); |
795 |
out.write(result.getBytes()); |
|
796 |
out.flush(); |
|
809 |
// out.write(result.getBytes());
|
|
810 |
// out.flush();
|
|
797 | 811 |
} |
798 | 812 |
|
799 | 813 |
System.out.println("END"); |
... | ... | |
807 | 821 |
|
808 | 822 |
} |
809 | 823 |
|
810 |
out.close(); |
|
824 |
// out.close();
|
|
811 | 825 |
|
812 | 826 |
time = System.currentTimeMillis() - time; |
813 | 827 |
System.out.println("Answer time " + time); |
Also available in: Unified diff
Reports always download the first 2000 results. Dedup organizations returned #4588