Author: ssmiweve
Date: 2008-10-28 16:41:22 +0100 (Tue, 28 Oct 2008)
New Revision: 6897

Modified:
   trunk/generic.sesam/war/src/main/conf/modes.xml
   trunk/generic.sesam/war/src/main/conf/views.xml
   
trunk/generic.sesam/war/src/webapp/WEB-INF/classes/fragments/layout/generic.sesam/solrSuggestions.jsp
Log:
SEARCH-4933
 1) Result handlers to strip away as(a) suffixes, and to remove duplicates 
(every entry with an " AS" ending has a duplicate without it)
 2) Introduce a ResultPagingNavigationConfig to limit the number of results 
returned since the command must fetch double up in case of duplicates. Also 
adjust the jsp to use the NavigationConfig.


Modified: trunk/generic.sesam/war/src/main/conf/modes.xml
===================================================================
--- trunk/generic.sesam/war/src/main/conf/modes.xml     2008-10-28 15:37:14 UTC 
(rev 6896)
+++ trunk/generic.sesam/war/src/main/conf/modes.xml     2008-10-28 15:41:22 UTC 
(rev 6897)
@@ -287,6 +287,14 @@
                 <!-- Suffix the query with a wildcard. Otherwise it wouldn't 
be a suggestion ;-) -->
                 <regexp regexp="$" replacement="*"/>
             </query-transformers>
+            <result-handlers>
+                <!-- remove norwegian company suffixes. this is just an 
example - adjust for your own country -->
+                <!-- the original field must be kept to avoid the 
discard-duplicates removing both in the next step -->
+                <field-chooser fields="list_entry" 
target="list_entry_original"/>
+                <regexp field="list_entry" regexp="(.*) asa?$" 
target="list_entry"/>
+                <!-- avoid duplicate results -->
+                <discard-duplicates field="list_entry"/>
+            </result-handlers>
         </solr-command>
     </mode>
 

Modified: trunk/generic.sesam/war/src/main/conf/views.xml
===================================================================
--- trunk/generic.sesam/war/src/main/conf/views.xml     2008-10-28 15:37:14 UTC 
(rev 6896)
+++ trunk/generic.sesam/war/src/main/conf/views.xml     2008-10-28 15:41:22 UTC 
(rev 6897)
@@ -48,5 +48,10 @@
 
     <tab id="solrSuggestions" key="suggest" mode="solrSuggestions">
         <layout main="/fragments/layout/generic.sesam/solrSuggestions.jsp" 
content-type="text/plain"/>
+        <navigation>
+            <navigation id="offset">
+              <result-paging id="offset" command-name="solrSuggestions" 
page-size="99" number-of-pages="1" hitcount-source="totalhits"/>
+            </navigation>
+        </navigation> 
     </tab>
 </views>

Modified: 
trunk/generic.sesam/war/src/webapp/WEB-INF/classes/fragments/layout/generic.sesam/solrSuggestions.jsp
===================================================================
--- 
trunk/generic.sesam/war/src/webapp/WEB-INF/classes/fragments/layout/generic.sesam/solrSuggestions.jsp
       2008-10-28 15:37:14 UTC (rev 6896)
+++ 
trunk/generic.sesam/war/src/webapp/WEB-INF/classes/fragments/layout/generic.sesam/solrSuggestions.jsp
       2008-10-28 15:41:22 UTC (rev 6897)
@@ -24,11 +24,16 @@
      * See generic.sesam/war/src/main/javascript/external/mwsuggest.js
      * Simple way of manually writing out the json array. Alternative would be 
to use json-taglib.
     -->
+    <c:if test="${!empty 
DataModel.navigation.configuration.navigationMap.offset and !empty 
DataModel.navigation.configuration.navigationMap.offset.navMap.offset}">
+        <c:set var="pageSize" 
value="${DataModel.navigation.configuration.navigationMap.offset.navMap.offset.pageSize}"/>
+    </c:if>
     <jsp:text><![CDATA[[]]>"</jsp:text><c:out 
value="${DataModel.query.utf8UrlEncoded}"/><jsp:text>",</jsp:text>
     <jsp:text><![CDATA[[]]></jsp:text>
     <c:forEach var="item" varStatus="i" 
items="${DataModel.searches['solrSuggestions'].results.results}">
-        <jsp:text>"</jsp:text><c:out 
value="${item.fields.list_entry}"/><jsp:text>"</jsp:text>
-        <c:if test="${! i.last}"><jsp:text>,</jsp:text></c:if>
+        <c:if test="${empty pageSize or i.count le pageSize}">
+            <jsp:text>"</jsp:text><c:out 
value="${item.fields.list_entry}"/><jsp:text>"</jsp:text>
+            <c:if test="${(empty pageSize and !i.last) or (!empty pageSize and 
i.count lt pageSize)}"><jsp:text>,</jsp:text></c:if>
+        </c:if>
     </c:forEach>
     <jsp:text><![CDATA[]]]]></jsp:text>
 </jsp:root>
\ No newline at end of file

_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits

Reply via email to