Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

reuturn only recommendations of words that have a greater count than the original word

orbiterd64569aa3958
diff --git a/source/de/anomic/data/DidYouMean.java b/source/de/anomic/data/DidYouMean.java
index 6af10d432..a0a2d6584 100644
--- a/source/de/anomic/data/DidYouMean.java
+++ b/source/de/anomic/data/DidYouMean.java
@@ -95,10 +95,13 @@ public class DidYouMean {
long timelimit = 2 * System.currentTimeMillis() - startTime + timeout;
if (System.currentTimeMillis() > timelimit) return preSorted;
Set<String> countSorted = Collections.synchronizedSortedSet(new TreeSet<String>(new indexSizeComparator()));
+ int wc = index.count(Word.word2hash(word)); // all counts must be greater than this
+ int c0;
for (String s: preSorted) {
if (System.currentTimeMillis() > timelimit) break;
if (preSortSelection <= 0) break;
- countSorted.add(s);
+ c0 = index.count(Word.word2hash(s));
+ if (c0 > wc) countSorted.add(s);
preSortSelection--;
}
return countSorted;