Package org.sonatype.nexus.index

Examples of org.sonatype.nexus.index.Searcher


      throws Exception
  {
    SearchNGIndexPlexusResource resource = new SearchNGIndexPlexusResource(Lists.<Searcher>newArrayList());
    Map<String, String> terms = new HashMap<String, String>(4);
    terms.put("q", "!");
    Searcher searcher = mock(Searcher.class);
    when(searcher.canHandle(Mockito.any(Map.class))).thenReturn(true);

    when(
        searcher.flatIteratorSearch(Mockito.any(Map.class), anyString(), anyInt(), anyInt(), anyInt(),
            anyBoolean(), Mockito.any(SearchType.class), Mockito.any(List.class)))
        // emulate current indexer search behavior, illegal query results in IllegalArgEx with the ParseEx as cause
        .thenThrow(new IllegalArgumentException(new ParseException("mock")));

    try {
View Full Code Here


                                               final Integer from, final int count, final Boolean exact,
                                               final List<Searcher> searchers)
      throws NoSuchRepositoryException, ResourceException, IOException
  {
    try {
      Searcher searcher = null;

      for (Searcher _searcher : searchers) {
        if (_searcher.canHandle(terms)) {
          searcher = _searcher;
        }
      }

      if (searcher == null) {
        throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Requested search query is not supported");
      }

      SearchType searchType = searcher.getDefaultSearchType();

      if (exact != null) {
        searchType = exact ? SearchType.EXACT : SearchType.SCORED;
      }

      final IteratorSearchResponse searchResponse =
          searcher.flatIteratorSearch(terms, repositoryId, from, count, null, false, searchType, null/* filters */);

      return searchResponse;
    }
    catch (IllegalArgumentException e) {
      if (e.getCause() instanceof ParseException) {
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.index.Searcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.