Пример #1
0
        public virtual void  SetUp()
        {
            //create a user index
            userindex = new RAMDirectory();
            IndexWriter writer = new IndexWriter(userindex, new SimpleAnalyzer(), true);

            for (int i = 0; i < 1000; i++)
            {
                Document doc = new Document();
                doc.Add(new Field("field1", English.IntToEnglish(i), Field.Store.YES, Field.Index.TOKENIZED));
                doc.Add(new Field("field2", English.IntToEnglish(i + 1), Field.Store.YES, Field.Index.TOKENIZED));                 // + word thousand
                writer.AddDocument(doc);
            }
            writer.Close();

            // create the spellChecker
            spellindex   = new RAMDirectory();
            spellChecker = new SpellChecker.Net.Search.Spell.SpellChecker(spellindex);
        }
Пример #2
0
        public virtual void SetUp()
        {
            //create a user index
            userindex = new RAMDirectory();
            IndexWriter writer = new IndexWriter(userindex, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.UNLIMITED);

            for (int i = 0; i < 1000; i++)
            {
                Document doc = new Document();
                doc.Add(new Field("field1", English.IntToEnglish(i), Field.Store.YES, Field.Index.ANALYZED));
                doc.Add(new Field("field2", English.IntToEnglish(i + 1), Field.Store.YES, Field.Index.ANALYZED)); // + word thousand
                writer.AddDocument(doc);
            }
            writer.Close();

            // create the spellChecker
            spellindex   = new RAMDirectory();
            searchers    = ArrayList.Synchronized(new ArrayList());
            spellChecker = new SpellCheckerMock(spellindex, this);
        }