Author: ssmalamb
Date: 2007-07-02 13:01:08 +0200 (Mon, 02 Jul 2007)
New Revision: 5478

Modified:
   
branches/2.14/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/VideoSearchCommand.java
Log:
Swedish first on language navigator

Modified: 
branches/2.14/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/VideoSearchCommand.java
===================================================================
--- 
branches/2.14/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/VideoSearchCommand.java
      2007-07-02 10:55:59 UTC (rev 5477)
+++ 
branches/2.14/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/VideoSearchCommand.java
      2007-07-02 11:01:08 UTC (rev 5478)
@@ -79,7 +79,7 @@
         }
         final String sortByString = this.getParameters().get("userSortBy") != 
null ? (String) this.getParameters().get("userSortBy") : "mix";
         final String videoSource = this.getParameters().get("videoSource") != 
null ? (String) this.getParameters().get("videoSource") : "";
-        final String videoLanguage = this.getParameters().get("videoLanguage") 
!= null ? (String) 
this.getParameters().get("videoLanguage").toString().toLowerCase() : "";
+        final String videoLanguage = this.getParameters().get("videoLanguage") 
!= null ? (String) this.getParameters().get("videoLanguage") : "";
 //        String biasDate = sortByString.equals("standard") ? "100" : "0"; // 
default is normally datetime which is 0
 
         String biasDate = "50"; // mix
@@ -223,12 +223,18 @@
         TreeMap<String, String> videoLanguage = new TreeMap<String, String>();
         Node channelSibling = nextSibling.getFirstChild();
         while(channelSibling != null ) {
-            
videoLanguage.put(channelSibling.getAttributes().getNamedItem("name").getTextContent(),channelSibling.getTextContent());
+            
videoLanguage.put(channelSibling.getAttributes().getNamedItem("name").getTextContent().toLowerCase(),channelSibling.getTextContent());
             channelSibling = channelSibling.getNextSibling();
         }
 //      TreeSet<Map.Entry> set = new TreeSet<Map.Entry>();
       TreeSet<Map.Entry> set = new TreeSet<Map.Entry>(new 
Comparator<Map.Entry>() {
             public int compare(Map.Entry a, Map.Entry b) { // Sort descending 
by hits, ascending by case insensitive channel name if number of hits is equal
+                // Always swedish first.... change this to a property?
+                if (a.getKey().equals("swedish")) {
+                    return -1;
+                } else if (b.getKey().equals("swedish")) {
+                    return 1;
+                }
                 int ret = ((Comparable) 
Integer.parseInt((String)((Map.Entry)a).getValue())).compareTo(Integer.parseInt((String)((Map.Entry)b).getValue()))*-1;
                 if (ret == 0) {
                     ret = ((Comparable) 
((Map.Entry)a).getKey()).toString().toLowerCase().compareTo(((Map.Entry)b).getKey().toString().toLowerCase());

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

Reply via email to