Changeset 4530
- Timestamp:
- 02/18/14 07:15:00 (10 years ago)
- Location:
- vlo/branches/vlo-3.0/vlo-web-app/src
- Files:
-
- 4 added
- 8 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/config/VloSpringConfig.java
r4517 r4530 20 20 import eu.clarin.cmdi.vlo.service.FacetFieldsService; 21 21 import eu.clarin.cmdi.vlo.service.SearchResultsDao; 22 import eu.clarin.cmdi.vlo.service.SolrDocumentService; 22 23 import eu.clarin.cmdi.vlo.service.SolrQueryFactory; 23 24 import eu.clarin.cmdi.vlo.service.impl.SearchResultsDaoImpl; 25 import eu.clarin.cmdi.vlo.service.impl.SolrDocumentServiceImpl; 24 26 import eu.clarin.cmdi.vlo.service.impl.SolrFacetFieldsService; 25 27 import eu.clarin.cmdi.vlo.service.impl.SolrQueryFactoryImpl; … … 70 72 return new SolrFacetFieldsService(searchResultsDao(), queryFactory()); 71 73 } 74 75 @Bean 76 public SolrDocumentService documentService() { 77 return new SolrDocumentServiceImpl(searchResultsDao(), queryFactory()); 78 } 72 79 73 80 @Bean -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/service/SearchResultsDao.java
r4501 r4530 29 29 public interface SearchResultsDao { 30 30 31 SolrDocumentList getDoc IdList(SolrQuery query);31 SolrDocumentList getDocuments(SolrQuery query); 32 32 33 33 List<FacetField> getFacets(SolrQuery query); -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/service/SolrQueryFactory.java
r4520 r4530 31 31 32 32 SolrQuery createCountFacetsQuery(); 33 34 SolrQuery createDocumentQuery(QueryFacetsSelection selection, int first, int count); 33 35 34 36 } -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/service/impl/SearchResultsDaoImpl.java
r4527 r4530 38 38 39 39 @Override 40 public SolrDocumentList getDocIdList(SolrQuery query) { 41 query = query.getCopy(); 42 setDefaultSortField(query); 43 query.setFields(FacetConstants.FIELD_ID); 44 query.setFacet(false); 45 query.setStart(0); 46 query.setRows(Integer.MAX_VALUE); 40 public SolrDocumentList getDocuments(SolrQuery query) { 47 41 QueryResponse queryResponse = fireQuery(query); 48 return queryResponse.getResults(); 42 final SolrDocumentList documents = queryResponse.getResults(); 43 logger.debug("Found {} documents", documents.getNumFound()); 44 return documents; 49 45 } 50 46 -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/service/impl/SolrQueryFactoryImpl.java
r4520 r4530 51 51 public SolrQuery createFacetQuery(QueryFacetsSelection queryFacetsSelections) { 52 52 final SolrQuery query = getDefaultFacetQuery(); 53 addQueryFacetParameters(query, queryFacetsSelections); 54 return query; 55 } 56 57 @Override 58 public SolrQuery createDocumentQuery(QueryFacetsSelection selection, int first, int count) { 59 final SolrQuery query = getDefaultDocumentQuery(); 60 addQueryFacetParameters(query, selection); 61 query.setStart(first); 62 query.setRows(count); 63 return query; 64 } 65 66 protected void addQueryFacetParameters(final SolrQuery query, QueryFacetsSelection queryFacetsSelections) { 53 67 final String queryString = queryFacetsSelections.getQuery(); 54 68 … … 72 86 } 73 87 query.setFilterQueries(encodedQueries.toArray(new String[encodedQueries.size()])); 74 return query;75 88 } 76 89 … … 86 99 } 87 100 101 private SolrQuery getDefaultDocumentQuery() { 102 SolrQuery result = new SolrQuery(); 103 result.setFields(FacetConstants.FIELD_NAME, FacetConstants.FIELD_ID, FacetConstants.FIELD_DESCRIPTION, FacetConstants.FIELD_COLLECTION, FacetConstants.FIELD_RESOURCE); 104 return result; 105 } 106 88 107 @Override 89 108 public synchronized SolrQuery createCountFacetsQuery() { -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/SearchResultsPanel.html
r4515 r4530 24 24 <body> 25 25 <wicket:panel> 26 <div class="sidebaritem"> 27 <!-- rounded corners - top **** --> 28 <div class="rtop"><div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div></div> 29 <h1>Narrow down</h1> 30 <p> 31 Use the categories below to limit the search results to those matching the selected value(s). 32 </p> 33 <wicket:container wicket:id="facets"> 34 <div wicket:id="facet">[facet]</div> 35 </wicket:container> 36 <!-- rounded corners - bottom **** --> 37 <div class="rbottom"><div class="r4"></div><div class="r3"></div><div class="r2"></div><div class="r1"></div></div> 26 <h1>Search results</h1> 27 <div id="searchresultsheader"> 28 <span wicket:id="resultCount" id="searchresultcount">604056 results</span> 29 <span id="searchresultpagecount">Showing 1 to 25</span> 30 31 <div class="searchresultpagination"> 32 << 33 < 34 1 35 <a href="">2</a> 36 <a href="">3</a> 37 <a href="">4</a> 38 <a href="">5</a> 39 <a href="">6</a> 40 <a href="">7</a> 41 <a href="">8</a> 42 <a href="">9</a> 43 <a href="">10</a> 44 <a href="">></a> 45 <a href="">>></a> 46 </div> 47 48 </div> 49 50 <ul id="searchresultitems"> 51 <li wicket:id="resultItem" class="searchresultitem"> 52 <h2> 53 <a wicket:id="title" href="record1.html">[TITLE]</a> 54 </h2> 55 <div class="searchresultitembrief"> 56 <p class="searchresultmoreless"> 57 <a href="#" class="searchresultdetailstoggle">expand</a> 58 </p> 59 <p class="searchresultdescription" wicket:id="description"> 60 [DESCRIPTION] 61 </p> 62 <p class="searchresultresources"> 63 Resources: <a href="record1.html">1 text file</a>, <a href="record1.html">1 audio file</a>, <a href="record1.html">1 annotation file</a> 64 </p> 65 </div> 66 67 <div class="searchresultitemextended"> 68 <p class="searchresultmoreless"> 69 <a href="#" class="searchresultdetailstoggle">collapse</a> 70 </p> 71 <p class="searchresultdescription"> 72 In China (and specifically in Beijing) of the late seventies, the call for a democracy movement was growing ever stronger, before finally being silenced by the new regime under Deng Xiaoping. This paper exmaines both the historical sources and the eventual outcome of this movement during the anxious years of '78-'79. 73 </p> 74 <div class="searchresultattributes"> 75 <table class="recorddetailstable"> 76 <tbody class="attributesTbody"> 77 <tr> 78 <td class="attribute"> 79 <div>Collection</div> 80 </td><td class="attributeValue"> 81 <div>UBU Clarin Set<a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div> 82 </td> 83 </tr> 84 <tr> 85 <td class="attribute"> 86 <div>Genre</div> 87 </td><td class="attributeValue"> 88 <div>info:eu-repo/semantics/bachelorthesis <a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div> 89 </td> 90 </tr><tr> 91 <td class="attribute"> 92 <div>Languages</div> 93 </td><td class="attributeValue"> 94 <div>Dutch <a class="recordattributeinfo" href="http://infra.clarin.eu/service/language/info.php?code=nld"><span>[info]</span></a> <a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div> 95 </td> 96 </tr><tr> 97 <td class="attribute"> 98 <div>National project</div> 99 </td><td class="attributeValue"> 100 <div>CLARIN-NL <a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div> 101 </td> 102 </tr><tr> 103 <td class="attribute"> 104 <div>Resource type</div> 105 </td><td class="attributeValue"> 106 <div>text <a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div> 107 </td> 108 </tr> 109 </tbody> 110 </table> 111 112 <h3>Resources</h3> 113 <ul> 114 <li class="writtenresource"><a href="">http://dspace.library.uu.nl/bitstream/1874/235456/1/Bachelorscriptie+Rene+Witteveen+3375005.docx</a></li> 115 <li class="audioresource"><a href="">http://corpus1.mpi.nl/qfs1/media-archive/dobes_data/Ache/Documentaci_n_-_Documentation/Comunidades_-_Communities/Cerro_Moroti/Media/002-djawu_klluu-2011-09-01.wav</a></li> 116 <li class="annotationresource"><a href="">http://corpus1.mpi.nl/qfs1/media-archive/dobes_data/Ache/Documentaci_n_-_Documentation/Comunidades_-_Communities/Cerro_Moroti/Annotations/002-djawu_klluu-2011-09-01.eaf</a></li> 117 </ul> 118 </div> 119 120 <p class="searchresultfullrecord"> 121 <a href="record1.html">View full record</a> 122 </p> 123 </div> 124 <div class="searchresultitemend"></div> 125 </li> 126 </ul> 127 <div id="searchresultpagination"> 128 << 129 < 130 1 131 <a href="">2</a> 132 <a href="">3</a> 133 <a href="">4</a> 134 <a href="">5</a> 135 <a href="">6</a> 136 <a href="">7</a> 137 <a href="">8</a> 138 <a href="">9</a> 139 <a href="">10</a> 140 <a href="">></a> 141 <a href="">>></a> 142 143 <form id="resultpagesizeform"> 144 <label for="resultpagesize">Results per page:</label> 145 <select id="resultpagesize"> 146 <option>5</option> 147 <option>10</option> 148 <option selected="selected">25</option> 149 <option>50</option> 150 <option>100</option> 151 </select> 152 </form> 38 153 </div> 39 154 </wicket:panel> -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/FacetedSearchPage.html
r4528 r4530 103 103 </p> 104 104 </form> 105 <div id="searchresults"> 106 <h1>Search results</h1> 107 <div id="searchresultsheader"> 108 <span id="searchresultcount">604056 results</span> 109 <span id="searchresultpagecount">Showing 1 to 25</span> 110 111 <div class="searchresultpagination"> 112 << 113 < 114 1 115 <a href="">2</a> 116 <a href="">3</a> 117 <a href="">4</a> 118 <a href="">5</a> 119 <a href="">6</a> 120 <a href="">7</a> 121 <a href="">8</a> 122 <a href="">9</a> 123 <a href="">10</a> 124 <a href="">></a> 125 <a href="">>></a> 126 </div> 127 128 </div> 129 130 <ul id="searchresultitems"> 131 <li class="searchresultitem"> 132 <h2> 133 <a href="record1.html">"Chinese Democratie en de Transformatie"</a> 134 </h2> 135 <div class="searchresultitembrief"> 136 <p class="searchresultmoreless"> 137 <a href="#" class="searchresultdetailstoggle">expand</a> 138 </p> 139 <p class="searchresultdescription"> 140 In China (and specifically in Beijing) of the late seventies, the call for a democracy movement was growing ever stronger, before finally being silenced by the new regime under Deng Xiaoping... 141 </p> 142 <p class="searchresultresources"> 143 Resources: <a href="record1.html">1 text file</a>, <a href="record1.html">1 audio file</a>, <a href="record1.html">1 annotation file</a> 144 </p> 145 </div> 146 147 <div class="searchresultitemextended"> 148 <p class="searchresultmoreless"> 149 <a href="#" class="searchresultdetailstoggle">collapse</a> 150 </p> 151 <p class="searchresultdescription"> 152 In China (and specifically in Beijing) of the late seventies, the call for a democracy movement was growing ever stronger, before finally being silenced by the new regime under Deng Xiaoping. This paper exmaines both the historical sources and the eventual outcome of this movement during the anxious years of '78-'79. 153 </p> 154 <div class="searchresultattributes"> 155 <table class="recorddetailstable"> 156 <tbody class="attributesTbody"> 157 <tr> 158 <td class="attribute"> 159 <div>Collection</div> 160 </td><td class="attributeValue"> 161 <div>UBU Clarin Set<a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div> 162 </td> 163 </tr> 164 <tr> 165 <td class="attribute"> 166 <div>Genre</div> 167 </td><td class="attributeValue"> 168 <div>info:eu-repo/semantics/bachelorthesis <a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div> 169 </td> 170 </tr><tr> 171 <td class="attribute"> 172 <div>Languages</div> 173 </td><td class="attributeValue"> 174 <div>Dutch <a class="recordattributeinfo" href="http://infra.clarin.eu/service/language/info.php?code=nld"><span>[info]</span></a> <a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div> 175 </td> 176 </tr><tr> 177 <td class="attribute"> 178 <div>National project</div> 179 </td><td class="attributeValue"> 180 <div>CLARIN-NL <a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div> 181 </td> 182 </tr><tr> 183 <td class="attribute"> 184 <div>Resource type</div> 185 </td><td class="attributeValue"> 186 <div>text <a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div> 187 </td> 188 </tr> 189 </tbody> 190 </table> 191 192 <h3>Resources</h3> 193 <ul> 194 <li class="writtenresource"><a href="">http://dspace.library.uu.nl/bitstream/1874/235456/1/Bachelorscriptie+Rene+Witteveen+3375005.docx</a></li> 195 <li class="audioresource"><a href="">http://corpus1.mpi.nl/qfs1/media-archive/dobes_data/Ache/Documentaci_n_-_Documentation/Comunidades_-_Communities/Cerro_Moroti/Media/002-djawu_klluu-2011-09-01.wav</a></li> 196 <li class="annotationresource"><a href="">http://corpus1.mpi.nl/qfs1/media-archive/dobes_data/Ache/Documentaci_n_-_Documentation/Comunidades_-_Communities/Cerro_Moroti/Annotations/002-djawu_klluu-2011-09-01.eaf</a></li> 197 </ul> 198 </div> 199 200 <p class="searchresultfullrecord"> 201 <a href="record1.html">View full record</a> 202 </p> 203 </div> 204 <div class="searchresultitemend"></div> 205 </li> 206 <li class="searchresultitem"> 207 <h2> 208 <a href="record1.html">"Zichzelf zien"': het dubbelgangermotief in E.T.A. Hoffmanns Prinzessin Brambilla. ein Capriccio nach Jacob Callot. Een Lacaniaanse analyse</a> 209 </h2> 210 <p class="searchresultmoreless"> 211 <a href="#" class="searchresultdetailstoggle">expand</a> 212 </p> 213 <p class="searchresultdescription"> 214 Mogelijke implicaties van het 'zichzelf zien'(zoals de vroege romanticus Jean Paul Richter het dubbelgangermotief benoemde), werkte E.T.A. Hoffmann uit in de experimentele tekst PRINZESSIN BRAMBILLA. Daarin verbindt de auteur... 215 </p> 216 <p class="searchresultresources"> 217 Resources: <a href="record1.html">1 text file</a>, <a href="record1.html">1 audio file</a> 218 </p> 219 <div class="searchresultitemend"></div> 220 </li> 221 <li class="searchresultitem"> 222 <h2> 223 <a href="record1.html">2007 Festival</a> 224 </h2> 225 <p class="searchresultmoreless"><a href="#" class="searchresultdetailstoggle">expand</a></p> 226 <p class="searchresultdescription"> 227 Video documentation of the "festival of folk songs and dances". One file consisting of the three original tapes concatenated. 228 </p> 229 <p class="searchresultresources"> 230 Resources: <a href="record1.html">1 text file</a>, <a href="record1.html">1 audio file</a> 231 </p> 232 <div class="searchresultitemend"></div> 233 </li> 234 <li class="searchresultitem"> 235 <h2> 236 <a href="record1.html">...DE LEUGEN REGEERT...</a> 237 </h2> 238 <p class="searchresultmoreless"><a href="#" class="searchresultdetailstoggle">expand</a></p> 239 <p class="searchresultdescription"> 240 Presentatie: Felix Meurders. Hij wordt bijgestaan door een Mediaraad, die gedurende het programma commentaar levert op de onderwerpen. Vaste onderdelen: deleugenregeert.nl en een media-analyse door Francisco van Jole. Serie... 241 </p> 242 <p class="searchresultresources"> 243 Resources: <a href="record1.html">1 annotation file</a>, <a href="record1.html">1 audio file</a> 244 </p> 245 <div class="searchresultitemend"></div> 246 </li> 247 </ul> 248 <div id="searchresultpagination"> 249 << 250 < 251 1 252 <a href="">2</a> 253 <a href="">3</a> 254 <a href="">4</a> 255 <a href="">5</a> 256 <a href="">6</a> 257 <a href="">7</a> 258 <a href="">8</a> 259 <a href="">9</a> 260 <a href="">10</a> 261 <a href="">></a> 262 <a href="">>></a> 263 264 <form id="resultpagesizeform"> 265 <label for="resultpagesize">Results per page:</label> 266 <select id="resultpagesize"> 267 <option>5</option> 268 <option>10</option> 269 <option selected="selected">25</option> 270 <option>50</option> 271 <option>100</option> 272 </select> 273 </form> 274 </div> 275 </div> 105 <div wicket:id="searchResults" id="searchresults">[SEARCH RESULTS]</div> 276 106 </div> 277 107 278 108 <div class="sidebar"> 279 109 280 110 <div wicket:id="facets"></div> 281 111 282 112 <div class="sidebaritem facet collapsedfacet"> 283 113 <!-- rounded corners - top **** --> -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/FacetedSearchPage.java
r4528 r4530 4 4 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection; 5 5 import eu.clarin.cmdi.vlo.wicket.components.SearchForm; 6 import eu.clarin.cmdi.vlo.wicket.components.SearchResultsPanel; 6 7 import java.util.Collection; 7 8 import java.util.Collections; … … 35 36 36 37 add(new SearchForm("search", queryModel)); 38 39 add(new SearchResultsPanel("searchResults", queryModel)); 37 40 } 38 41 } -
vlo/branches/vlo-3.0/vlo-web-app/src/test/java/eu/clarin/cmdi/vlo/wicket/pages/TestFacetedSearchPage.java
r4519 r4530 6 6 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection; 7 7 import eu.clarin.cmdi.vlo.service.FacetFieldsService; 8 import eu.clarin.cmdi.vlo.service.SolrDocumentService; 8 9 import java.util.Arrays; 9 10 import java.util.List; 10 11 import org.apache.solr.client.solrj.response.FacetField; 12 import org.apache.solr.common.SolrDocument; 11 13 import org.apache.wicket.util.tester.WicketTester; 12 14 import org.jmock.Expectations; … … 50 52 } 51 53 54 @Override 55 public SolrDocumentService documentService() { 56 return mockery().mock(SolrDocumentService.class); 57 } 52 58 } 53 59 … … 59 65 @Autowired 60 66 private FacetFieldsService facetFieldsService; 67 @Autowired 68 private SolrDocumentService documentService; 61 69 62 70 @Before … … 70 78 mockery.checking(new Expectations() { 71 79 { 80 // mock facets 72 81 atLeast(1).of(facetFieldsService).getFacetFieldCount(); 73 82 will(returnValue(2L)); 74 83 oneOf(facetFieldsService).getFacetFields(with(any(QueryFacetsSelection.class))); 75 84 will(returnValue(Arrays.asList(new FacetField("language"), new FacetField("resource class")))); 85 86 // mock search results 87 atLeast(1).of(documentService).getDocumentCount(with(any(QueryFacetsSelection.class))); 88 will(returnValue(1000L)); 89 oneOf(documentService).getDocuments(with(any(QueryFacetsSelection.class)), with(equal(0)), with(equal(10))); 90 will(returnValue(Arrays.asList(new SolrDocument(), new SolrDocument()))); 76 91 } 77 92 });
Note: See TracChangeset
for help on using the changeset viewer.