Author: j16sdiz
Date: 2008-12-20 04:03:46 +0000 (Sat, 20 Dec 2008)
New Revision: 24652

Modified:
   trunk/plugins/XMLLibrarian/XMLLibrarian.java
Log:
fix searching word length < 3 (they are not yet indexed)

Modified: trunk/plugins/XMLLibrarian/XMLLibrarian.java
===================================================================
--- trunk/plugins/XMLLibrarian/XMLLibrarian.java        2008-12-19 22:20:00 UTC 
(rev 24651)
+++ trunk/plugins/XMLLibrarian/XMLLibrarian.java        2008-12-20 04:03:46 UTC 
(rev 24652)
@@ -573,21 +573,26 @@
                        DEFAULT_INDEX_SITE = indexuri;
                        String[] searchWords = search.split("[^\\p{L}\\{N}]+");
                        // Return results in order.
-                       LinkedHashSet<URIWrapper> hs = new 
LinkedHashSet<URIWrapper>();
+                       LinkedHashSet<URIWrapper> hs;
                        /*
                         * search for each string in the search list
                         * only the common results to all words are returned as 
final result 
                         * 
                        */
                        try{
-                               for(int i = 0;i<searchWords.length;i++){
-                                       searchWord = searchWords[i];
+                               for(String searchWord : searchWords[i]) {
+                                       if (searchWord.length() < 3)
+                                               continue;               // 
xmlspider don't include words length < 3, have to fix this
+
                                        Vector<URIWrapper> keyuris = 
getIndex(searchWords[i]);
-                                       if (i == 0)
-                                               hs.addAll(keyuris);
+                                       if (hs == null)
+                                               hs = new 
LinkedHashSet<URIWrapper>(keyuris);
                                        else
                                                hs.retainAll(keyuris);
                                }
+
+                               if (hs == null)
+                                       hs = new LinkedHashSet<URIWrapper>();
                        } catch (FetchException e) {
                                FreenetURI uri = getSubIndex(searchWord);
                                String href = "";

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to