Examples of StudySearchResults


Examples of org.cipres.treebase.domain.search.StudySearchResults

   
    if (formName.equals("searchKeyword")) {
      SearchType searchType;
      String buttonName = request.getParameter("searchButton");
      String searchTerm = convertStars(request.getParameter("searchTerm"));
      StudySearchResults oldRes;
      {
        SearchResults<?> sr = searchResults(request);
        if (sr != null) {
          oldRes = (StudySearchResults) sr.convertToStudies();
        } else {
          oldRes = new StudySearchResults ();   // TODO: Convert existing search results to new type 
        }
      }     
      if (buttonName.equals("authorKeyword")) {
        searchType = SearchType.byAuthorName;
      } else if (buttonName.equals("studyID")) {
        searchType = SearchType.byID;
      } else if (buttonName.equals("legacyStudyID")) {
        searchType = SearchType.byLegacyID;
      } else if (buttonName.equals("titleKeyword")) {
        searchType = SearchType.byTitle;
      } else if (buttonName.equals("textKeyword")) {
        searchType = SearchType.byKeyword;
      } else if (buttonName.equals("citationKeyword")) {
        searchType = SearchType.inCitation;
      } else if (buttonName.equals("abstractKeyword")) {
        searchType = SearchType.inAbstract;
      } else if (buttonName.equals("doiKeyword")) {
        searchType = SearchType.byDOI;
      }
      else {
        throw new Error("Unknown search button name '" + buttonName + "'");
      }
      // XXX we now never do an exact match with terms provided through the web app. We can change
      // this, e.g. by adding a check box whose value is the boolean argument of doSearch()
      Collection<Study> matches = doSearch(request, response, searchType, errors,searchTerm,false,null)
      if ( TreebaseUtil.isEmpty(request.getParameter("format")) || ! request.getParameter("format").equals("rss1") ) {       
        SearchResults<Study> newRes = intersectSearchResults(oldRes, new StudySearchResults(matches),
        new RequestMessageSetter(request), "No matching studies found")
        saveSearchResults(request, newRes);
        return new ModelAndView("search/studySearch", Constants.RESULT_SET, newRes);    
      }
      else {
        return this.searchResultsAsRDF(new StudySearchResults(matches), request, null,"study","study");
      }
    }
    else {
      return super.onSubmit(request, response, command, errors);
    }
View Full Code Here

Examples of org.cipres.treebase.domain.search.StudySearchResults

    //String query = request.getParameter("query");           
    CQLParser parser = new CQLParser();
    CQLNode root = parser.parse(query);
    root = normalizeParseTree(root);
    Set<Study> queryResults = doCQLQuery(root, new HashSet<Study>(),request, response, errors);
    StudySearchResults tsr = new StudySearchResults(queryResults);
    if ( TreebaseUtil.isEmpty(request.getParameter("format")) || ! request.getParameter("format").equals("rss1") ) {
      saveSearchResults(request, tsr);
      return new ModelAndView("search/studySearch", Constants.RESULT_SET, tsr);
    }
    else {
      SearchResults<?> res = tsr;
      String schema = null;
      if ( ! TreebaseUtil.isEmpty(request.getParameter("recordSchema")) ) {
        schema = request.getParameter("recordSchema");
        if ( schema.equals("tree") ) {
          res = tsr.convertToTrees();
        }
        else if ( schema.equals("matrix") ) {
          res = tsr.convertToMatrices();
        }
        else if ( schema.equals("taxon") ) {
          res = tsr.convertToTaxa();
        }
      }
      if (! request.getParameter("format").equals("rss1")) {
        this.saveSearchResults(request, res);
      }
View Full Code Here

Examples of org.cipres.treebase.domain.search.StudySearchResults

  @Override
  protected void onSetUp() throws Exception {
    super.onSetUp();

    studies = getTestData();
    ssr = new StudySearchResults(studies);
   
    // populate set of matrices from test data
    matrices = new HashSet<Matrix> ();
    for (Study s : studies) {
      matrices.addAll(s.getMatrices());
View Full Code Here

Examples of org.cipres.treebase.domain.search.StudySearchResults

        String conversionType = request.getParameter("conversion");
     
        if (oldRes == null) {
          // The choice of StudySearchResults here is arbitrary
          // Guaranteeing a non-null oldRes makes the later logic simpler
          oldRes = (SearchResults<?>) new StudySearchResults();
        }
     
        if (conversionType.equals("toStudies")) {
          newRes = oldRes.convertToStudies();
          saveSearchResults(request, newRes);
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.