Search in sources :

Example 16 with QueryRequest

use of org.nextprot.api.solr.QueryRequest 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);
}
Also used : QueryRequest(org.nextprot.api.solr.QueryRequest) Query(org.nextprot.api.solr.Query) SearchResult(org.nextprot.api.solr.SearchResult) WebUnitBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest) Test(org.junit.Test)

Example 17 with QueryRequest

use of org.nextprot.api.solr.QueryRequest 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());
}
Also used : QueryRequest(org.nextprot.api.solr.QueryRequest) Query(org.nextprot.api.solr.Query) SearchResult(org.nextprot.api.solr.SearchResult) WebUnitBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest) Test(org.junit.Test)

Example 18 with QueryRequest

use of org.nextprot.api.solr.QueryRequest 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());
}
Also used : QueryRequest(org.nextprot.api.solr.QueryRequest) Query(org.nextprot.api.solr.Query) SearchResult(org.nextprot.api.solr.SearchResult) WebUnitBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest) Test(org.junit.Test)

Example 19 with QueryRequest

use of org.nextprot.api.solr.QueryRequest 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());
}
Also used : QueryRequest(org.nextprot.api.solr.QueryRequest) Query(org.nextprot.api.solr.Query) SearchResult(org.nextprot.api.solr.SearchResult) WebUnitBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest) Test(org.junit.Test)

Example 20 with QueryRequest

use of org.nextprot.api.solr.QueryRequest in project nextprot-api by calipho-sib.

the class ExportController method streamEntriesSubPart.

@RequestMapping(value = "/export/entries/{view}", method = { RequestMethod.GET })
public void streamEntriesSubPart(@PathVariable("view") String view, HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "query", required = false) String query, @RequestParam(value = "listId", required = false) String listId, @RequestParam(value = "queryId", required = false) String queryId, @RequestParam(value = "sparql", required = false) String sparql, @RequestParam(value = "chromosome", required = false) String chromosome, @RequestParam(value = "filter", required = false) String filter, @RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "order", required = false) String order, @RequestParam(value = "quality", required = false) String quality) {
    QueryRequest qr = buildQueryRequest(request, query, listId, queryId, sparql, chromosome, filter, quality, sort, order);
    streamEntryService.streamQueriedEntries(qr, NextprotMediaType.valueOf(request), view, response);
}
Also used : QueryRequest(org.nextprot.api.solr.QueryRequest)

Aggregations

QueryRequest (org.nextprot.api.solr.QueryRequest)21 Test (org.junit.Test)16 Query (org.nextprot.api.solr.Query)16 SearchResult (org.nextprot.api.solr.SearchResult)16 WebUnitBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest)14 NextProtException (org.nextprot.api.commons.exception.NextProtException)2 WebIntegrationBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest)2 HashSet (java.util.HashSet)1 ApiMethod (org.jsondoc.core.annotation.ApiMethod)1 Ignore (org.junit.Ignore)1 SearchQueryException (org.nextprot.api.commons.exception.SearchQueryException)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1