lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [10/11] lucenenet git commit: Lucene.Net.TestFramework.Index.BasePostingsFormatTestCase + Lucene.Net.Suggest.Analyzing (AnalyzingInfixSuggesterTest + TestFreeTextSuggester) + Lucene.Net.Tests.Index.TestCodecs: Added using blocks to make the tests run mor
Date Fri, 22 Sep 2017 05:55:33 GMT
Lucene.Net.TestFramework.Index.BasePostingsFormatTestCase + Lucene.Net.Suggest.Analyzing (AnalyzingInfixSuggesterTest + TestFreeTextSuggester) + Lucene.Net.Tests.Index.TestCodecs: Added using blocks to make the tests run more reliably.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/302a51e6
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/302a51e6
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/302a51e6

Branch: refs/heads/master
Commit: 302a51e66ee3ebafd977fa2277bed790ef33756b
Parents: 063f384
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Fri Sep 22 01:17:01 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Fri Sep 22 12:45:44 2017 +0700

----------------------------------------------------------------------
 .../Index/BasePostingsFormatTestCase.cs         |  125 +-
 .../Analyzing/AnalyzingInfixSuggesterTest.cs    | 1095 +++++++++---------
 .../Suggest/Analyzing/TestFreeTextSuggester.cs  |   16 +-
 src/Lucene.Net.Tests/Index/TestCodecs.cs        |  250 ++--
 4 files changed, 769 insertions(+), 717 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/302a51e6/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
index c8b9c16..12d4f1e 100644
--- a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
@@ -555,94 +555,97 @@ namespace Lucene.Net.Index
             long bytes = TotalPostings * 8 + TotalPayloadBytes;
 
             SegmentWriteState writeState = new SegmentWriteState(null, dir, segmentInfo, newFieldInfos, 32, null, new IOContext(new FlushInfo(MaxDoc, bytes)));
-            FieldsConsumer fieldsConsumer = codec.PostingsFormat.FieldsConsumer(writeState);
 
-            foreach (KeyValuePair<string, SortedDictionary<BytesRef, long>> fieldEnt in Fields)
+            // LUCENENET specific - BUG: we must wrap this in a using block in case anything in the below loop throws
+            using (FieldsConsumer fieldsConsumer = codec.PostingsFormat.FieldsConsumer(writeState))
             {
-                string field = fieldEnt.Key;
-                IDictionary<BytesRef, long> terms = fieldEnt.Value;
-
-                FieldInfo fieldInfo = newFieldInfos.FieldInfo(field);
-
-                IndexOptions indexOptions = fieldInfo.IndexOptions;
 
-                if (VERBOSE)
+                foreach (KeyValuePair<string, SortedDictionary<BytesRef, long>> fieldEnt in Fields)
                 {
-                    Console.WriteLine("field=" + field + " indexOtions=" + indexOptions);
-                }
+                    string field = fieldEnt.Key;
+                    IDictionary<BytesRef, long> terms = fieldEnt.Value;
 
-                bool doFreq = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
-                bool doPos = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
-                bool doPayloads = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 && allowPayloads;
-                bool doOffsets = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
+                    FieldInfo fieldInfo = newFieldInfos.FieldInfo(field);
+
+                    IndexOptions indexOptions = fieldInfo.IndexOptions;
 
-                TermsConsumer termsConsumer = fieldsConsumer.AddField(fieldInfo);
-                long sumTotalTF = 0;
-                long sumDF = 0;
-                FixedBitSet seenDocs = new FixedBitSet(MaxDoc);
-                foreach (KeyValuePair<BytesRef, long> termEnt in terms)
-                {
-                    BytesRef term = termEnt.Key;
-                    SeedPostings postings = GetSeedPostings(term.Utf8ToString(), termEnt.Value, false, maxAllowed);
                     if (VERBOSE)
                     {
-                        Console.WriteLine("  term=" + field + ":" + term.Utf8ToString() + " docFreq=" + postings.DocFreq + " seed=" + termEnt.Value);
+                        Console.WriteLine("field=" + field + " indexOtions=" + indexOptions);
                     }
 
-                    PostingsConsumer postingsConsumer = termsConsumer.StartTerm(term);
-                    long totalTF = 0;
-                    int docID = 0;
-                    while ((docID = postings.NextDoc()) != DocsEnum.NO_MORE_DOCS)
+                    bool doFreq = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
+                    bool doPos = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
+                    bool doPayloads = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 && allowPayloads;
+                    bool doOffsets = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
+
+                    TermsConsumer termsConsumer = fieldsConsumer.AddField(fieldInfo);
+                    long sumTotalTF = 0;
+                    long sumDF = 0;
+                    FixedBitSet seenDocs = new FixedBitSet(MaxDoc);
+                    foreach (KeyValuePair<BytesRef, long> termEnt in terms)
                     {
-                        int freq = postings.Freq;
+                        BytesRef term = termEnt.Key;
+                        SeedPostings postings = GetSeedPostings(term.Utf8ToString(), termEnt.Value, false, maxAllowed);
                         if (VERBOSE)
                         {
-                            Console.WriteLine("    " + postings.Upto + ": docID=" + docID + " freq=" + postings.Freq_Renamed);
+                            Console.WriteLine("  term=" + field + ":" + term.Utf8ToString() + " docFreq=" + postings.DocFreq + " seed=" + termEnt.Value);
                         }
-                        postingsConsumer.StartDoc(docID, doFreq ? postings.Freq_Renamed : -1);
-                        seenDocs.Set(docID);
-                        if (doPos)
+
+                        PostingsConsumer postingsConsumer = termsConsumer.StartTerm(term);
+                        long totalTF = 0;
+                        int docID = 0;
+                        while ((docID = postings.NextDoc()) != DocsEnum.NO_MORE_DOCS)
                         {
-                            totalTF += postings.Freq_Renamed;
-                            for (int posUpto = 0; posUpto < freq; posUpto++)
+                            int freq = postings.Freq;
+                            if (VERBOSE)
                             {
-                                int pos = postings.NextPosition();
-                                BytesRef payload = postings.GetPayload();
-
-                                if (VERBOSE)
+                                Console.WriteLine("    " + postings.Upto + ": docID=" + docID + " freq=" + postings.Freq_Renamed);
+                            }
+                            postingsConsumer.StartDoc(docID, doFreq ? postings.Freq_Renamed : -1);
+                            seenDocs.Set(docID);
+                            if (doPos)
+                            {
+                                totalTF += postings.Freq_Renamed;
+                                for (int posUpto = 0; posUpto < freq; posUpto++)
                                 {
-                                    if (doPayloads)
-                                    {
-                                        Console.WriteLine("      pos=" + pos + " payload=" + (payload == null ? "null" : payload.Length + " bytes"));
-                                    }
-                                    else
+                                    int pos = postings.NextPosition();
+                                    BytesRef payload = postings.GetPayload();
+
+                                    if (VERBOSE)
                                     {
-                                        Console.WriteLine("      pos=" + pos);
+                                        if (doPayloads)
+                                        {
+                                            Console.WriteLine("      pos=" + pos + " payload=" + (payload == null ? "null" : payload.Length + " bytes"));
+                                        }
+                                        else
+                                        {
+                                            Console.WriteLine("      pos=" + pos);
+                                        }
                                     }
+                                    postingsConsumer.AddPosition(pos, doPayloads ? payload : null, doOffsets ? postings.StartOffset : -1, doOffsets ? postings.EndOffset : -1);
                                 }
-                                postingsConsumer.AddPosition(pos, doPayloads ? payload : null, doOffsets ? postings.StartOffset : -1, doOffsets ? postings.EndOffset : -1);
                             }
+                            else if (doFreq)
+                            {
+                                totalTF += freq;
+                            }
+                            else
+                            {
+                                totalTF++;
+                            }
+                            postingsConsumer.FinishDoc();
                         }
-                        else if (doFreq)
-                        {
-                            totalTF += freq;
-                        }
-                        else
-                        {
-                            totalTF++;
-                        }
-                        postingsConsumer.FinishDoc();
+                        termsConsumer.FinishTerm(term, new TermStats(postings.DocFreq, doFreq ? totalTF : -1));
+                        sumTotalTF += totalTF;
+                        sumDF += postings.DocFreq;
                     }
-                    termsConsumer.FinishTerm(term, new TermStats(postings.DocFreq, doFreq ? totalTF : -1));
-                    sumTotalTF += totalTF;
-                    sumDF += postings.DocFreq;
+
+                    termsConsumer.Finish(doFreq ? sumTotalTF : -1, sumDF, seenDocs.Cardinality());
                 }
 
-                termsConsumer.Finish(doFreq ? sumTotalTF : -1, sumDF, seenDocs.Cardinality());
             }
 
-            fieldsConsumer.Dispose();
-
             if (VERBOSE)
             {
                 Console.WriteLine("TEST: after indexing: files=");

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/302a51e6/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs
index aeaf685..d60fbf2 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs
@@ -49,38 +49,39 @@ namespace Lucene.Net.Search.Suggest.Analyzing
             };
 
             Analyzer a = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false);
-            AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3);
-            suggester.Build(new InputArrayIterator(keys));
-
-            IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
-            assertEquals(2, results.size());
-            assertEquals("a penny saved is a penny <b>ear</b>ned", results[0].Key);
-            assertEquals(10, results[0].Value);
-            assertEquals(new BytesRef("foobaz"), results[0].Payload);
-
-            assertEquals("lend me your <b>ear</b>", results[1].Key);
-            assertEquals(8, results[1].Value);
-            assertEquals(new BytesRef("foobar"), results[1].Payload);
-
-            results = suggester.DoLookup(TestUtil.StringToCharSequence("ear ", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("lend me your <b>ear</b>", results[0].Key);
-            assertEquals(8, results[0].Value);
-            assertEquals(new BytesRef("foobar"), results[0].Payload);
-
-            results = suggester.DoLookup(TestUtil.StringToCharSequence("pen", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("a <b>pen</b>ny saved is a <b>pen</b>ny earned", results[0].Key);
-            assertEquals(10, results[0].Value);
-            assertEquals(new BytesRef("foobaz"), results[0].Payload);
-
-            results = suggester.DoLookup(TestUtil.StringToCharSequence("p", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("a <b>p</b>enny saved is a <b>p</b>enny earned", results[0].Key);
-            assertEquals(10, results[0].Value);
-            assertEquals(new BytesRef("foobaz"), results[0].Payload);
-
-            suggester.Dispose();
+            using (AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3))
+            {
+                suggester.Build(new InputArrayIterator(keys));
+
+                IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
+                assertEquals(2, results.size());
+                assertEquals("a penny saved is a penny <b>ear</b>ned", results[0].Key);
+                assertEquals(10, results[0].Value);
+                assertEquals(new BytesRef("foobaz"), results[0].Payload);
+
+                assertEquals("lend me your <b>ear</b>", results[1].Key);
+                assertEquals(8, results[1].Value);
+                assertEquals(new BytesRef("foobar"), results[1].Payload);
+
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("ear ", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("lend me your <b>ear</b>", results[0].Key);
+                assertEquals(8, results[0].Value);
+                assertEquals(new BytesRef("foobar"), results[0].Payload);
+
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("pen", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("a <b>pen</b>ny saved is a <b>pen</b>ny earned", results[0].Key);
+                assertEquals(10, results[0].Value);
+                assertEquals(new BytesRef("foobaz"), results[0].Payload);
+
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("p", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("a <b>p</b>enny saved is a <b>p</b>enny earned", results[0].Key);
+                assertEquals(10, results[0].Value);
+                assertEquals(new BytesRef("foobaz"), results[0].Payload);
+
+            }
         }
 
         [Test]
@@ -95,18 +96,24 @@ namespace Lucene.Net.Search.Suggest.Analyzing
 
             Analyzer a = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false);
             AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3);
-            suggester.Build(new InputArrayIterator(keys));
-            assertEquals(2, suggester.Count);
-            suggester.Dispose();
-
-            suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3);
-            IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
-            assertEquals(2, results.size());
-            assertEquals("a penny saved is a penny <b>ear</b>ned", results[0].Key);
-            assertEquals(10, results[0].Value);
-            assertEquals(new BytesRef("foobaz"), results[0].Payload);
-            assertEquals(2, suggester.Count);
-            suggester.Dispose();
+            try
+            {
+                suggester.Build(new InputArrayIterator(keys));
+                assertEquals(2, suggester.Count);
+                suggester.Dispose();
+
+                suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3);
+                IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
+                assertEquals(2, results.size());
+                assertEquals("a penny saved is a penny <b>ear</b>ned", results[0].Key);
+                assertEquals(10, results[0].Value);
+                assertEquals(new BytesRef("foobaz"), results[0].Payload);
+                assertEquals(2, suggester.Count);
+            }
+            finally
+            {
+                suggester.Dispose();
+            }
         }
 
         /// <summary>
@@ -207,16 +214,17 @@ namespace Lucene.Net.Search.Suggest.Analyzing
             };
 
             Analyzer a = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false);
-            AnalyzingInfixSuggester suggester = new TestHighlightAnalyzingInfixSuggester(this, a);
+            using (AnalyzingInfixSuggester suggester = new TestHighlightAnalyzingInfixSuggester(this, a))
+            {
 
-            suggester.Build(new InputArrayIterator(keys));
+                suggester.Build(new InputArrayIterator(keys));
 
-            IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("a penny saved is a penny <b>ear</b>ned", ToString((List<LookupHighlightFragment>)results[0].HighlightKey));
-            assertEquals(10, results[0].Value);
-            assertEquals(new BytesRef("foobaz"), results[0].Payload);
-            suggester.Dispose();
+                IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("a penny saved is a penny <b>ear</b>ned", ToString((List<LookupHighlightFragment>)results[0].HighlightKey));
+                assertEquals(10, results[0].Value);
+                assertEquals(new BytesRef("foobaz"), results[0].Payload);
+            }
         }
 
         private string ToString(IEnumerable<LookupHighlightFragment> fragments)
@@ -250,82 +258,89 @@ namespace Lucene.Net.Search.Suggest.Analyzing
             Analyzer a = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false);
             int minPrefixLength = Random().nextInt(10);
             AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixLength);
-            suggester.Build(new InputArrayIterator(keys));
-
-            for (int i = 0; i < 2; i++)
+            try
             {
-                for (int j = 0; j < 2; j++)
-                {
-                    bool doHighlight = j == 0;
+                suggester.Build(new InputArrayIterator(keys));
 
-                    IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, doHighlight);
-                    assertEquals(2, results.size());
-                    if (doHighlight)
-                    {
-                        assertEquals("a penny saved is a penny <b>ear</b>ned", results[0].Key);
-                    }
-                    else
-                    {
-                        assertEquals("a penny saved is a penny earned", results[0].Key);
-                    }
-                    assertEquals(10, results[0].Value);
-                    if (doHighlight)
-                    {
-                        assertEquals("lend me your <b>ear</b>", results[1].Key);
-                    }
-                    else
+                for (int i = 0; i < 2; i++)
+                {
+                    for (int j = 0; j < 2; j++)
                     {
-                        assertEquals("lend me your ear", results[1].Key);
-                    }
-                    assertEquals(new BytesRef("foobaz"), results[0].Payload);
-                    assertEquals(8, results[1].Value);
-                    assertEquals(new BytesRef("foobar"), results[1].Payload);
+                        bool doHighlight = j == 0;
 
-                    results = suggester.DoLookup(TestUtil.StringToCharSequence("ear ", Random()).ToString(), 10, true, doHighlight);
-                    assertEquals(1, results.size());
-                    if (doHighlight)
-                    {
-                        assertEquals("lend me your <b>ear</b>", results[0].Key);
-                    }
-                    else
-                    {
-                        assertEquals("lend me your ear", results[0].Key);
-                    }
-                    assertEquals(8, results[0].Value);
-                    assertEquals(new BytesRef("foobar"), results[0].Payload);
+                        IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, doHighlight);
+                        assertEquals(2, results.size());
+                        if (doHighlight)
+                        {
+                            assertEquals("a penny saved is a penny <b>ear</b>ned", results[0].Key);
+                        }
+                        else
+                        {
+                            assertEquals("a penny saved is a penny earned", results[0].Key);
+                        }
+                        assertEquals(10, results[0].Value);
+                        if (doHighlight)
+                        {
+                            assertEquals("lend me your <b>ear</b>", results[1].Key);
+                        }
+                        else
+                        {
+                            assertEquals("lend me your ear", results[1].Key);
+                        }
+                        assertEquals(new BytesRef("foobaz"), results[0].Payload);
+                        assertEquals(8, results[1].Value);
+                        assertEquals(new BytesRef("foobar"), results[1].Payload);
 
-                    results = suggester.DoLookup(TestUtil.StringToCharSequence("pen", Random()).ToString(), 10, true, doHighlight);
-                    assertEquals(1, results.size());
-                    if (doHighlight)
-                    {
-                        assertEquals("a <b>pen</b>ny saved is a <b>pen</b>ny earned", results[0].Key);
-                    }
-                    else
-                    {
-                        assertEquals("a penny saved is a penny earned", results[0].Key);
-                    }
-                    assertEquals(10, results[0].Value);
-                    assertEquals(new BytesRef("foobaz"), results[0].Payload);
+                        results = suggester.DoLookup(TestUtil.StringToCharSequence("ear ", Random()).ToString(), 10, true, doHighlight);
+                        assertEquals(1, results.size());
+                        if (doHighlight)
+                        {
+                            assertEquals("lend me your <b>ear</b>", results[0].Key);
+                        }
+                        else
+                        {
+                            assertEquals("lend me your ear", results[0].Key);
+                        }
+                        assertEquals(8, results[0].Value);
+                        assertEquals(new BytesRef("foobar"), results[0].Payload);
 
-                    results = suggester.DoLookup(TestUtil.StringToCharSequence("p", Random()).ToString(), 10, true, doHighlight);
-                    assertEquals(1, results.size());
-                    if (doHighlight)
-                    {
-                        assertEquals("a <b>p</b>enny saved is a <b>p</b>enny earned", results[0].Key);
-                    }
-                    else
-                    {
-                        assertEquals("a penny saved is a penny earned", results[0].Key);
+                        results = suggester.DoLookup(TestUtil.StringToCharSequence("pen", Random()).ToString(), 10, true, doHighlight);
+                        assertEquals(1, results.size());
+                        if (doHighlight)
+                        {
+                            assertEquals("a <b>pen</b>ny saved is a <b>pen</b>ny earned", results[0].Key);
+                        }
+                        else
+                        {
+                            assertEquals("a penny saved is a penny earned", results[0].Key);
+                        }
+                        assertEquals(10, results[0].Value);
+                        assertEquals(new BytesRef("foobaz"), results[0].Payload);
+
+                        results = suggester.DoLookup(TestUtil.StringToCharSequence("p", Random()).ToString(), 10, true, doHighlight);
+                        assertEquals(1, results.size());
+                        if (doHighlight)
+                        {
+                            assertEquals("a <b>p</b>enny saved is a <b>p</b>enny earned", results[0].Key);
+                        }
+                        else
+                        {
+                            assertEquals("a penny saved is a penny earned", results[0].Key);
+                        }
+                        assertEquals(10, results[0].Value);
+                        assertEquals(new BytesRef("foobaz"), results[0].Payload);
                     }
-                    assertEquals(10, results[0].Value);
-                    assertEquals(new BytesRef("foobaz"), results[0].Payload);
-                }
 
-                // Make sure things still work after close and reopen:
+                    // Make sure things still work after close and reopen:
+                    suggester.Dispose();
+                    suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixLength);
+                }
+            }
+            finally
+            {
                 suggester.Dispose();
-                suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixLength);
             }
-            suggester.Dispose();
+
         }
 
         [Test]
@@ -336,12 +351,13 @@ namespace Lucene.Net.Search.Suggest.Analyzing
             };
 
             Analyzer a = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false);
-            AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3);
-            suggester.Build(new InputArrayIterator(keys));
-            IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("penn", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("a <b>penn</b>y saved is a <b>penn</b>y earned", results[0].Key);
-            suggester.Dispose();
+            using (AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3))
+            {
+                suggester.Build(new InputArrayIterator(keys));
+                IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("penn", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("a <b>penn</b>y saved is a <b>penn</b>y earned", results[0].Key);
+            }
         }
 
         internal class TestHighlightChangeCaseAnalyzingInfixSuggester : AnalyzingInfixSuggester
@@ -369,22 +385,24 @@ namespace Lucene.Net.Search.Suggest.Analyzing
             };
 
             Analyzer a = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, true);
-            AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3);
-            suggester.Build(new InputArrayIterator(keys));
-            IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("penn", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("a <b>Penn</b>y saved is a <b>penn</b>y earned", results[0].Key);
-            suggester.Dispose();
+            IList<Lookup.LookupResult> results;
+            using (AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3))
+            {
+                suggester.Build(new InputArrayIterator(keys));
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("penn", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("a <b>Penn</b>y saved is a <b>penn</b>y earned", results[0].Key);
+            }
 
             // Try again, but overriding addPrefixMatch to highlight
             // the entire hit:
-            suggester = new TestHighlightChangeCaseAnalyzingInfixSuggester(this, a);
-
-            suggester.Build(new InputArrayIterator(keys));
-            results = suggester.DoLookup(TestUtil.StringToCharSequence("penn", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("a <b>Penny</b> saved is a <b>penny</b> earned", results[0].Key);
-            suggester.Dispose();
+            using (var suggester = new TestHighlightChangeCaseAnalyzingInfixSuggester(this, a))
+            { 
+                suggester.Build(new InputArrayIterator(keys));
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("penn", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("a <b>Penny</b> saved is a <b>penny</b> earned", results[0].Key);
+            }
         }
 
         [Test]
@@ -395,10 +413,11 @@ namespace Lucene.Net.Search.Suggest.Analyzing
             };
 
             Analyzer a = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false);
-            AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3);
-            suggester.Build(new InputArrayIterator(keys));
-            suggester.Dispose();
-            suggester.Dispose();
+            using (AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3))
+            {
+                suggester.Build(new InputArrayIterator(keys));
+                suggester.Dispose();
+            }
         }
 
         internal class TestSuggestStopFilterAnalyzer1 : Analyzer
@@ -444,74 +463,77 @@ namespace Lucene.Net.Search.Suggest.Analyzing
             Analyzer indexAnalyzer = new TestSuggestStopFilterAnalyzer1(this, stopWords);
             Analyzer queryAnalyzer = new TestSuggestStopFilterAnalyzer2(this, stopWords);
 
-            AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), indexAnalyzer, queryAnalyzer, 3);
+            using (AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), indexAnalyzer, queryAnalyzer, 3))
+            {
 
-            Input[] keys = new Input[] {
-                new Input("a bob for apples", 10, new BytesRef("foobaz")),
-            };
+                Input[] keys = new Input[] {
+                    new Input("a bob for apples", 10, new BytesRef("foobaz")),
+                };
 
-            suggester.Build(new InputArrayIterator(keys));
-            IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("a", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("a bob for <b>a</b>pples", results[0].Key);
-            suggester.Dispose();
+                suggester.Build(new InputArrayIterator(keys));
+                IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("a", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("a bob for <b>a</b>pples", results[0].Key);
+            }
         }
 
         [Test]
         public void TestEmptyAtStart()
         {
             Analyzer a = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false);
-            AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3);
-            suggester.Build(new InputArrayIterator(new Input[0]));
-            suggester.Add(new BytesRef("a penny saved is a penny earned"), null, 10, new BytesRef("foobaz"));
-            suggester.Add(new BytesRef("lend me your ear"), null, 8, new BytesRef("foobar"));
-            suggester.Refresh();
-            IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
-            assertEquals(2, results.size());
-            assertEquals("a penny saved is a penny <b>ear</b>ned", results[0].Key);
-            assertEquals(10, results[0].Value);
-            assertEquals(new BytesRef("foobaz"), results[0].Payload);
-
-            assertEquals("lend me your <b>ear</b>", results[1].Key);
-            assertEquals(8, results[1].Value);
-            assertEquals(new BytesRef("foobar"), results[1].Payload);
-
-            results = suggester.DoLookup(TestUtil.StringToCharSequence("ear ", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("lend me your <b>ear</b>", results[0].Key);
-            assertEquals(8, results[0].Value);
-            assertEquals(new BytesRef("foobar"), results[0].Payload);
-
-            results = suggester.DoLookup(TestUtil.StringToCharSequence("pen", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("a <b>pen</b>ny saved is a <b>pen</b>ny earned", results[0].Key);
-            assertEquals(10, results[0].Value);
-            assertEquals(new BytesRef("foobaz"), results[0].Payload);
-
-            results = suggester.DoLookup(TestUtil.StringToCharSequence("p", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("a <b>p</b>enny saved is a <b>p</b>enny earned", results[0].Key);
-            assertEquals(10, results[0].Value);
-            assertEquals(new BytesRef("foobaz"), results[0].Payload);
-
-            suggester.Dispose();
+            using (AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3))
+            {
+                suggester.Build(new InputArrayIterator(new Input[0]));
+                suggester.Add(new BytesRef("a penny saved is a penny earned"), null, 10, new BytesRef("foobaz"));
+                suggester.Add(new BytesRef("lend me your ear"), null, 8, new BytesRef("foobar"));
+                suggester.Refresh();
+                IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
+                assertEquals(2, results.size());
+                assertEquals("a penny saved is a penny <b>ear</b>ned", results[0].Key);
+                assertEquals(10, results[0].Value);
+                assertEquals(new BytesRef("foobaz"), results[0].Payload);
+
+                assertEquals("lend me your <b>ear</b>", results[1].Key);
+                assertEquals(8, results[1].Value);
+                assertEquals(new BytesRef("foobar"), results[1].Payload);
+
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("ear ", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("lend me your <b>ear</b>", results[0].Key);
+                assertEquals(8, results[0].Value);
+                assertEquals(new BytesRef("foobar"), results[0].Payload);
+
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("pen", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("a <b>pen</b>ny saved is a <b>pen</b>ny earned", results[0].Key);
+                assertEquals(10, results[0].Value);
+                assertEquals(new BytesRef("foobaz"), results[0].Payload);
+
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("p", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("a <b>p</b>enny saved is a <b>p</b>enny earned", results[0].Key);
+                assertEquals(10, results[0].Value);
+                assertEquals(new BytesRef("foobaz"), results[0].Payload);
+
+            }
         }
 
         [Test]
         public void TestBothExactAndPrefix()
         {
             Analyzer a = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false);
-            AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3);
-            suggester.Build(new InputArrayIterator(new Input[0]));
-            suggester.Add(new BytesRef("the pen is pretty"), null, 10, new BytesRef("foobaz"));
-            suggester.Refresh();
-
-            IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("pen p", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("the <b>pen</b> is <b>p</b>retty", results[0].Key);
-            assertEquals(10, results[0].Value);
-            assertEquals(new BytesRef("foobaz"), results[0].Payload);
-            suggester.Dispose();
+            using (AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3))
+            {
+                suggester.Build(new InputArrayIterator(new Input[0]));
+                suggester.Add(new BytesRef("the pen is pretty"), null, 10, new BytesRef("foobaz"));
+                suggester.Refresh();
+
+                IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("pen p", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("the <b>pen</b> is <b>p</b>retty", results[0].Key);
+                assertEquals(10, results[0].Value);
+                assertEquals(new BytesRef("foobaz"), results[0].Payload);
+            }
         }
 
         private static string RandomText()
@@ -628,249 +650,255 @@ namespace Lucene.Net.Search.Suggest.Analyzing
             }
 
             AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixChars);
+            try
+            {
 
-            // Initial suggester built with nothing:
-            suggester.Build(new InputArrayIterator(new Input[0]));
+                // Initial suggester built with nothing:
+                suggester.Build(new InputArrayIterator(new Input[0]));
 
-            var stop = new AtomicBoolean(false);
-            Exception[] error = new Exception[] { null };
+                var stop = new AtomicBoolean(false);
+                Exception[] error = new Exception[] { null };
 
-            LookupThread lookupThread = new LookupThread(this, suggester, stop, error);
-            lookupThread.Start();
+                LookupThread lookupThread = new LookupThread(this, suggester, stop, error);
+                lookupThread.Start();
 
-            int iters = AtLeast(1000);
-            int visibleUpto = 0;
+                int iters = AtLeast(1000);
+                int visibleUpto = 0;
 
-            ISet<long> usedWeights = new HashSet<long>();
-            ISet<string> usedKeys = new HashSet<string>();
+                ISet<long> usedWeights = new HashSet<long>();
+                ISet<string> usedKeys = new HashSet<string>();
 
-            List<Input> inputs = new List<Input>();
-            List<Update> pendingUpdates = new List<Update>();
+                List<Input> inputs = new List<Input>();
+                List<Update> pendingUpdates = new List<Update>();
 
-            for (int iter = 0; iter < iters; iter++)
-            {
-                string text;
-                while (true)
+                for (int iter = 0; iter < iters; iter++)
                 {
-                    text = RandomText();
-                    if (usedKeys.contains(text) == false)
+                    string text;
+                    while (true)
                     {
-                        usedKeys.add(text);
-                        break;
-                    }
-                }
-
-                // Carefully pick a weight we never used, to sidestep
-                // tie-break problems:
-                long weight;
-                while (true)
-                {
-                    weight = Random().nextInt(10 * iters);
-                    if (usedWeights.contains(weight) == false)
-                    {
-                        usedWeights.add(weight);
-                        break;
+                        text = RandomText();
+                        if (usedKeys.contains(text) == false)
+                        {
+                            usedKeys.add(text);
+                            break;
+                        }
                     }
-                }
 
-                if (inputs.size() > 0 && Random().nextInt(4) == 1)
-                {
-                    // Update an existing suggestion
-                    Update update = new Update();
-                    update.index = Random().nextInt(inputs.size());
-                    update.weight = weight;
-                    Input input = inputs.ElementAt(update.index);
-                    pendingUpdates.Add(update);
-                    if (VERBOSE)
+                    // Carefully pick a weight we never used, to sidestep
+                    // tie-break problems:
+                    long weight;
+                    while (true)
                     {
-                        Console.WriteLine("TEST: iter=" + iter + " update input=" + input.term.Utf8ToString() + "/" + weight);
+                        weight = Random().nextInt(10 * iters);
+                        if (usedWeights.contains(weight) == false)
+                        {
+                            usedWeights.add(weight);
+                            break;
+                        }
                     }
-                    suggester.Update(input.term, null, weight, input.term);
 
-                }
-                else
-                {
-                    // Add a new suggestion
-                    inputs.Add(new Input(text, weight, new BytesRef(text)));
-                    if (VERBOSE)
+                    if (inputs.size() > 0 && Random().nextInt(4) == 1)
                     {
-                        Console.WriteLine("TEST: iter=" + iter + " add input=" + text + "/" + weight);
-                    }
-                    BytesRef br = new BytesRef(text);
-                    suggester.Add(br, null, weight, br);
-                }
+                        // Update an existing suggestion
+                        Update update = new Update();
+                        update.index = Random().nextInt(inputs.size());
+                        update.weight = weight;
+                        Input input = inputs.ElementAt(update.index);
+                        pendingUpdates.Add(update);
+                        if (VERBOSE)
+                        {
+                            Console.WriteLine("TEST: iter=" + iter + " update input=" + input.term.Utf8ToString() + "/" + weight);
+                        }
+                        suggester.Update(input.term, null, weight, input.term);
 
-                if (Random().nextInt(15) == 7)
-                {
-                    if (VERBOSE)
-                    {
-                        Console.WriteLine("TEST: now refresh suggester");
                     }
-                    suggester.Refresh();
-                    visibleUpto = inputs.size();
-                    foreach (Update update in pendingUpdates)
+                    else
                     {
-                        Input oldInput = inputs.ElementAt(update.index);
-                        Input newInput = new Input(oldInput.term, update.weight, oldInput.payload);
-                        inputs[update.index] = newInput;
+                        // Add a new suggestion
+                        inputs.Add(new Input(text, weight, new BytesRef(text)));
+                        if (VERBOSE)
+                        {
+                            Console.WriteLine("TEST: iter=" + iter + " add input=" + text + "/" + weight);
+                        }
+                        BytesRef br = new BytesRef(text);
+                        suggester.Add(br, null, weight, br);
                     }
-                    pendingUpdates.Clear();
-                }
 
-                if (Random().nextInt(50) == 7)
-                {
-                    if (VERBOSE)
+                    if (Random().nextInt(15) == 7)
                     {
-                        Console.WriteLine("TEST: now close/reopen suggester");
+                        if (VERBOSE)
+                        {
+                            Console.WriteLine("TEST: now refresh suggester");
+                        }
+                        suggester.Refresh();
+                        visibleUpto = inputs.size();
+                        foreach (Update update in pendingUpdates)
+                        {
+                            Input oldInput = inputs.ElementAt(update.index);
+                            Input newInput = new Input(oldInput.term, update.weight, oldInput.payload);
+                            inputs[update.index] = newInput;
+                        }
+                        pendingUpdates.Clear();
                     }
-                    //lookupThread.Finish();
-                    stop.Set(true);
-                    lookupThread.Join();
-                    Assert.Null(error[0], "Unexpcted exception at retry : \n" + stackTraceStr(error[0]));
-                    suggester.Dispose();
-                    suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixChars);
-                    lookupThread = new LookupThread(this, suggester, stop, error);
-                    lookupThread.Start();
 
-                    visibleUpto = inputs.size();
-                    foreach (Update update in pendingUpdates)
+                    if (Random().nextInt(50) == 7)
                     {
-                        Input oldInput = inputs.ElementAt(update.index);
-                        Input newInput = new Input(oldInput.term, update.weight, oldInput.payload);
-                        inputs[update.index] = newInput;
+                        if (VERBOSE)
+                        {
+                            Console.WriteLine("TEST: now close/reopen suggester");
+                        }
+                        //lookupThread.Finish();
+                        stop.Set(true);
+                        lookupThread.Join();
+                        Assert.Null(error[0], "Unexpcted exception at retry : \n" + stackTraceStr(error[0]));
+                        suggester.Dispose();
+                        suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixChars);
+                        lookupThread = new LookupThread(this, suggester, stop, error);
+                        lookupThread.Start();
+
+                        visibleUpto = inputs.size();
+                        foreach (Update update in pendingUpdates)
+                        {
+                            Input oldInput = inputs.ElementAt(update.index);
+                            Input newInput = new Input(oldInput.term, update.weight, oldInput.payload);
+                            inputs[update.index] = newInput;
+                        }
+                        pendingUpdates.Clear();
                     }
-                    pendingUpdates.Clear();
-                }
 
-                if (visibleUpto > 0)
-                {
-                    string query = RandomText();
-                    bool lastPrefix = Random().nextInt(5) != 1;
-                    if (lastPrefix == false)
+                    if (visibleUpto > 0)
                     {
-                        query += " ";
-                    }
+                        string query = RandomText();
+                        bool lastPrefix = Random().nextInt(5) != 1;
+                        if (lastPrefix == false)
+                        {
+                            query += " ";
+                        }
 
-                    string[] queryTerms = Regex.Split(query, "\\s", RegexOptions.Compiled).TrimEnd();
-                    bool allTermsRequired = Random().nextInt(10) == 7;
-                    bool doHilite = Random().nextBoolean();
+                        string[] queryTerms = Regex.Split(query, "\\s", RegexOptions.Compiled).TrimEnd();
+                        bool allTermsRequired = Random().nextInt(10) == 7;
+                        bool doHilite = Random().nextBoolean();
 
-                    if (VERBOSE)
-                    {
-                        Console.WriteLine("TEST: lookup \"" + query + "\" allTermsRequired=" + allTermsRequired + " doHilite=" + doHilite);
-                    }
+                        if (VERBOSE)
+                        {
+                            Console.WriteLine("TEST: lookup \"" + query + "\" allTermsRequired=" + allTermsRequired + " doHilite=" + doHilite);
+                        }
 
-                    // Stupid slow but hopefully correct matching:
-                    List<Input> expected = new List<Input>();
-                    for (int i = 0; i < visibleUpto; i++)
-                    {
-                        Input input = inputs.ElementAt(i);
-                        string[] inputTerms = Regex.Split(input.term.Utf8ToString(), "\\s", RegexOptions.Compiled).TrimEnd();
-                        bool match = false;
-                        for (int j = 0; j < queryTerms.Length; j++)
+                        // Stupid slow but hopefully correct matching:
+                        List<Input> expected = new List<Input>();
+                        for (int i = 0; i < visibleUpto; i++)
                         {
-                            if (j < queryTerms.Length - 1 || lastPrefix == false)
+                            Input input = inputs.ElementAt(i);
+                            string[] inputTerms = Regex.Split(input.term.Utf8ToString(), "\\s", RegexOptions.Compiled).TrimEnd();
+                            bool match = false;
+                            for (int j = 0; j < queryTerms.Length; j++)
                             {
-                                // Exact match
-                                for (int k = 0; k < inputTerms.Length; k++)
+                                if (j < queryTerms.Length - 1 || lastPrefix == false)
                                 {
-                                    if (inputTerms[k].Equals(queryTerms[j], StringComparison.Ordinal))
+                                    // Exact match
+                                    for (int k = 0; k < inputTerms.Length; k++)
                                     {
-                                        match = true;
-                                        break;
+                                        if (inputTerms[k].Equals(queryTerms[j], StringComparison.Ordinal))
+                                        {
+                                            match = true;
+                                            break;
+                                        }
                                     }
                                 }
-                            }
-                            else
-                            {
-                                // Prefix match
-                                for (int k = 0; k < inputTerms.Length; k++)
+                                else
                                 {
-                                    if (inputTerms[k].StartsWith(queryTerms[j], StringComparison.Ordinal))
+                                    // Prefix match
+                                    for (int k = 0; k < inputTerms.Length; k++)
                                     {
-                                        match = true;
+                                        if (inputTerms[k].StartsWith(queryTerms[j], StringComparison.Ordinal))
+                                        {
+                                            match = true;
+                                            break;
+                                        }
+                                    }
+                                }
+                                if (match)
+                                {
+                                    if (allTermsRequired == false)
+                                    {
+                                        // At least one query term does match:
                                         break;
                                     }
+                                    match = false;
                                 }
-                            }
-                            if (match)
-                            {
-                                if (allTermsRequired == false)
+                                else if (allTermsRequired)
                                 {
-                                    // At least one query term does match:
+                                    // At least one query term does not match:
                                     break;
                                 }
-                                match = false;
                             }
-                            else if (allTermsRequired)
-                            {
-                                // At least one query term does not match:
-                                break;
-                            }
-                        }
 
-                        if (match)
-                        {
-                            if (doHilite)
-                            {
-                                expected.Add(new Input(Hilite(lastPrefix, inputTerms, queryTerms), input.v, input.term));
-                            }
-                            else
+                            if (match)
                             {
-                                expected.Add(input);
+                                if (doHilite)
+                                {
+                                    expected.Add(new Input(Hilite(lastPrefix, inputTerms, queryTerms), input.v, input.term));
+                                }
+                                else
+                                {
+                                    expected.Add(input);
+                                }
                             }
                         }
-                    }
 
-                    expected.Sort(new TestRandomNRTComparer());
+                        expected.Sort(new TestRandomNRTComparer());
 
-                    if (expected.Any())
-                    {
+                        if (expected.Any())
+                        {
 
-                        int topN = TestUtil.NextInt(Random(), 1, expected.size());
+                            int topN = TestUtil.NextInt(Random(), 1, expected.size());
 
-                        IList<Lookup.LookupResult> actual = suggester.DoLookup(TestUtil.StringToCharSequence(query, Random()).ToString(), topN, allTermsRequired, doHilite);
+                            IList<Lookup.LookupResult> actual = suggester.DoLookup(TestUtil.StringToCharSequence(query, Random()).ToString(), topN, allTermsRequired, doHilite);
 
-                        int expectedCount = Math.Min(topN, expected.size());
+                            int expectedCount = Math.Min(topN, expected.size());
 
-                        if (VERBOSE)
-                        {
-                            Console.WriteLine("  expected:");
-                            for (int i = 0; i < expectedCount; i++)
+                            if (VERBOSE)
                             {
-                                Input x = expected.ElementAt(i);
-                                Console.WriteLine("    " + x.term.Utf8ToString() + "/" + x.v);
+                                Console.WriteLine("  expected:");
+                                for (int i = 0; i < expectedCount; i++)
+                                {
+                                    Input x = expected.ElementAt(i);
+                                    Console.WriteLine("    " + x.term.Utf8ToString() + "/" + x.v);
+                                }
+                                Console.WriteLine("  actual:");
+                                foreach (Lookup.LookupResult result in actual)
+                                {
+                                    Console.WriteLine("    " + result);
+                                }
                             }
-                            Console.WriteLine("  actual:");
-                            foreach (Lookup.LookupResult result in actual)
+
+                            assertEquals(expectedCount, actual.size());
+                            for (int i = 0; i < expectedCount; i++)
                             {
-                                Console.WriteLine("    " + result);
+                                assertEquals(expected.ElementAt(i).term.Utf8ToString(), actual.ElementAt(i).Key.toString());
+                                assertEquals(expected.ElementAt(i).v, actual.ElementAt(i).Value);
+                                assertEquals(expected.ElementAt(i).payload, actual.ElementAt(i).Payload);
                             }
                         }
-
-                        assertEquals(expectedCount, actual.size());
-                        for (int i = 0; i < expectedCount; i++)
+                        else
                         {
-                            assertEquals(expected.ElementAt(i).term.Utf8ToString(), actual.ElementAt(i).Key.toString());
-                            assertEquals(expected.ElementAt(i).v, actual.ElementAt(i).Value);
-                            assertEquals(expected.ElementAt(i).payload, actual.ElementAt(i).Payload);
-                        }
-                    }
-                    else
-                    {
-                        if (VERBOSE)
-                        {
-                            Console.WriteLine("  no expected matches");
+                            if (VERBOSE)
+                            {
+                                Console.WriteLine("  no expected matches");
+                            }
                         }
                     }
                 }
-            }
 
-            //lookupThread.finish();
-            stop.Set(true);
-            lookupThread.Join();
-            Assert.Null(error[0], "Unexpcted exception at retry : \n" + stackTraceStr(error[0]));
-            suggester.Dispose();
+                //lookupThread.finish();
+                stop.Set(true);
+                lookupThread.Join();
+                Assert.Null(error[0], "Unexpcted exception at retry : \n" + stackTraceStr(error[0]));
+            }
+            finally
+            {
+                suggester.Dispose();
+            }
         }
 
         private static string Hilite(bool lastPrefix, string[] inputTerms, string[] queryTerms)
@@ -931,64 +959,65 @@ namespace Lucene.Net.Search.Suggest.Analyzing
             };
 
             Analyzer a = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false);
-            AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3);
-            suggester.Build(new InputArrayIterator(keys));
-
-            IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("lend me your <b>ear</b>", results.ElementAt(0).Key);
-            assertEquals(8, results.ElementAt(0).Value);
-            assertEquals(new BytesRef("foobar"), results.ElementAt(0).Payload);
-
-            // Add a new suggestion:
-            suggester.Add(new BytesRef("a penny saved is a penny earned"), null, 10, new BytesRef("foobaz"));
-
-            // Must refresh to see any newly added suggestions:
-            suggester.Refresh();
-
-            results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
-            assertEquals(2, results.size());
-            assertEquals("a penny saved is a penny <b>ear</b>ned", results.ElementAt(0).Key);
-            assertEquals(10, results.ElementAt(0).Value);
-            assertEquals(new BytesRef("foobaz"), results.ElementAt(0).Payload);
-
-            assertEquals("lend me your <b>ear</b>", results.ElementAt(1).Key);
-            assertEquals(8, results.ElementAt(1).Value);
-            assertEquals(new BytesRef("foobar"), results.ElementAt(1).Payload);
-
-            results = suggester.DoLookup(TestUtil.StringToCharSequence("ear ", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("lend me your <b>ear</b>", results.ElementAt(0).Key);
-            assertEquals(8, results.ElementAt(0).Value);
-            assertEquals(new BytesRef("foobar"), results.ElementAt(0).Payload);
-
-            results = suggester.DoLookup(TestUtil.StringToCharSequence("pen", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("a <b>pen</b>ny saved is a <b>pen</b>ny earned", results.ElementAt(0).Key);
-            assertEquals(10, results.ElementAt(0).Value);
-            assertEquals(new BytesRef("foobaz"), results.ElementAt(0).Payload);
-
-            results = suggester.DoLookup(TestUtil.StringToCharSequence("p", Random()).ToString(), 10, true, true);
-            assertEquals(1, results.size());
-            assertEquals("a <b>p</b>enny saved is a <b>p</b>enny earned", results.ElementAt(0).Key);
-            assertEquals(10, results.ElementAt(0).Value);
-            assertEquals(new BytesRef("foobaz"), results.ElementAt(0).Payload);
-
-            // Change the weight:
-            suggester.Update(new BytesRef("lend me your ear"), null, 12, new BytesRef("foobox"));
-
-            // Must refresh to see any newly added suggestions:
-            suggester.Refresh();
-
-            results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
-            assertEquals(2, results.size());
-            assertEquals("lend me your <b>ear</b>", results.ElementAt(0).Key);
-            assertEquals(12, results.ElementAt(0).Value);
-            assertEquals(new BytesRef("foobox"), results.ElementAt(0).Payload);
-            assertEquals("a penny saved is a penny <b>ear</b>ned", results.ElementAt(1).Key);
-            assertEquals(10, results.ElementAt(1).Value);
-            assertEquals(new BytesRef("foobaz"), results.ElementAt(1).Payload);
-            suggester.Dispose();
+            using (AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3))
+            {
+                suggester.Build(new InputArrayIterator(keys));
+
+                IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("lend me your <b>ear</b>", results.ElementAt(0).Key);
+                assertEquals(8, results.ElementAt(0).Value);
+                assertEquals(new BytesRef("foobar"), results.ElementAt(0).Payload);
+
+                // Add a new suggestion:
+                suggester.Add(new BytesRef("a penny saved is a penny earned"), null, 10, new BytesRef("foobaz"));
+
+                // Must refresh to see any newly added suggestions:
+                suggester.Refresh();
+
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
+                assertEquals(2, results.size());
+                assertEquals("a penny saved is a penny <b>ear</b>ned", results.ElementAt(0).Key);
+                assertEquals(10, results.ElementAt(0).Value);
+                assertEquals(new BytesRef("foobaz"), results.ElementAt(0).Payload);
+
+                assertEquals("lend me your <b>ear</b>", results.ElementAt(1).Key);
+                assertEquals(8, results.ElementAt(1).Value);
+                assertEquals(new BytesRef("foobar"), results.ElementAt(1).Payload);
+
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("ear ", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("lend me your <b>ear</b>", results.ElementAt(0).Key);
+                assertEquals(8, results.ElementAt(0).Value);
+                assertEquals(new BytesRef("foobar"), results.ElementAt(0).Payload);
+
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("pen", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("a <b>pen</b>ny saved is a <b>pen</b>ny earned", results.ElementAt(0).Key);
+                assertEquals(10, results.ElementAt(0).Value);
+                assertEquals(new BytesRef("foobaz"), results.ElementAt(0).Payload);
+
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("p", Random()).ToString(), 10, true, true);
+                assertEquals(1, results.size());
+                assertEquals("a <b>p</b>enny saved is a <b>p</b>enny earned", results.ElementAt(0).Key);
+                assertEquals(10, results.ElementAt(0).Value);
+                assertEquals(new BytesRef("foobaz"), results.ElementAt(0).Payload);
+
+                // Change the weight:
+                suggester.Update(new BytesRef("lend me your ear"), null, 12, new BytesRef("foobox"));
+
+                // Must refresh to see any newly added suggestions:
+                suggester.Refresh();
+
+                results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
+                assertEquals(2, results.size());
+                assertEquals("lend me your <b>ear</b>", results.ElementAt(0).Key);
+                assertEquals(12, results.ElementAt(0).Value);
+                assertEquals(new BytesRef("foobox"), results.ElementAt(0).Payload);
+                assertEquals("a penny saved is a penny <b>ear</b>ned", results.ElementAt(1).Key);
+                assertEquals(10, results.ElementAt(1).Value);
+                assertEquals(new BytesRef("foobaz"), results.ElementAt(1).Payload);
+            }
         }
 
         private IEnumerable<BytesRef> AsSet(params string[] values)
@@ -1015,111 +1044,117 @@ namespace Lucene.Net.Search.Suggest.Analyzing
 
             for (int iter = 0; iter < 2; iter++)
             {
-                AnalyzingInfixSuggester suggester;
-                Analyzer a = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false);
-                if (iter == 0)
-                {
-                    suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3);
-                    suggester.Build(new InputArrayIterator(keys));
-                }
-                else
+                AnalyzingInfixSuggester suggester = null;
+                try
                 {
-                    // Test again, after close/reopen:
-                    suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3);
-                }
-
-                // No context provided, all results returned
-                IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
-                assertEquals(2, results.size());
-                Lookup.LookupResult result = results.ElementAt(0);
-                assertEquals("a penny saved is a penny <b>ear</b>ned", result.Key);
-                assertEquals(10, result.Value);
-                assertEquals(new BytesRef("foobaz"), result.Payload);
-                assertNotNull(result.Contexts);
-                assertEquals(2, result.Contexts.Count());
-                assertTrue(result.Contexts.Contains(new BytesRef("foo")));
-                assertTrue(result.Contexts.Contains(new BytesRef("baz")));
-
-                result = results.ElementAt(1);
-                assertEquals("lend me your <b>ear</b>", result.Key);
-                assertEquals(8, result.Value);
-                assertEquals(new BytesRef("foobar"), result.Payload);
-                assertNotNull(result.Contexts);
-                assertEquals(2, result.Contexts.Count());
-                assertTrue(result.Contexts.Contains(new BytesRef("foo")));
-                assertTrue(result.Contexts.Contains(new BytesRef("bar")));
-
-                // Both suggestions have "foo" context:
-                results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), AsSet("foo"), 10, true, true);
-                assertEquals(2, results.size());
+                    Analyzer a = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false);
+                    if (iter == 0)
+                    {
+                        suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3);
+                        suggester.Build(new InputArrayIterator(keys));
+                    }
+                    else
+                    {
+                        // Test again, after close/reopen:
+                        suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3);
+                    }
 
-                result = results.ElementAt(0);
-                assertEquals("a penny saved is a penny <b>ear</b>ned", result.Key);
-                assertEquals(10, result.Value);
-                assertEquals(new BytesRef("foobaz"), result.Payload);
-                assertNotNull(result.Contexts);
-                assertEquals(2, result.Contexts.Count());
-                assertTrue(result.Contexts.Contains(new BytesRef("foo")));
-                assertTrue(result.Contexts.Contains(new BytesRef("baz")));
-
-                result = results.ElementAt(1);
-                assertEquals("lend me your <b>ear</b>", result.Key);
-                assertEquals(8, result.Value);
-                assertEquals(new BytesRef("foobar"), result.Payload);
-                assertNotNull(result.Contexts);
-                assertEquals(2, result.Contexts.Count());
-                assertTrue(result.Contexts.Contains(new BytesRef("foo")));
-                assertTrue(result.Contexts.Contains(new BytesRef("bar")));
-
-                // Only one has "bar" context:
-                results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), AsSet("bar"), 10, true, true);
-                assertEquals(1, results.size());
+                    // No context provided, all results returned
+                    IList<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), 10, true, true);
+                    assertEquals(2, results.size());
+                    Lookup.LookupResult result = results.ElementAt(0);
+                    assertEquals("a penny saved is a penny <b>ear</b>ned", result.Key);
+                    assertEquals(10, result.Value);
+                    assertEquals(new BytesRef("foobaz"), result.Payload);
+                    assertNotNull(result.Contexts);
+                    assertEquals(2, result.Contexts.Count());
+                    assertTrue(result.Contexts.Contains(new BytesRef("foo")));
+                    assertTrue(result.Contexts.Contains(new BytesRef("baz")));
+
+                    result = results.ElementAt(1);
+                    assertEquals("lend me your <b>ear</b>", result.Key);
+                    assertEquals(8, result.Value);
+                    assertEquals(new BytesRef("foobar"), result.Payload);
+                    assertNotNull(result.Contexts);
+                    assertEquals(2, result.Contexts.Count());
+                    assertTrue(result.Contexts.Contains(new BytesRef("foo")));
+                    assertTrue(result.Contexts.Contains(new BytesRef("bar")));
+
+                    // Both suggestions have "foo" context:
+                    results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), AsSet("foo"), 10, true, true);
+                    assertEquals(2, results.size());
 
-                result = results.ElementAt(0);
-                assertEquals("lend me your <b>ear</b>", result.Key);
-                assertEquals(8, result.Value);
-                assertEquals(new BytesRef("foobar"), result.Payload);
-                assertNotNull(result.Contexts);
-                assertEquals(2, result.Contexts.Count());
-                assertTrue(result.Contexts.Contains(new BytesRef("foo")));
-                assertTrue(result.Contexts.Contains(new BytesRef("bar")));
-
-                // Only one has "baz" context:
-                results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), AsSet("baz"), 10, true, true);
-                assertEquals(1, results.size());
+                    result = results.ElementAt(0);
+                    assertEquals("a penny saved is a penny <b>ear</b>ned", result.Key);
+                    assertEquals(10, result.Value);
+                    assertEquals(new BytesRef("foobaz"), result.Payload);
+                    assertNotNull(result.Contexts);
+                    assertEquals(2, result.Contexts.Count());
+                    assertTrue(result.Contexts.Contains(new BytesRef("foo")));
+                    assertTrue(result.Contexts.Contains(new BytesRef("baz")));
+
+                    result = results.ElementAt(1);
+                    assertEquals("lend me your <b>ear</b>", result.Key);
+                    assertEquals(8, result.Value);
+                    assertEquals(new BytesRef("foobar"), result.Payload);
+                    assertNotNull(result.Contexts);
+                    assertEquals(2, result.Contexts.Count());
+                    assertTrue(result.Contexts.Contains(new BytesRef("foo")));
+                    assertTrue(result.Contexts.Contains(new BytesRef("bar")));
+
+                    // Only one has "bar" context:
+                    results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), AsSet("bar"), 10, true, true);
+                    assertEquals(1, results.size());
 
-                result = results.ElementAt(0);
-                assertEquals("a penny saved is a penny <b>ear</b>ned", result.Key);
-                assertEquals(10, result.Value);
-                assertEquals(new BytesRef("foobaz"), result.Payload);
-                assertNotNull(result.Contexts);
-                assertEquals(2, result.Contexts.Count());
-                assertTrue(result.Contexts.Contains(new BytesRef("foo")));
-                assertTrue(result.Contexts.Contains(new BytesRef("baz")));
-
-                // Both have foo or bar:
-                results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), AsSet("foo", "bar"), 10, true, true);
-                assertEquals(2, results.size());
+                    result = results.ElementAt(0);
+                    assertEquals("lend me your <b>ear</b>", result.Key);
+                    assertEquals(8, result.Value);
+                    assertEquals(new BytesRef("foobar"), result.Payload);
+                    assertNotNull(result.Contexts);
+                    assertEquals(2, result.Contexts.Count());
+                    assertTrue(result.Contexts.Contains(new BytesRef("foo")));
+                    assertTrue(result.Contexts.Contains(new BytesRef("bar")));
+
+                    // Only one has "baz" context:
+                    results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), AsSet("baz"), 10, true, true);
+                    assertEquals(1, results.size());
 
-                result = results.ElementAt(0);
-                assertEquals("a penny saved is a penny <b>ear</b>ned", result.Key);
-                assertEquals(10, result.Value);
-                assertEquals(new BytesRef("foobaz"), result.Payload);
-                assertNotNull(result.Contexts);
-                assertEquals(2, result.Contexts.Count());
-                assertTrue(result.Contexts.Contains(new BytesRef("foo")));
-                assertTrue(result.Contexts.Contains(new BytesRef("baz")));
-
-                result = results.ElementAt(1);
-                assertEquals("lend me your <b>ear</b>", result.Key);
-                assertEquals(8, result.Value);
-                assertEquals(new BytesRef("foobar"), result.Payload);
-                assertNotNull(result.Contexts);
-                assertEquals(2, result.Contexts.Count());
-                assertTrue(result.Contexts.Contains(new BytesRef("foo")));
-                assertTrue(result.Contexts.Contains(new BytesRef("bar")));
+                    result = results.ElementAt(0);
+                    assertEquals("a penny saved is a penny <b>ear</b>ned", result.Key);
+                    assertEquals(10, result.Value);
+                    assertEquals(new BytesRef("foobaz"), result.Payload);
+                    assertNotNull(result.Contexts);
+                    assertEquals(2, result.Contexts.Count());
+                    assertTrue(result.Contexts.Contains(new BytesRef("foo")));
+                    assertTrue(result.Contexts.Contains(new BytesRef("baz")));
+
+                    // Both have foo or bar:
+                    results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random()).ToString(), AsSet("foo", "bar"), 10, true, true);
+                    assertEquals(2, results.size());
 
-                suggester.Dispose();
+                    result = results.ElementAt(0);
+                    assertEquals("a penny saved is a penny <b>ear</b>ned", result.Key);
+                    assertEquals(10, result.Value);
+                    assertEquals(new BytesRef("foobaz"), result.Payload);
+                    assertNotNull(result.Contexts);
+                    assertEquals(2, result.Contexts.Count());
+                    assertTrue(result.Contexts.Contains(new BytesRef("foo")));
+                    assertTrue(result.Contexts.Contains(new BytesRef("baz")));
+
+                    result = results.ElementAt(1);
+                    assertEquals("lend me your <b>ear</b>", result.Key);
+                    assertEquals(8, result.Value);
+                    assertEquals(new BytesRef("foobar"), result.Payload);
+                    assertNotNull(result.Contexts);
+                    assertEquals(2, result.Contexts.Count());
+                    assertTrue(result.Contexts.Contains(new BytesRef("foo")));
+                    assertTrue(result.Contexts.Contains(new BytesRef("bar")));
+                }
+                finally
+                {
+                    if (suggester != null)
+                        suggester.Dispose();
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/302a51e6/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
index e578824..03bd5be 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
@@ -69,18 +69,18 @@ namespace Lucene.Net.Search.Suggest.Analyzing
 
                 // Try again after save/load:
                 DirectoryInfo tmpDir = CreateTempDir("FreeTextSuggesterTest");
-                tmpDir.Create();
+                //tmpDir.Create();
 
                 FileInfo path = new FileInfo(Path.Combine(tmpDir.FullName, "suggester"));
 
-                Stream os = new FileStream(path.FullName, FileMode.OpenOrCreate, FileAccess.ReadWrite);
-                sug.Store(os);
-                os.Dispose();
+                using (Stream os = new FileStream(path.FullName, FileMode.Create, FileAccess.Write))
+                    sug.Store(os);
 
-                Stream @is = new FileStream(path.FullName, FileMode.Open);
-                sug = new FreeTextSuggester(a, a, 2, (byte)0x20);
-                sug.Load(@is);
-                @is.Dispose();
+                using (Stream @is = new FileStream(path.FullName, FileMode.Open, FileAccess.Read))
+                {
+                    sug = new FreeTextSuggester(a, a, 2, (byte)0x20);
+                    sug.Load(@is);
+                }
                 assertEquals(2, sug.Count);
             }
         }


Mime
View raw message