@Test public void quickSearch() throws Exception { String query = "query"; String solrResponse = "{ \"solrResponse\": \"this is a test response.\" }"; String q = "catch_all:" + query; expect(mockAuthentication.getName()).andReturn("user").atLeastOnce(); expect(mockExecuteSolrQuery.getResultsByPredefinedQuery(mockAuthentication, SolrCore.QUICK_SEARCH, q, 0, 10, "")) .andReturn(solrResponse); replayAll(); MvcResult result = mockMvc.perform( get("/api/v1/plugin/search/quickSearch?q=" + query) .principal(mockAuthentication)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andReturn(); verifyAll(); String jsonString = result.getResponse().getContentAsString(); log.debug("Got JSON: " + jsonString); assertEquals(solrResponse, jsonString); }
@RequestMapping(value = "/quickSearch", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public String quickSearch( @RequestParam(value = "q", required = true) String query, @RequestParam(value = "s", required = false, defaultValue = "") String sort, @RequestParam(value = "start", required = false, defaultValue = "0") int startRow, @RequestParam(value = "n", required = false, defaultValue = "10") int maxRows, Authentication authentication) throws MuleException { if (log.isDebugEnabled()) { log.debug("User '" + authentication.getName() + "' is searching for '" + query + "'"); } String q = SearchConstants.CATCH_ALL_QUERY + query; return getExecuteSolrQuery().getResultsByPredefinedQuery(authentication, SolrCore.QUICK_SEARCH, q, startRow, maxRows, sort); }
QuickSearchAPIController { @RequestMapping(value = "/quickSearch", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public String quickSearch( @RequestParam(value = "q", required = true) String query, @RequestParam(value = "s", required = false, defaultValue = "") String sort, @RequestParam(value = "start", required = false, defaultValue = "0") int startRow, @RequestParam(value = "n", required = false, defaultValue = "10") int maxRows, Authentication authentication) throws MuleException { if (log.isDebugEnabled()) { log.debug("User '" + authentication.getName() + "' is searching for '" + query + "'"); } String q = SearchConstants.CATCH_ALL_QUERY + query; return getExecuteSolrQuery().getResultsByPredefinedQuery(authentication, SolrCore.QUICK_SEARCH, q, startRow, maxRows, sort); } }
QuickSearchAPIController { @RequestMapping(value = "/quickSearch", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public String quickSearch( @RequestParam(value = "q", required = true) String query, @RequestParam(value = "s", required = false, defaultValue = "") String sort, @RequestParam(value = "start", required = false, defaultValue = "0") int startRow, @RequestParam(value = "n", required = false, defaultValue = "10") int maxRows, Authentication authentication) throws MuleException { if (log.isDebugEnabled()) { log.debug("User '" + authentication.getName() + "' is searching for '" + query + "'"); } String q = SearchConstants.CATCH_ALL_QUERY + query; return getExecuteSolrQuery().getResultsByPredefinedQuery(authentication, SolrCore.QUICK_SEARCH, q, startRow, maxRows, sort); }  }
QuickSearchAPIController { @RequestMapping(value = "/quickSearch", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public String quickSearch( @RequestParam(value = "q", required = true) String query, @RequestParam(value = "s", required = false, defaultValue = "") String sort, @RequestParam(value = "start", required = false, defaultValue = "0") int startRow, @RequestParam(value = "n", required = false, defaultValue = "10") int maxRows, Authentication authentication) throws MuleException { if (log.isDebugEnabled()) { log.debug("User '" + authentication.getName() + "' is searching for '" + query + "'"); } String q = SearchConstants.CATCH_ALL_QUERY + query; return getExecuteSolrQuery().getResultsByPredefinedQuery(authentication, SolrCore.QUICK_SEARCH, q, startRow, maxRows, sort); }  @RequestMapping(value = "/quickSearch", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody String quickSearch(
            @RequestParam(value = "q", required = true) String query,
            @RequestParam(value = "s", required = false, defaultValue = "") String sort,
            @RequestParam(value = "start", required = false, defaultValue = "0") int startRow,
            @RequestParam(value = "n", required = false, defaultValue = "10") int maxRows,
            Authentication authentication); ExecuteSolrQuery getExecuteSolrQuery(); void setExecuteSolrQuery(ExecuteSolrQuery executeSolrQuery); }
QuickSearchAPIController { @RequestMapping(value = "/quickSearch", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public String quickSearch( @RequestParam(value = "q", required = true) String query, @RequestParam(value = "s", required = false, defaultValue = "") String sort, @RequestParam(value = "start", required = false, defaultValue = "0") int startRow, @RequestParam(value = "n", required = false, defaultValue = "10") int maxRows, Authentication authentication) throws MuleException { if (log.isDebugEnabled()) { log.debug("User '" + authentication.getName() + "' is searching for '" + query + "'"); } String q = SearchConstants.CATCH_ALL_QUERY + query; return getExecuteSolrQuery().getResultsByPredefinedQuery(authentication, SolrCore.QUICK_SEARCH, q, startRow, maxRows, sort); }  @RequestMapping(value = "/quickSearch", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody String quickSearch(
            @RequestParam(value = "q", required = true) String query,
            @RequestParam(value = "s", required = false, defaultValue = "") String sort,
            @RequestParam(value = "start", required = false, defaultValue = "0") int startRow,
            @RequestParam(value = "n", required = false, defaultValue = "10") int maxRows,
            Authentication authentication); ExecuteSolrQuery getExecuteSolrQuery(); void setExecuteSolrQuery(ExecuteSolrQuery executeSolrQuery);  }