Changeset 206
- Timestamp:
- Feb 18, 2010, 11:52:35 AM (12 years ago)
- Location:
- trunk/grails-app/views/query
- Files:
-
- 1 added
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/views/query/index.gsp
r139 r206 14 14 <ul> 15 15 <li><a href="#tab-simple">Simple query</a></li> 16 <li><a href="#tab-advanced">Advanced query</a></li>17 16 </ul> 18 17 <div id="tab-simple"> 19 <g:form url="[action:' index',controller:'searchable',params: 'q']">18 <g:form url="[action:'results',controller:'query',params: 'q']"> 20 19 <input type="hidden" name="targetUri" value="${targetUri}" /> 21 20 <label class="grey" for="q">Search for:</label> … … 29 28 </p> 30 29 </div> 31 <div id="tab-advanced"> 32 TODO: add advanced query here. 33 <n:isNotLoggedIn> 34 <p><small>To query private studies, please login above.</small></p> 35 </n:isNotLoggedIn> 36 </div> 30 37 31 </div> 38 32 </body> -
trunk/grails-app/views/query/results.gsp
r201 r206 1 2 <%@ page import="org.springframework.util.ClassUtils" %> 3 <%@ page import="org.codehaus.groovy.grails.plugins.searchable.SearchableUtils" %> 4 <%@ page import="org.codehaus.groovy.grails.plugins.searchable.lucene.LuceneUtils" %> 5 <%@ page import="org.codehaus.groovy.grails.plugins.searchable.util.StringQueryUtils" %> 1 6 <html> 2 <head> 3 <title>Generic Study Capture Framework - Query studies</title> 4 <meta name="layout" content="main" /> 5 <script type="text/javascript"> 6 $(function() { 7 $("#tabs").tabs(); 8 }); 9 </script> 10 </head> 11 <body> 7 <head> 8 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 9 <meta name="layout" content="main" /> 10 <g:set var="entityName" value="${message(code: 'study.label', default: 'Study')}" /> 11 <title><g:message code="default.list.label" args="[entityName]" /></title> 12 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 13 <title><g:if test="${params.q && params.q?.trim() != ''}">${params.q} - </g:if>Results</title> 14 15 <script type="text/javascript"> 16 var focusQueryInput = function() { 17 document.getElementById("q").focus(); 18 } 19 </script> 12 20 13 <div id="tabs"> 21 </head> 22 <body onload="focusQueryInput();"> 23 24 <div class="nav"> 25 <h1>Advanced query - select studies</h1> 26 27 <div style="clear: both; display: none;" class="hint">See <a href="http://lucene.apache.org/java/docs/queryparsersyntax.html">Lucene query syntax</a> for advanced queries</div> 28 </div> 29 <div id="main"> 30 <g:set var="haveQuery" value="${params.q?.trim()}" /> 31 <g:set var="haveResults" value="${searchResult?.results}" /> 32 <div class="title"> 33 <span> 34 <br> 35 <g:if test="${haveQuery && haveResults}"> 36 Showing <strong>${searchResult.offset + 1}</strong> - <strong>${searchResult.results.size() + searchResult.offset}</strong> of <strong>${searchResult.total}</strong> 37 results for <strong>${params.q}</strong> 38 </g:if> 39 <g:else> 40 41 </g:else> 42 </span> 43 </div> 44 45 <br> 46 <g:if test="${haveQuery && !haveResults && !parseException}"> 47 <p>Nothing matched your query - <strong>${params.q}</strong></p> 48 <g:if test="${!searchResult?.suggestedQuery}"> 49 <p>Suggestions:</p> 50 <ul> 51 <li>Try a suggested query: <g:link controller="searchable" action="index" params="[q: params.q, suggestQuery: true]">Search again with the <strong>suggestQuery</strong> option</g:link><br /> 52 <em>Note: Suggestions are only available when classes are mapped with <strong>spellCheck</strong> options, either at the class or property level.<br /> 53 The simplest way to do this is add <strong>spellCheck "include"</strong> to the domain class searchable mapping closure.<br /> 54 See the plugin/Compass documentation Mapping sections for details.</em> 55 </li> 56 </ul> 57 </g:if> 58 </g:if> 59 60 <g:if test="${searchResult?.suggestedQuery}"> 61 <p>Did you mean <g:link controller="searchable" action="index" params="[q: searchResult.suggestedQuery]">${StringQueryUtils.highlightTermDiffs(params.q.trim(), searchResult.suggestedQuery)}</g:link>?</p> 62 </g:if> 63 64 <g:if test="${parseException}"> 65 <p>Your query - <strong>${params.q}</strong> - is not valid.</p> 66 <p>Suggestions:</p> 14 67 <ul> 15 <li><a href="#tab-simple">Simple query</a></li> 16 <li><a href="#tab-advanced">Advanced query</a></li> 68 <li>Fix the query: see <a href="http://lucene.apache.org/java/docs/queryparsersyntax.html">Lucene query syntax</a> for examples</li> 69 <g:if test="${LuceneUtils.queryHasSpecialCharacters(params.q)}"> 70 <li>Remove special characters like <strong>" - [ ]</strong>, before searching, eg, <em><strong>${LuceneUtils.cleanQuery(params.q)}</strong></em><br /> 71 <em>Use the Searchable Plugin's <strong>LuceneUtils#cleanQuery</strong> helper method for this: <g:link controller="searchable" action="index" params="[q: LuceneUtils.cleanQuery(params.q)]">Search again with special characters removed</g:link></em> 72 </li> 73 <li>Escape special characters like <strong>" - [ ]</strong> with <strong>\</strong>, eg, <em><strong>${LuceneUtils.escapeQuery(params.q)}</strong></em><br /> 74 <em>Use the Searchable Plugin's <strong>LuceneUtils#escapeQuery</strong> helper method for this: <g:link controller="searchable" action="index" params="[q: LuceneUtils.escapeQuery(params.q)]">Search again with special characters escaped</g:link></em><br /> 75 <em>Or use the Searchable Plugin's <strong>escape</strong> option: <g:link controller="searchable" action="index" params="[q: params.q, escape: true]">Search again with the <strong>escape</strong> option enabled</g:link></em> 76 </li> 77 </g:if> 17 78 </ul> 18 <div id="tab-simple"> 19 <g:form url="[action:'index',controller:'searchable',params: 'q']"> 20 <input type="hidden" name="targetUri" value="${targetUri}" /> 21 <label class="grey" for="q">Search for:</label> 22 <input class="field" type="text" name="q" id="q" size="40" /> 23 <input type="submit" name="submit" value="Query"/> 24 </g:form> 25 <p> 26 <n:isNotLoggedIn> 27 <small>To query private studies, please login above.</small> 28 </n:isNotLoggedIn> 29 </p> 79 </g:if> 80 81 <g:form action="selectsample"> 82 83 <g:if test="${haveResults}"> 84 <div class="results"> 85 <table> 86 <g:each var="result" in="${searchResult.results}" status="index"> 87 <tr> 88 <td> 89 <input type="checkbox" name="${result.id}" id="${result.title}"> 90 </td> 91 <td> 92 <div class="result"> 93 <g:set var="className" value="${ClassUtils.getShortName(result.getClass())}" /> 94 <g:set var="link" value="${createLink(controller: className[0].toLowerCase() + className[1..-1], action: 'show', id: result.id)}" /> 95 <div class="name"><a href="${link}">${className} ${result.id}</a></div> 96 <g:set var="desc" value="${result.toString()}" /> 97 <g:if test="${desc.size() > 120}"><g:set var="desc" value="${desc[0..120] + '...'}" /></g:if> 98 <div class="desc">${desc.encodeAsHTML()}</div> 99 <br> 100 </div> 101 </td> 102 </tr> 103 </g:each> 104 </table> 30 105 </div> 31 <div id="tab-advanced"> 32 TODO: add advanced query here. 33 <n:isNotLoggedIn> 34 <p><small>To query private studies, please login above.</small></p> 35 </n:isNotLoggedIn> 106 107 <br> 108 <INPUT TYPE=submit name=submit Value=">> Execute and continue with sample selection"> 109 110 <div> 111 <div class="paging"> 112 <g:if test="${haveResults}"> 113 <br> 114 Page: 115 <g:set var="totalPages" value="${Math.ceil(searchResult.total / searchResult.max)}" /> 116 <g:if test="${totalPages == 1}"><span class="currentStep">1</span></g:if> 117 <g:else><g:paginate controller="searchable" action="index" params="[q: params.q]" total="${searchResult.total}" prev="< previous" next="next >"/></g:else> 118 </g:if> 119 </div> 36 120 </div> 37 </div> 121 </g:if> 122 </g:form> 123 </div> 38 124 </body> 39 125 </html>
Note: See TracChangeset
for help on using the changeset viewer.