use of org.nextprot.api.solr.Query in project nextprot-api by calipho-sib.
the class SolrServiceTest method shoulReturnSomePublicationsWhenStopWordsAreIncludedInQuery.
@Test
public void shoulReturnSomePublicationsWhenStopWordsAreIncludedInQuery() throws Exception {
QueryRequest qr;
Query q;
SearchResult result;
long numFound;
qr = new QueryRequest();
qr.setQuery("polo like");
q = queryBuilderService.buildQueryForSearch(qr, "publication");
result = service.executeQuery(q);
numFound = result.getFound();
// we should get some results
assertTrue(numFound > 0);
qr = new QueryRequest();
qr.setQuery("polo like in the of");
q = queryBuilderService.buildQueryForSearch(qr, "publication");
result = service.executeQuery(q);
numFound = result.getFound();
// we should ALSO get some results
assertTrue(numFound > 0);
}
use of org.nextprot.api.solr.Query in project nextprot-api by calipho-sib.
the class SolrServiceTest method shouldReturnResultsFromSimplePublicationQuery.
// indexes: gold-entry, entry, term, publication
@Test
public void shouldReturnResultsFromSimplePublicationQuery() throws Exception {
QueryRequest qr = new QueryRequest();
qr.setQuery("author:Doolittle");
Query q = queryBuilderService.buildQueryForSearch(qr, "publication");
SearchResult result = service.executeQuery(q);
assertEquals(28, result.getFound());
}
use of org.nextprot.api.solr.Query in project nextprot-api by calipho-sib.
the class SolrServiceTest method shouldReturnEmptyResultsFromEmptyQuery.
@Test
public void shouldReturnEmptyResultsFromEmptyQuery() throws Exception {
QueryRequest qr = new QueryRequest();
Query q = queryBuilderService.buildQueryForSearch(qr, "entry");
SearchResult result = service.executeQuery(q);
assertEquals(0, result.getFound());
}
use of org.nextprot.api.solr.Query in project nextprot-api by calipho-sib.
the class SolrServiceTest method shouldReturnSomeResultsFromAccessionSet.
@Test
public void shouldReturnSomeResultsFromAccessionSet() throws Exception {
Set<String> accessions = new HashSet<>(Arrays.asList("NX_P02671", "NX_P02675", "NX_P02679"));
QueryRequest qr = new QueryRequest();
qr.setQuality("GOLD");
qr.setEntryAccessionSet(accessions);
Query q = queryBuilderService.buildQueryForSearch(qr, "entry");
SearchResult result = service.executeQuery(q);
assertEquals(3, result.getFound());
for (Map<String, Object> resultMap : result.getResults()) {
assertTrue(accessions.contains(resultMap.get("id")));
}
}
use of org.nextprot.api.solr.Query in project nextprot-api by calipho-sib.
the class SolrServiceTest method shouldReturnEmptyResultsFromEmptyAccessionSet.
@Test
public void shouldReturnEmptyResultsFromEmptyAccessionSet() throws Exception {
QueryRequest qr = new QueryRequest();
qr.setQuality("GOLD");
qr.setEntryAccessionSet(new HashSet<>());
Query q = queryBuilderService.buildQueryForSearch(qr, "entry");
SearchResult result = service.executeQuery(q);
assertEquals(0, result.getFound());
}
Aggregations