Package org.olat.core.commons.services.search

Examples of org.olat.core.commons.services.search.QueryException


      queryParser.setLowercaseExpandedTerms(false);//some add. fields are not tokenized and not lowered case
      Query query = queryParser.parse(queryString);
      try {
        query = searcher.rewrite(query);
      } catch (Exception ex) {
        throw new QueryException("Rewrite-Exception query because too many clauses. Query=" + query);
      }
      long startTime = System.currentTimeMillis();
      int n = SearchServiceImpl.getInstance().getSearchModuleConfig().getMaxHits() + 1;
      TopDocs docs = searcher.search(query, n);
      long queryTime = System.currentTimeMillis() - startTime;
      if (log.isDebug()) log.debug("hits.length()=" + docs.totalHits);
      SearchResultsImpl searchResult = new SearchResultsImpl(searcher, docs, query, analyzer, identity, roles, doHighlighting);
      searchResult.setQueryTime(queryTime);
      searchResult.setNumberOfIndexDocuments(searcher.maxDoc());
      queryCount++;
      return searchResult;
    } catch (ServiceNotAvailableException naex) {
      // pass exception
      throw new ServiceNotAvailableException(naex.getMessage());
    } catch (ParseException pex) {
      throw new ParseException("can not parse query=" + queryString);
    } catch (QueryException qex) {
      throw new QueryException(qex.getMessage());
    } catch (Exception ex) {
      log.warn("Exception in search", ex);
      throw new ServiceNotAvailableException(ex.getMessage());
    }
   }
View Full Code Here


          }
          return searchResult;             
        } else if (responseStatus.equalsIgnoreCase(JMS_RESPONSE_STATUS_PARSE_EXCEPTION)) {
          throw new ParseException("can not parse query=" + queryString);
        } else if (responseStatus.equalsIgnoreCase(JMS_RESPONSE_STATUS_QUERY_EXCEPTION)) {
          throw new QueryException("invalid query=" + queryString);
        } else if (responseStatus.equalsIgnoreCase(JMS_RESPONSE_STATUS_SERVICE_NOT_AVAILABLE_EXCEPTION)) {
          throw new ServiceNotAvailableException("Remote search service not available" + queryString);
        } else {
          Tracing.logWarn("doSearch: receive unkown responseStatus=" + responseStatus, ClusteredSearchRequester.class);
          return null;
View Full Code Here

TOP

Related Classes of org.olat.core.commons.services.search.QueryException

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.