Revision 55652
Added by Katerina Iatropoulou almost 5 years ago
modules/uoa-search/trunk/src/test/java/eu/dnetlib/data/search/utils/solr/SolrUtilsTest.java | ||
---|---|---|
7 | 7 |
import eu.dnetlib.functionality.cql.CqlTranslator; |
8 | 8 |
import eu.dnetlib.functionality.cql.CqlTranslatorImpl; |
9 | 9 |
import org.apache.log4j.BasicConfigurator; |
10 |
import org.apache.solr.client.solrj.impl.CloudSolrServer;
|
|
10 |
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
|
11 | 11 |
import org.apache.solr.common.util.NamedList; |
12 | 12 |
import org.junit.Assert; |
13 | 13 |
import org.junit.Before; |
... | ... | |
37 | 37 |
List<String> refineFields = new ArrayList<String>(); |
38 | 38 |
List<String> fieldQueries = new ArrayList<String>(); |
39 | 39 |
List<String> fieldQueriesWithComma = new ArrayList<String>(); |
40 |
CloudSolrServer mockSolrClient;
|
|
40 |
CloudSolrClient mockSolrClient;
|
|
41 | 41 |
SolrResultSet mockRS; |
42 | 42 |
|
43 | 43 |
@Before |
44 | 44 |
public void before() { |
45 | 45 |
BasicConfigurator.configure(); |
46 |
mockSolrClient = Mockito.mock(CloudSolrServer.class);
|
|
46 |
mockSolrClient = Mockito.mock(CloudSolrClient.class);
|
|
47 | 47 |
doNothing().when(mockSolrClient).setDefaultCollection(anyString()); |
48 | 48 |
|
49 | 49 |
mockRS = Mockito.mock(SolrResultSet.class); |
modules/uoa-search/trunk/src/main/java/eu/dnetlib/data/search/solr/SolrResultSet.java | ||
---|---|---|
7 | 7 |
import eu.dnetlib.data.search.utils.solr.SolrResultSetOptionsUtil; |
8 | 8 |
import eu.dnetlib.data.search.utils.solr.SolrResultsFormatter; |
9 | 9 |
import eu.dnetlib.domain.EPR; |
10 |
import eu.dnetlib.functionality.cql.CqlTranslatorImpl; |
|
11 | 10 |
import gr.uoa.di.driver.enabling.resultset.ResultSet; |
12 | 11 |
import org.apache.commons.lang.StringEscapeUtils; |
13 | 12 |
import org.apache.log4j.Logger; |
... | ... | |
386 | 385 |
} |
387 | 386 |
} |
388 | 387 |
|
389 |
public static void main(String[] args) throws IOException, CQLParseException, SolrServerException { |
|
388 |
/* public static void main(String[] args) throws IOException, CQLParseException, SolrServerException {
|
|
390 | 389 |
CloudSolrServer solrClient = new CloudSolrServer("beta.solr.openaire.eu:9983"); |
391 |
solrClient.setDefaultCollection("TMF-index-openaire");
|
|
390 |
solrClient.setDefaultCollection("DMF-index-openaire");
|
|
392 | 391 |
|
393 | 392 |
NamedList<String> queryOpts = new NamedList<String>(); |
394 | 393 |
|
395 | 394 |
//q=*:*&start=0&rows=10&cursorMark=*&sort=dateofcollection asc |
396 |
queryOpts.add("q", new CqlTranslatorImpl().getTranslatedQuery("oaftype=result").asLucene());
|
|
395 |
queryOpts.add("q", new CqlTranslatorImpl().getTranslatedQuery("objIdentifier = acm_________::0002c24f82c295e925a2bdf7bbf49bfc").asLucene());
|
|
397 | 396 |
queryOpts.add("start", "0"); |
398 |
queryOpts.add("rows", "2");
|
|
399 |
//queryOpts.add("fl", "__result");
|
|
397 |
queryOpts.add("rows", "1");
|
|
398 |
queryOpts.add("fl", "__result"); |
|
400 | 399 |
queryOpts.add("shards.tolerant","true"); |
401 |
// queryOpts.add("cursorMark", "*");
|
|
402 |
queryOpts.add("sort", "resultdateofacceptance desc");
|
|
400 |
queryOpts.add("cursorMark", "*"); |
|
401 |
queryOpts.add("sort", "__indexrecordidentifier asc");
|
|
403 | 402 |
|
404 | 403 |
|
405 | 404 |
//queryOpts.add("q", new CqlTranslatorImpl().getTranslatedQuery("oaftype exact project").asLucene()); |
... | ... | |
409 | 408 |
|
410 | 409 |
System.out.println("results " + resp.getResults().size()); |
411 | 410 |
|
412 |
|
|
413 |
/*String cursorMark = "*"; |
|
411 |
String cursorMark = "*"; |
|
414 | 412 |
String nextCursorMark = ""; |
415 | 413 |
|
416 | 414 |
int curs = 0; |
... | ... | |
485 | 483 |
|
486 | 484 |
System.out.println("max: " + max); |
487 | 485 |
*/ |
488 |
} |
|
486 |
// }
|
|
489 | 487 |
|
490 | 488 |
// @Override |
491 | 489 |
// public EPR getEpr() { |
modules/uoa-search/trunk/src/main/java/eu/dnetlib/data/search/web/api/SearchApiService.java | ||
---|---|---|
652 | 652 |
} |
653 | 653 |
|
654 | 654 |
long startTime = System.nanoTime(); |
655 |
logger.debug("type " + type); |
|
656 | 655 |
final RequestResponseHandler.Entity entity = extractEntity(type); |
657 |
logger.debug("Entity type " + entity); |
|
658 | 656 |
final Transformer transformer = extractTransformer(format, extractEntity(type)); |
659 | 657 |
final boolean special = isSpecialFormat(format); |
660 | 658 |
String responseType = extractResponseFormat(format); |
modules/uoa-search/trunk/src/main/java/eu/dnetlib/data/search/web/api/SearchRequestController.java | ||
---|---|---|
89 | 89 |
String locale = request.getParameter("locale"); |
90 | 90 |
|
91 | 91 |
int page= 0; |
92 |
int size =-1;
|
|
92 |
int size = 0;
|
|
93 | 93 |
//TODO check paging |
94 | 94 |
if (!action.equals("refine")) { |
95 | 95 |
page = readParameter(request, "page", 1); |
... | ... | |
535 | 535 |
return "results_openaire"; |
536 | 536 |
} |
537 | 537 |
} |
538 |
|
|
539 | 538 |
return null; |
540 | 539 |
|
541 | 540 |
} |
modules/uoa-search/trunk/pom.xml | ||
---|---|---|
11 | 11 |
<packaging>jar</packaging> |
12 | 12 |
<version>3.5.0-SNAPSHOT</version> |
13 | 13 |
<scm> |
14 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/uoa-search/trunk</developerConnection>
|
|
14 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/uoa-search/tags/uoa-search-3.5.0</developerConnection>
|
|
15 | 15 |
</scm> |
16 | 16 |
<repositories> |
17 | 17 |
<!-- Cloudera Repositories --> |
Also available in: Unified diff
updated test + page correction in SearchRequestController