use of org.nextprot.api.solr.Query in project nextprot-api by calipho-sib.
the class SolrServiceTest method shoulReturnSomeTermsWhenStopWordsAreIncludedInQuery.
@Test
public void shoulReturnSomeTermsWhenStopWordsAreIncludedInQuery() throws Exception {
QueryRequest qr;
Query q;
SearchResult result;
long numFound;
qr = new QueryRequest();
qr.setQuery("brain");
q = queryBuilderService.buildQueryForSearch(qr, "term");
result = service.executeQuery(q);
numFound = result.getFound();
// we should get some results
assertTrue(numFound > 0);
qr = new QueryRequest();
qr.setQuery("brain in the of");
q = queryBuilderService.buildQueryForSearch(qr, "term");
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 shouldReturnResultsFromSimpleGoldEntryQuery.
@Test
public void shouldReturnResultsFromSimpleGoldEntryQuery() throws Exception {
QueryRequest qr = new QueryRequest();
qr.setQuality("GOLD");
qr.setQuery("MSH6");
Query q = queryBuilderService.buildQueryForSearch(qr, "entry");
SearchResult result = service.executeQuery(q);
assertEquals(73, result.getFound());
}
use of org.nextprot.api.solr.Query in project nextprot-api by calipho-sib.
the class SolrServiceTest method shouldReturnResultsFromSimpleTermQuery.
@Test
public void shouldReturnResultsFromSimpleTermQuery() throws Exception {
QueryRequest qr = new QueryRequest();
qr.setQuery("liver");
Query q = queryBuilderService.buildQueryForSearch(qr, "term");
SearchResult result = service.executeQuery(q);
assertEquals(1356, result.getFound());
}
use of org.nextprot.api.solr.Query in project nextprot-api by calipho-sib.
the class SolrServiceTest method shouldReturnResultsFromSimpleEntryQuery.
@Test
public void shouldReturnResultsFromSimpleEntryQuery() throws Exception {
QueryRequest qr = new QueryRequest();
qr.setQuery("MSH6");
Query q = queryBuilderService.buildQueryForSearch(qr, "entry");
SearchResult result = service.executeQuery(q);
assertEquals(101, result.getFound());
}
use of org.nextprot.api.solr.Query in project nextprot-api by calipho-sib.
the class SearchServiceImpl method getAccessionsForSimple.
private Set<String> getAccessionsForSimple(QueryRequest queryRequest) {
Set<String> set = new LinkedHashSet<>();
try {
Query query = this.queryBuilderService.buildQueryForSearchIndexes("entry", "simple", queryRequest);
SearchResult results = solrService.executeIdQuery(query);
for (Map<String, Object> f : results.getFoundFacets("id")) {
String entry = (String) f.get("name");
set.add(entry);
}
} catch (SearchQueryException e) {
e.printStackTrace();
throw new NextProtException("Error when retrieving accessions");
}
return set;
}
Aggregations