Revision: 16785
          http://sourceforge.net/p/gate/code/16785
Author:   valyt
Date:     2013-08-15 12:13:19 +0000 (Thu, 15 Aug 2013)
Log Message:
-----------
Enhancement: 

When combining multiple terms result sets, we used to generate new term strings 
by just producing unique numbers.

We now produce a string that contains the originating term strings, which could 
be more useful.

Modified Paths:
--------------
    mimir/trunk/mimir-core/src/gate/mimir/search/terms/TermsResultSet.java

Modified: mimir/trunk/mimir-core/src/gate/mimir/search/terms/TermsResultSet.java
===================================================================
--- mimir/trunk/mimir-core/src/gate/mimir/search/terms/TermsResultSet.java      
2013-08-14 18:06:48 UTC (rev 16784)
+++ mimir/trunk/mimir-core/src/gate/mimir/search/terms/TermsResultSet.java      
2013-08-15 12:13:19 UTC (rev 16785)
@@ -25,7 +25,11 @@
 import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -288,9 +292,26 @@
       if(descriptionsAvaialble) {
         newDescriptions[pos] = tData.description;
         originalTermStrings[pos] = tData.getStrings();
-        // term string does not actually mean anything; we use the term 
position
-        // instead
-        newStrings[pos] = Integer.toString(pos);
+        // term string does not actually mean anything; 
+        // we use the term position instead
+        // newStrings[pos] = Integer.toString(pos);
+        Set<String> uniq = new HashSet<String>();
+        for(String[] terms : tData.getStrings()) {
+          for(String term : terms) {
+            uniq.add(term);
+          }
+        }
+        if(uniq.isEmpty()) {
+          newStrings[pos] = Integer.toString(pos);
+        } else {
+          List<String> termList= new ArrayList<String>(uniq);
+          Collections.sort(termList);
+          StringBuilder strb = new StringBuilder(termList.get(0));
+          for(int i = 1; i < termList.size(); i++) {
+            strb.append(" | ").append(termList.get(i));
+          }
+          newStrings[pos] = strb.toString();          
+        }
       } else {
         newStrings[pos] = tData.description;
       }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to