Examples of SearchResults


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

 
  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

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

      } 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

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

      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

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

 
  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

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

      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

Examples of org.opentides.bean.SearchResults

      processUpload(request, response, command, errors, "attachment");

      String action = getAction(request);
      setSkipAction(false);
      T obj = (T) command;
      SearchResults results = new SearchResults<T>(pageSize, numLinks);

      // perform the action
      if (action.equals(UPDATE)) {
        showView = getRefreshView();
        this.preUpdateAction(request, response, obj, errors);
        if (!skipAction)
          service.save(obj);
        this.postUpdateAction(request, response, obj, errors);
      } else if (action.equals(CREATE)) {
        showView = getRefreshView();
        this.preCreateAction(request, response, obj, errors);
        if (!skipAction)
          service.save(obj);
        this.postCreateAction(request, response, obj, errors);
      } else if (action.equals(DELETE)) {
        showView = getRefreshView();
        this.preDeleteAction(request, response, errors, request
            .getParameter(ID));
        if (!skipAction)
          service.delete(request.getParameter(ID));
        this.postDeleteAction(request, response, errors, request
            .getParameter(ID));
      } else if (action.equals(SEARCH)) {
        showView = getSearchView();
        this.preSearchAction(request, response, obj, errors);
        if (!skipAction) {
          long startTime = System.currentTimeMillis();
          String strPage = request.getParameter("page");
          int currPage = StringUtil.convertToInt(strPage, 1);
          results.setCurrPage(currPage);
          results.setTotalResults(this.countAction(obj));
          int start = results.getStartIndex();
          int total = results.getPageSize();
          if (supportsPaging) {
            if (command == null)
              // no command, let's search everything
              results.addResults(service.findAll(start, total));
            else
              // let's do a query by example
              results.addResults(service.findByExample(obj,
                  exactMatch, start, total));
          } else if (command == null)
            // no command, let's search everything
            results.addResults(service.findAll());
          else
            // let's do a query by example
            results.addResults(service.findByExample(obj,
                exactMatch));
          results.setSearchTime(System.currentTimeMillis()
              - startTime);
        }
        results = this.postSearchAction(request, response, obj, errors,
            results);
      }
View Full Code Here

Examples of org.springframework.social.twitter.SearchResults

public class SearchDemo {

  public static void main(String[] args) {
    TwitterTemplate template = new TwitterTemplate();
    SearchResults results = template.search("#springintegration");
    for (Tweet tweet : results.getTweets()) {
      System.out.println(tweet.getFromUser() + ": " + tweet.getText());
    }
  }
View Full Code Here

Examples of org.tei.comparator.web.client.SearchResults

  public SearchResults performSearchQuery(String query, int start) {
    int file = DocumentContainer.getInstance().getDerivedAsFile();
   
    List<MatchProposal> props = FullTextSearch.query(file, DocumentContainer.getInstance().getDerived(), query, start, 21);
   
    SearchResults results = new SearchResults();
    results.setMore(props.size() == 21);
    results.setOffset(20);
    results.setStart(start);
    results.setQuery(query);
    results.setType(SearchResults.TYPE_MANUAL_SEARCH);
    if(props.size() == 21)
      props.remove(20);
   
    for(MatchProposal p : props)
      p.setNotes(DBManager.getInstance().getNotesFor(TCNote.TYPE_PARAGRAPH, p.getId()));
     
    results.setProposals(props);
   
    return results;
  }
View Full Code Here

Examples of org.xwiki.rest.model.jaxb.SearchResults

        GetMethod getMethod =
            executeGet(String.format("%s?q=somethingthatcannotpossiblyexist", getUriBuilder(SpaceSearchResource.class)
                .build(getWiki(), "Main")));
        Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());

        SearchResults searchResults = (SearchResults) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());

        Assert.assertEquals(0, searchResults.getSearchResults().size());

        getMethod =
            executeGet(String.format("%s?q=sandbox", getUriBuilder(WikiSearchResource.class)
                .build(getWiki(), "Sandbox")));
        Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());

        searchResults = (SearchResults) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());

        int resultSize = searchResults.getSearchResults().size();
        Assert.assertTrue("Found " + resultSize + " result", resultSize >= 2);

        for (SearchResult searchResult : searchResults.getSearchResults()) {
            checkLinks(searchResult);
        }
    }
View Full Code Here

Examples of org.xwiki.rest.model.jaxb.SearchResults

    {
        GetMethod getMethod =
            executeGet(String.format("%s?q=easy-to-edit", getUriBuilder(WikiSearchResource.class).build(getWiki())));
        Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());

        SearchResults searchResults = (SearchResults) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());

        int resultSize = searchResults.getSearchResults().size();
        Assert.assertTrue(String.format("Found %s results", resultSize), resultSize >= 1);

        for (SearchResult searchResult : searchResults.getSearchResults()) {
            checkLinks(searchResult);
        }

        getMethod =
            executeGet(String.format("%s?q=WebHome&scope=name", getUriBuilder(WikiSearchResource.class)
                .build(getWiki())));
        Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());

        searchResults = (SearchResults) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());

        resultSize = searchResults.getSearchResults().size();
        Assert.assertTrue(String.format("Found %s results", resultSize), resultSize >= 3);

        for (SearchResult searchResult : searchResults.getSearchResults()) {
            checkLinks(searchResult);
        }

        // Note: we use $msg.get(...) a bit everywhere in our title for the moment... The search is a search in the DB
        // and not on the rendered content. Thus for our tests we search on msg...
        getMethod =
            executeGet(String.format("%s?q=msg&scope=title", getUriBuilder(WikiSearchResource.class).build(getWiki())));
        Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());

        searchResults = (SearchResults) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());

        resultSize = searchResults.getSearchResults().size();
        Assert.assertTrue(String.format("Found %s results", resultSize), searchResults.getSearchResults().size() >= 1);

        for (SearchResult searchResult : searchResults.getSearchResults()) {
            checkLinks(searchResult);
        }

        /* Check search for space names. Here we should get at least Sandbox as a result */
        getMethod =
            executeGet(String.format("%s?q=db&scope=spaces", getUriBuilder(WikiSearchResource.class).build(getWiki())));
        Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());

        searchResults = (SearchResults) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());

        resultSize = searchResults.getSearchResults().size();
        Assert.assertTrue(String.format("Found %s results", resultSize), resultSize >= 1);

        for (SearchResult searchResult : searchResults.getSearchResults()) {
            checkLinks(searchResult);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.