Package org.cipres.treebase.domain.search

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


    if (formName.equals("matrixSimple")) {
      String buttonName = request.getParameter("searchButton");
      Set<Matrix> matches = new HashSet<Matrix>();
      String searchTerm = convertStars(request.getParameter("searchTerm"));
       SearchMessageSetter mSetter = new RequestMessageSetter(request);
      MatrixSearchResults oldRes; 
      {
        SearchResults<?> sr = searchResults(request);
        if (sr != null) {
          oldRes = (MatrixSearchResults) sr.convertToMatrices();
        } else {
          oldRes = new MatrixSearchResults ();   // TODO: Convert existing search results to new type 
        }
      }     
      if (buttonName.equals("matrixID")) {
        matches.addAll(doSearch(request, response, SearchType.byID, errors,searchTerm));
      } else if  (buttonName.equals("matrixTitle")) {
        matches.addAll(doSearch(request, response, SearchType.byTitle, errors,searchTerm));
      } else if  (buttonName.equals("matrixType")) {
        matches.addAll(doSearch(request, response, SearchType.byType, errors,searchTerm));
      } else if  (buttonName.equals("matrixNTAX")) {
        matches.addAll(doSearch(request, response, SearchType.byNTAX, errors,searchTerm))
      } else if  (buttonName.equals("matrixNCHAR")) {
        matches.addAll(doSearch(request, response, SearchType.byNCHAR, errors,searchTerm));
      } else {
        throw new Error("Unknown search button name '" + buttonName + "'");
      }
      if ( TreebaseUtil.isEmpty(request.getParameter("format")) || ! request.getParameter("format").equals("rss1") ) {
        SearchResults<Matrix> newRes = intersectSearchResults(oldRes,
            new MatrixSearchResults(matches), mSetter, "No matching matrices found");
        saveSearchResults(request, newRes)
        return new ModelAndView("search/matrixSearch", Constants.RESULT_SET, newRes);
      }
      else {
        return this.searchResultsAsRDF(new MatrixSearchResults(matches), request, null, "matrix", "matrix");
      }     
    }
   
    else {
      return super.onSubmit(request, response, command, errors);
View Full Code Here


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

  }
 
  public void testMatrixSearchSerialization() {
    Document doc = DocumentFactory.safeCreateDocument();
    NexmlDocumentWriter ndw = new NexmlDocumentWriter(null, mTaxonLabelHome, doc);   
    MatrixSearchResults msr = ssr.convertToMatrices();
    ndw.fromTreeBaseToXml(msr);
    assertNotNull(doc.getXmlString());
  }
View Full Code Here

TOP

Related Classes of org.cipres.treebase.domain.search.MatrixSearchResults

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.