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

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


  // TODO: chg: synchonized fix IOException: The handle is invalid, perhaps can be removed with newer lucene version.
  public SearchResults doSearch(String query, Identity identity, Roles roles, boolean doHighlighting) throws ServiceNotAvailableException, ParseException, QueryException {
    boolean doLog = log.isDebug();
    long start = 0;
    if (doLog) start = System.currentTimeMillis();   
    SearchResults searchResults = search.doSearch(query, identity, roles, doHighlighting);

    if (doLog) {
      long searchTime = (System.currentTimeMillis() - start);
      log.debug("Search query: " + query + " time: " + searchTime);
    }
View Full Code Here


    }
    Session session = null;
    try{
      Identity identity = ManagerFactory.getManager().loadIdentityByKey(searchRequest.getIdentityId());
 
      SearchResults searchResults = this.doSearch(searchRequest.getQueryString(), identity, searchRequest.getRoles(), searchRequest
          .isDoHighlighting());
      if (log_.isDebug()) {
        log_.debug("searchResults: " + searchResults.getLength());
      }
      if (searchResults != null) {
        session = acquireSession();
        Message responseMessage = session.createObjectMessage(searchResults);
        responseMessage.setJMSCorrelationID(correlationID);
View Full Code Here

      }
     
      getHighlightWords(searchString);
     
      query = getQueryString(searchString, condSearchString, parentCtxt, docType, rsrcUrl, false);
      SearchResults searchResults = searchCache.get(query);
      if(searchResults == null) {
        searchResults = searchService.doSearch(query, ureq.getIdentity(), ureq.getUserSession().getRoles(), true);
        searchCache.put(query, searchResults);
     
      if (searchResults.getList().isEmpty() && !query.endsWith(FUZZY_SEARCH)) {
        // result-list was empty => first try to find word via spell-checker
        if (doSpellCheck) {
          Set<String> didYouMeansWords = searchService.spellCheck(query);
          if (didYouMeansWords != null && !didYouMeansWords.isEmpty()) {
            setDidYouMeanWords(didYouMeansWords);
          } else {
            searchResults = doFuzzySearch(ureq, searchString, condSearchString, parentCtxt, docType, rsrcUrl);
          }
        } else {
          searchResults = doFuzzySearch(ureq, searchString, condSearchString, parentCtxt, docType, rsrcUrl);
        }
      }
     
      if(searchResults.getList().isEmpty()) {
        showInfo("found.no.result.try.fuzzy.search");
      }
      return searchResults;
    } catch (ParseException e) {
      if(log.isDebug()) log.debug("Query cannot be parsed: " + query);
View Full Code Here

 
  protected SearchResults doFuzzySearch(UserRequest ureq, String searchString, String condSearchString, String parentCtxt, String docType, String rsrcUrl)
  throws QueryException, ParseException, ServiceNotAvailableException  {
    hideDidYouMeanWords();
    String query = getQueryString(searchString, condSearchString, parentCtxt, docType, rsrcUrl, true);
    SearchResults searchResults = searchCache.get(query);
    if(searchResults == null) {
      searchResults = searchService.doSearch(query, ureq.getIdentity(), ureq.getUserSession().getRoles(), true);
      searchCache.put(query, searchResults);
    }
    return searchResults;
View Full Code Here

      } else {
        key = contextSelection.getSelectedKey();
      }
     
      hideDidYouMeanWords();
      SearchResults results = doSearch(ureq, didYouMeanWord, condQuery, getParentContext(), getDocumentType(), key, false);
      resultCtlr.setSearchResults(ureq, results, 0);
      persistSearch(ureq);
    } else if (source == extendedSearchLink) {
      extendedSearch = true;
      advancedSearchController.setSearchString(getSearchString());
View Full Code Here

      doAdvancedSearch(ureq);
    } else {
      String searchString = getSearchString();
      if(StringHelper.containsNonWhitespace(searchString)) {
        String key = contextSelection.getSelectedKey();
        SearchResults results = doSearch(ureq, searchString, null, getParentContext(), getDocumentType(), key, true);
        resultCtlr.setSearchResults(ureq, results, 0);
      }
      persistSearch(ureq);
    }
  }
View Full Code Here

 
  protected void doAdvancedSearch(UserRequest ureq) {
    String query = advancedSearchController.getSearchString();
    String condQuery = advancedSearchController.getQueryString();
    String key = advancedSearchController.getContext();
    SearchResults results = doSearch(ureq, query, condQuery, getParentContext(), getDocumentType(), key, true);
    resultCtlr.setSearchResults(ureq, results, 0);
    persistSearch(ureq);
  }
View Full Code Here

      Message returnedMessage = (Message) doSearchRequest(session, requestMessage);
      queryCount_++;
      if(returnedMessage!=null){
        String responseStatus = returnedMessage.getStringProperty(JMS_RESPONSE_STATUS_PROPERTY_NAME);
        if (responseStatus.equalsIgnoreCase(JMS_RESPONSE_STATUS_OK)) {
          SearchResults searchResult = (SearchResults)((ObjectMessage)returnedMessage).getObject();
          if(isDebug){
            Tracing.logDebug("ENDqueryString=" + queryString,ClusteredSearchRequester.class);
          }
          return searchResult;             
        } else if (responseStatus.equalsIgnoreCase(JMS_RESPONSE_STATUS_PARSE_EXCEPTION)) {
View Full Code Here

TOP

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

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.