From 42aaf72f62d7e52f3eecfd98eaf5ed5cc648d463 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Wed, 18 Jun 2014 17:21:10 +0000 Subject: [PATCH] LUCENE-5775: deprecate JaspellLookup git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1603542 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/CHANGES.txt | 2 ++ .../lucene/search/suggest/jaspell/JaspellLookup.java | 2 ++ .../search/suggest/jaspell/JaspellTernarySearchTrie.java | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 0398c73b8e9..2807bc065c7 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -233,6 +233,8 @@ API Changes * LUCENE-5761: Removed DiskDocValuesFormat, it was very inefficient and saved very little RAM over the default codec. (Robert Muir) +* LUCENE-5775: Deprecate JaspellLookup. (Mike McCandless) + Optimizations * LUCENE-5603: hunspell stemmer more efficiently strips prefixes diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java index 8757d70f7d2..07702c86703 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java @@ -37,7 +37,9 @@ import org.apache.lucene.util.UnicodeUtil; * JaSpell. * * @see JaspellTernarySearchTrie + * @deprecated Migrate to one of the newer suggesters which are much more RAM efficient. */ +@Deprecated public class JaspellLookup extends Lookup implements Accountable { JaspellTernarySearchTrie trie = new JaspellTernarySearchTrie(); private boolean usePrefix = true; diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java index 41ea3f1454c..728fe12344f 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java @@ -62,7 +62,10 @@ import org.apache.lucene.util.RamUsageEstimator; * Algorithms, January 1997). Algorithms in C, Third Edition, by Robert * Sedgewick (Addison-Wesley, 1998) provides yet another view of ternary search * trees. + * + * @deprecated Migrate to one of the newer suggesters which are much more RAM efficient. */ +@Deprecated public class JaspellTernarySearchTrie implements Accountable { /** @@ -98,7 +101,9 @@ public class JaspellTernarySearchTrie implements Accountable { @Override public long ramBytesUsed() { long mem = RamUsageEstimator.shallowSizeOf(this) + RamUsageEstimator.shallowSizeOf(relatives); - for (TSTNode node : relatives) { + // We don't need to add parent since our parent added itself: + for (int i=1;i<4;i++) { + TSTNode node = relatives[i]; if (node != null) { mem += node.ramBytesUsed(); }