From: <rv...@us...> - 2010-06-02 14:42:52
|
Revision: 708 http://treebase.svn.sourceforge.net/treebase/?rev=708&view=rev Author: rvos Date: 2010-06-02 14:42:42 +0000 (Wed, 02 Jun 2010) Log Message: ----------- Fixes for issue 2992932 Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MatrixSearchController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudySearchController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TaxonSearchController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeTopSearchController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MatrixSearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MatrixSearchController.java 2010-06-02 13:27:57 UTC (rev 707) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MatrixSearchController.java 2010-06-02 14:42:42 UTC (rev 708) @@ -3,7 +3,9 @@ import java.io.IOException; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletRequest; @@ -71,21 +73,7 @@ LOGGER.info("formName is '" + formName + "'"); if ( ! TreebaseUtil.isEmpty(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 { - return this.searchResultsAsRDF(tsr, request, root); - } - */ - return this.handleQueryRequest(request, response, errors); + return this.handleQueryRequest(request, response, errors, query); } if (formName.equals("matrixSimple")) { @@ -180,27 +168,8 @@ } logger.debug(node); return results; - } + } - private CQLNode normalizeParseTree(CQLNode node) { - if ( node instanceof CQLBooleanNode ) { - ((CQLBooleanNode)node).left = normalizeParseTree(((CQLBooleanNode)node).left); - ((CQLBooleanNode)node).right = normalizeParseTree(((CQLBooleanNode)node).right); - return node; - } - else if ( node instanceof CQLTermNode ) { - String index = ((CQLTermNode)node).getIndex(); - String term = ((CQLTermNode)node).getTerm(); - CQLRelation relation = ((CQLTermNode)node).getRelation(); - index = index.replaceAll("dcterms.title", "tb.title.matrix"); - index = index.replaceAll("dcterms.identifier", "tb.identifier.matrix"); - index = index.replaceAll("dcterms.extent", "tb.ntax.matrix"); - return new CQLTermNode(index,relation,term); - } - logger.debug(node); - return node; - } - @SuppressWarnings("unchecked") private Collection<Matrix> doSearch( HttpServletRequest request, @@ -209,20 +178,6 @@ BindException errors, String searchTerm) throws InstantiationException { -// String searchTerm = convertStars(request.getParameter("searchTerm")); -// String keywordSearchTerm = "%" + 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 -// } -// } - Collection<Matrix> matches = null; MatrixService matrixService = getSearchService().getMatrixService(); @@ -271,13 +226,6 @@ } matches.removeAll(orphanedMatrices); return matches; - -// 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); } @@ -291,8 +239,8 @@ } @Override - protected ModelAndView handleQueryRequest(HttpServletRequest request,HttpServletResponse response,BindException errors) throws CQLParseException, IOException, InstantiationException { - String query = request.getParameter("query"); + protected ModelAndView handleQueryRequest(HttpServletRequest request,HttpServletResponse response,BindException errors, String query) throws CQLParseException, IOException, InstantiationException { + //String query = request.getParameter("query"); CQLParser parser = new CQLParser(); CQLNode root = parser.parse(query); root = normalizeParseTree(root); @@ -322,4 +270,13 @@ } } + @Override + protected Map<String, String> getPredicateMapping() { + Map<String,String> mapping = new HashMap<String,String>(); + mapping.put("dcterms.title", "tb.title.matrix"); + mapping.put("dcterms.identifier", "tb.identifier.matrix"); + mapping.put("dcterms.extent", "tb.ntax.matrix"); + return mapping; + } + } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchController.java 2010-06-02 13:27:57 UTC (rev 707) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchController.java 2010-06-02 14:42:42 UTC (rev 708) @@ -35,8 +35,11 @@ import org.springframework.validation.BindException; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; +import org.z3950.zing.cql.CQLBooleanNode; import org.z3950.zing.cql.CQLNode; import org.z3950.zing.cql.CQLParseException; +import org.z3950.zing.cql.CQLRelation; +import org.z3950.zing.cql.CQLTermNode; /** @@ -46,14 +49,51 @@ /** * Logger for this class */ - private static final Logger LOGGER = Logger.getLogger(SearchController.class); - + private static final Logger LOGGER = Logger.getLogger(SearchController.class); protected SearchService searchService; protected String formView; - private TaxonLabelService mTaxonLabelService; - protected abstract ModelAndView handleQueryRequest(HttpServletRequest request,HttpServletResponse response,BindException errors) throws CQLParseException, IOException, InstantiationException; + protected abstract ModelAndView handleQueryRequest(HttpServletRequest request,HttpServletResponse response,BindException errors,String query) throws CQLParseException, IOException, InstantiationException; + + /** + * Recursively traverses a CQL parse tree (presumably starting from its + * root node), replacing the observed indices with ones suggested by the map + * returned by getPredicateMapping(). The function of this is to allow concrete + * subclasses to create specific mappings from more general ones, e.g. when a + * study search query refers to the index "dcterms.identifier", the StudySearchController + * can specify that within its context this index is understood to mean "tb.identifier.study", + * i.e. the study ID. + * @param node + * @return + */ + protected CQLNode normalizeParseTree(CQLNode node) { + if ( node instanceof CQLBooleanNode ) { + ((CQLBooleanNode)node).left = normalizeParseTree(((CQLBooleanNode)node).left); + ((CQLBooleanNode)node).right = normalizeParseTree(((CQLBooleanNode)node).right); + return node; + } + else if ( node instanceof CQLTermNode ) { + String index = ((CQLTermNode)node).getIndex(); + String term = ((CQLTermNode)node).getTerm(); + CQLRelation relation = ((CQLTermNode)node).getRelation(); + Map<String,String> mapping = getPredicateMapping(); + for ( String key : mapping.keySet() ) { + index = index.replaceAll(key, mapping.get(key)); + } + return new CQLTermNode(index,relation,term); + } + logger.debug(node); + return node; + } + + /** + * Returns a mapping between more general search indices (e.g. "dcterms.identifier") + * and the specific indices (e.g. "tb.identifier.study") that are understood to be used + * by the concrete subclass + * @return + */ + protected abstract Map<String,String> getPredicateMapping(); protected ModelAndView onSubmit( HttpServletRequest request, @@ -399,7 +439,7 @@ String query = request.getParameter("query"); if ( query != null && ! TreebaseUtil.isEmpty(query) ) { LOGGER.info("query is '"+ query +"'"); - return this.handleQueryRequest(request, response, bindException); + return this.handleQueryRequest(request, response, bindException, query); } String action = request.getParameter("action"); if (action != null && action.equals("discard") && request.getMethod().equals("GET")) { Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudySearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudySearchController.java 2010-06-02 13:27:57 UTC (rev 707) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudySearchController.java 2010-06-02 14:42:42 UTC (rev 708) @@ -3,7 +3,9 @@ import java.io.IOException; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletRequest; @@ -96,7 +98,7 @@ if ( ! TreebaseUtil.isEmpty(query) && ! query.equals("")) { LOGGER.info("query is '" + query + "'"); - return this.handleQueryRequest(request, response, errors); + return this.handleQueryRequest(request, response, errors, query); } if (formName.equals("searchKeyword")) { @@ -129,7 +131,9 @@ } else { throw new Error("Unknown search button name '" + buttonName + "'"); } - Collection<Study> matches = doSearch(request, response, searchType, errors,searchTerm); + // 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); 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"); @@ -139,7 +143,8 @@ else { return this.searchResultsAsRDF(new StudySearchResults(matches), request, null,"study","study"); } - } else { + } + else { return super.onSubmit(request, response, command, errors); } } @@ -177,23 +182,24 @@ } else if ( node instanceof CQLTermNode ) { CQLTermNode term = (CQLTermNode)node; + boolean exactMatch = term.getRelation().getBase().equals("=="); String index = term.getIndex(); if ( index.startsWith("tb.title") ) { - results.addAll(doSearch(request, response, SearchType.byTitle, errors, term.getTerm())); + results.addAll(doSearch(request, response, SearchType.byTitle, errors, term.getTerm(),exactMatch)); } else if ( index.equals("tb.identifier.study") ) { - results.addAll(doSearch(request, response, SearchType.byID, errors, term.getTerm())); + results.addAll(doSearch(request, response, SearchType.byID, errors, term.getTerm(),exactMatch)); } else if ( index.startsWith("dcterms.contributor") ) { - results.addAll(doSearch(request, response, SearchType.byAuthorName, errors, term.getTerm())); + results.addAll(doSearch(request, response, SearchType.byAuthorName, errors, term.getTerm(),exactMatch)); } else if ( index.startsWith("dcterms.abstract") ) { - results.addAll(doSearch(request, response, SearchType.inAbstract, errors, term.getTerm())); + results.addAll(doSearch(request, response, SearchType.inAbstract, errors, term.getTerm(),exactMatch)); } else if ( index.startsWith("dcterms.subject") ) { - results.addAll(doSearch(request, response, SearchType.byKeyword, errors, term.getTerm())); + results.addAll(doSearch(request, response, SearchType.byKeyword, errors, term.getTerm(),exactMatch)); } else if ( index.startsWith("dcterms.bibliographicCitation") ) { - results.addAll(doSearch(request, response, SearchType.inCitation, errors, term.getTerm())); + results.addAll(doSearch(request, response, SearchType.inCitation, errors, term.getTerm(),exactMatch)); } else if ( index.equals("tb.identifier.study.tb1") ) { - results.addAll(doSearch(request, response, SearchType.byLegacyID, errors, term.getTerm())); + results.addAll(doSearch(request, response, SearchType.byLegacyID, errors, term.getTerm(),exactMatch)); } else if ( index.startsWith("prism.publicationName") ) { - results.addAll(doSearch(request, response, SearchType.byJournal, errors, term.getTerm())); + results.addAll(doSearch(request, response, SearchType.byJournal, errors, term.getTerm(),exactMatch)); } else { // issue warnings addMessage(request, "Unsupported index: " + index); @@ -201,48 +207,18 @@ } logger.debug(node); return results; - } + } - private CQLNode normalizeParseTree(CQLNode node) { - if ( node instanceof CQLBooleanNode ) { - ((CQLBooleanNode)node).left = normalizeParseTree(((CQLBooleanNode)node).left); - ((CQLBooleanNode)node).right = normalizeParseTree(((CQLBooleanNode)node).right); - return node; - } - else if ( node instanceof CQLTermNode ) { - String index = ((CQLTermNode)node).getIndex(); - String term = ((CQLTermNode)node).getTerm(); - CQLRelation relation = ((CQLTermNode)node).getRelation(); - index = index.replaceAll("dcterms.title", "tb.title.study"); - index = index.replaceAll("dcterms.identifier", "tb.identifier.study"); - return new CQLTermNode(index,relation,term); - } - logger.debug(node); - return node; - } - @SuppressWarnings("unchecked") protected Collection<Study> doSearch( HttpServletRequest request, HttpServletResponse response, SearchType searchType, BindException errors, - String searchTerm) throws InstantiationException { + String searchTerm, + boolean exactMatch) throws InstantiationException { -// String searchTerm = convertStars(request.getParameter("searchTerm")); String keywordSearchTerm = "%" + 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 -// } -// } -// -// LOGGER.info("doSearch old results contained " + oldRes.size() + " item(s)"); Collection<Study> matches; StudyService studyService = getSearchService().getStudyService(); @@ -283,79 +259,21 @@ matches = studyService.findByKeyword(keywordSearchTerm); break; case byJournal: - matches = studyService.findByJournal(keywordSearchTerm, false); + { + if ( exactMatch ) { + matches = studyService.findByJournal(searchTerm, exactMatch); + } else { + matches = studyService.findByJournal(keywordSearchTerm, exactMatch); + } break; + } default: throw new Error ("Unknown search type '" + searchType + "'"); } return matches; -// 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); } - /* - private void validateTaxonSet(HttpServletRequest request, - HttpServletResponse response, String searchTerm, - BindException errors) { - String[] taxonStrings = getTaxonStrings(searchTerm); - List<String> unrecognizedTaxa = new LinkedList<String> (); - List<String> recognizedTaxa = new LinkedList<String> (); - - Collection<TaxonLabel> taxonLabels = stringsToTaxonLabels(taxonStrings); - request.setAttribute("taxonLabelSetOverride", taxonLabels); - - for (TaxonLabel tl : taxonLabels) { - TaxonVariant variant = getTaxonLabelService().findTaxonVariant(tl); - if (variant == null) { - variant = getTaxonLabelService().createFromUBIOService(tl); - if (variant == null) { - unrecognizedTaxa.add(tl.getTaxonLabel()); - } else { - recognizedTaxa.add(tl.getTaxonLabel()); - } - } else { - recognizedTaxa.add(variant.getName()); - } - } - - LOGGER.info("validateTaxonSet: of " - + taxonStrings.length - + " entered taxa, " - + unrecognizedTaxa.size() - + " was/were unrecognized: " - + unrecognizedTaxa.toString()); - - request.setAttribute("unrecognizedTaxa", unrecognizedTaxa); - request.setAttribute("taxonLabels", joinStrings(recognizedTaxa)); - return; - } - - private String joinStrings(Collection<String> strings) { - String result = ""; - for (String s : strings) { - result = result + s + "\n"; - } - return result; - } - - private Collection<TaxonLabel> stringsToTaxonLabels(String[] taxonStrings) { - Collection<TaxonLabel> tls = new LinkedList<TaxonLabel>(); - for (String s : taxonStrings) { - tls.add(new TaxonLabel(titleCase(s))); - } - return tls; - } - - private String titleCase(String s) { - return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase(); - } - */ - @Override SearchResultsType currentSearchType() { return SearchResultsType.STUDY; @@ -368,9 +286,9 @@ @Override protected ModelAndView handleQueryRequest(HttpServletRequest request, - HttpServletResponse response, BindException errors) + HttpServletResponse response, BindException errors,String query) throws CQLParseException, IOException, InstantiationException { - String query = request.getParameter("query"); + //String query = request.getParameter("query"); CQLParser parser = new CQLParser(); CQLNode root = parser.parse(query); root = normalizeParseTree(root); @@ -399,4 +317,12 @@ return this.searchResultsAsRDF(res, request, root, schema, "study"); } } + + @Override + protected Map<String, String> getPredicateMapping() { + Map<String,String> mapping = new HashMap<String,String>(); + mapping.put("dcterms.title", "tb.title.study"); + mapping.put("dcterms.identifier", "tb.identifier.study"); + return mapping; + } } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TaxonSearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TaxonSearchController.java 2010-06-02 13:27:57 UTC (rev 707) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TaxonSearchController.java 2010-06-02 14:42:42 UTC (rev 708) @@ -3,7 +3,9 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletRequest; @@ -54,21 +56,7 @@ String formName = request.getParameter("formName"); String query = request.getParameter("query"); if ( ! TreebaseUtil.isEmpty(query) ) { - /* - CQLParser parser = new CQLParser(); - CQLNode root = parser.parse(query); - root = normalizeParseTree(root); - Set<Taxon> queryResults = doCQLQuery(root, new HashSet<Taxon>(),request); - TaxonSearchResults tsr = new TaxonSearchResults(queryResults); - saveSearchResults(request, tsr); - if ( TreebaseUtil.isEmpty(request.getParameter("format")) || ! request.getParameter("format").equals("rss1") ) { - return samePage(request); - } - else { - return this.searchResultsAsRDF(tsr, request, root); - } - */ - return this.handleQueryRequest(request, response, errors); + return this.handleQueryRequest(request, response, errors, query); } if (formName.equals("searchByTaxonLabel")) { SearchCommand newSearchCommand = (SearchCommand)searchCommand; @@ -109,24 +97,6 @@ } } - private CQLNode normalizeParseTree(CQLNode node) { - if ( node instanceof CQLBooleanNode ) { - ((CQLBooleanNode)node).left = normalizeParseTree(((CQLBooleanNode)node).left); - ((CQLBooleanNode)node).right = normalizeParseTree(((CQLBooleanNode)node).right); - return node; - } - else if ( node instanceof CQLTermNode ) { - String index = ((CQLTermNode)node).getIndex(); - String term = ((CQLTermNode)node).getTerm(); - CQLRelation relation = ((CQLTermNode)node).getRelation(); - index = index.replaceAll("dcterms.title", "tb.title.taxon"); - index = index.replaceAll("dcterms.identifier", "tb.identifier.taxon"); - return new CQLTermNode(index,relation,term); - } - logger.debug(node); - return node; - } - private Set<Taxon> doCQLQuery(CQLNode node, Set<Taxon> results, HttpServletRequest request) { if ( node instanceof CQLBooleanNode ) { Set<Taxon> resultsLeft = doCQLQuery(((CQLBooleanNode)node).left,results, request); @@ -401,9 +371,9 @@ @Override protected ModelAndView handleQueryRequest(HttpServletRequest request, - HttpServletResponse response, BindException errors) + HttpServletResponse response, BindException errors, String query) throws CQLParseException, IOException, InstantiationException { - String query = request.getParameter("query"); + //String query = request.getParameter("query"); CQLParser parser = new CQLParser(); CQLNode root = parser.parse(query); root = normalizeParseTree(root); @@ -432,4 +402,12 @@ return this.searchResultsAsRDF(res, request, root,schema,"taxon"); } } + + @Override + protected Map<String, String> getPredicateMapping() { + Map<String,String> mapping = new HashMap<String,String>(); + mapping.put("dcterms.title", "tb.title.taxon"); + mapping.put("dcterms.identifier", "tb.identifier.taxon"); + return mapping; + } } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java 2010-06-02 13:27:57 UTC (rev 707) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java 2010-06-02 14:42:42 UTC (rev 708) @@ -3,7 +3,9 @@ import java.io.IOException; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletRequest; @@ -69,21 +71,7 @@ LOGGER.info("formName is '" + formName + "'"); if ( ! TreebaseUtil.isEmpty(query) ) { - /* - CQLParser parser = new CQLParser(); - CQLNode root = parser.parse(query); - root = normalizeParseTree(root); - Set<PhyloTree> queryResults = doCQLQuery(root, new HashSet<PhyloTree>(),request, response, errors); - TreeSearchResults tsr = new TreeSearchResults(queryResults); - saveSearchResults(request, tsr); - if ( TreebaseUtil.isEmpty(request.getParameter("format")) || ! request.getParameter("format").equals("rss1") ) { - return new ModelAndView("search/treeSearch", Constants.RESULT_SET, tsr); - } - else { - return this.searchResultsAsRDF(tsr, request, root); - } - */ - return this.handleQueryRequest(request, response, errors); + return this.handleQueryRequest(request, response, errors, query); } if (formName.equals("treeSimple")) { @@ -180,25 +168,6 @@ logger.debug(node); return results; } - - private CQLNode normalizeParseTree(CQLNode node) { - if ( node instanceof CQLBooleanNode ) { - ((CQLBooleanNode)node).left = normalizeParseTree(((CQLBooleanNode)node).left); - ((CQLBooleanNode)node).right = normalizeParseTree(((CQLBooleanNode)node).right); - return node; - } - else if ( node instanceof CQLTermNode ) { - String index = ((CQLTermNode)node).getIndex(); - String term = ((CQLTermNode)node).getTerm(); - CQLRelation relation = ((CQLTermNode)node).getRelation(); - index = index.replaceAll("dcterms.title", "tb.title.tree"); - index = index.replaceAll("dcterms.identifier", "tb.identifier.tree"); - index = index.replaceAll("dcterms.extent", "tb.ntax.tree"); - return new CQLTermNode(index,relation,term); - } - logger.debug(node); - return node; - } @SuppressWarnings("unchecked") private Collection<PhyloTree> doSearch( @@ -208,18 +177,6 @@ BindException errors, String searchTerm) throws InstantiationException { -// String searchTerm = convertStars(request.getParameter("searchTerm")); -// String keywordSearchTerm = "%" + searchTerm + "%"; -// TreeSearchResults oldRes; -// { -// SearchResults<?> sr = searchResults(request); -// if (sr != null) { -// oldRes = (TreeSearchResults) sr.convertToTrees(); -// } else { -// oldRes = new TreeSearchResults (); // TODO: Convert existing search results to new type -// } -// } - Collection<PhyloTree> matches = null; PhyloTreeService phyloTreeService = getSearchService().getPhyloTreeService(); @@ -279,9 +236,9 @@ @Override protected ModelAndView handleQueryRequest(HttpServletRequest request, - HttpServletResponse response, BindException errors) + HttpServletResponse response, BindException errors, String query) throws CQLParseException, IOException, InstantiationException { - String query = request.getParameter("query"); + //String query = request.getParameter("query"); CQLParser parser = new CQLParser(); CQLNode root = parser.parse(query); root = normalizeParseTree(root); @@ -311,4 +268,13 @@ } } + @Override + protected Map<String, String> getPredicateMapping() { + Map<String,String> mapping = new HashMap<String,String>(); + mapping.put("dcterms.title", "tb.title.tree"); + mapping.put("dcterms.identifier", "tb.identifier.tree"); + mapping.put("dcterms.extent", "tb.ntax.tree"); + return mapping; + } + } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeTopSearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeTopSearchController.java 2010-06-02 13:27:57 UTC (rev 707) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeTopSearchController.java 2010-06-02 14:42:42 UTC (rev 708) @@ -5,6 +5,7 @@ import java.util.Collection; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletRequest; @@ -20,6 +21,7 @@ import org.cipres.treebase.web.Constants; import org.springframework.validation.BindException; import org.springframework.web.servlet.ModelAndView; +import org.z3950.zing.cql.CQLNode; import org.z3950.zing.cql.CQLParseException; /** @@ -189,10 +191,22 @@ @Override protected ModelAndView handleQueryRequest(HttpServletRequest request, - HttpServletResponse response, BindException errors) + HttpServletResponse response, BindException errors, String query) throws CQLParseException, IOException, InstantiationException { // TODO Auto-generated method stub return null; } + @Override + protected CQLNode normalizeParseTree(CQLNode node) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Map<String, String> getPredicateMapping() { + // TODO Auto-generated method stub + return null; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |