Package org.apache.lucene.search.spell

Examples of org.apache.lucene.search.spell.Dictionary


      assertTrue(null!=docs.remove(termToDel));
    }
   
    IndexReader ir = DirectoryReader.open(dir);
    assertEquals(ir.numDocs(), docs.size());
    Dictionary dictionary = new DocumentDictionary(ir, FIELD_NAME, WEIGHT_FIELD_NAME);
    InputIterator inputIterator = dictionary.getEntryIterator();
    BytesRef f;
    while((f = inputIterator.next())!=null) {
      Document doc = docs.remove(f.utf8ToString());
      assertTrue(f.equals(new BytesRef(doc.get(FIELD_NAME))));
      IndexableField weightField = doc.getField(WEIGHT_FIELD_NAME);
View Full Code Here


    if (null == termSourceField) {
      throw new SolrException
        (SolrException.ErrorCode.SERVER_ERROR, "can't rebuild spellchecker index without termSourceField configured");
    }

    Dictionary dictionary = getDictionary(req);
    spellChecker.clearIndex();
    spellChecker.indexDictionary(dictionary);
    reopen();
  }
View Full Code Here

    if (null == termSourceField) {
      throw new SolrException
        (SolrException.ErrorCode.SERVER_ERROR, "can't rebuild spellchecker index without termSourceField configured");
    }

    Dictionary dictionary = getDictionary(req);
    spellChecker.clearIndex();
    spellChecker.indexDictionary(dictionary);
    reopen();
  }
View Full Code Here

    if (null == termSourceField) {
      throw new SolrException
        (SolrException.ErrorCode.SERVER_ERROR, "can't rebuild spellchecker index without termSourceField configured");
    }

    Dictionary dictionary = getDictionary(req);
    spellChecker.clearIndex();
    spellChecker.indexDictionary(dictionary);
    reopen();
  }
View Full Code Here

                              {
                                 IndexReader reader = handler.getIndexReader();
                                 try
                                 {
                                    long time = System.currentTimeMillis();
                                    final Dictionary dict = new LuceneDictionary(reader, FieldNames.FULLTEXT);
                                    log.debug("Starting spell checker index refresh");
                                    SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
                                    {
                                       public Void run() throws IOException
                                       {
View Full Code Here

                              {
                                 IndexReader reader = handler.getIndexReader();
                                 try
                                 {
                                    long time = System.currentTimeMillis();
                                    Dictionary dict = new LuceneDictionary(reader, FieldNames.FULLTEXT);
                                    log.debug("Starting spell checker index refresh");
                                    spellChecker.indexDictionary(dict);
                                    time = System.currentTimeMillis() - time;
                                    time = time / 1000;
                                    log.info("Spell checker index refreshed in: " + new Long(time) + " s.");
View Full Code Here

                        {
                           IndexReader reader = handler.getIndexReader();
                           try
                           {
                              long time = System.currentTimeMillis();
                              Dictionary dict = new LuceneDictionary(reader, FieldNames.FULLTEXT);
                              log.debug("Starting spell checker index refresh");
                              spellChecker.indexDictionary(dict);
                              time = System.currentTimeMillis() - time;
                              time = time / 1000;
                              log.info("Spell checker index refreshed in: " + new Long(time) + " s.");
View Full Code Here

        try {
            IndexReader reader = handler
              .getIndexReader();
            try {
          long time = System.currentTimeMillis();
          Dictionary dict = new LuceneDictionary(
            reader, FieldNames.FULLTEXT);
          log
            .debug("Starting spell checker index refresh");
          spellChecker.indexDictionary(dict);
          time = System.currentTimeMillis()
View Full Code Here

      Resource dir = _createSpellDirectory(id);
    try {
        File spellFile = FileWrapper.toFile(dir);
        spellDir = FSDirectory.getDirectory(spellFile);
        reader = _getReader(id,false);
        Dictionary dictionary = new LuceneDictionary(reader,"contents");
     
        SpellChecker spellChecker = new SpellChecker(spellDir);
        spellChecker.indexDictionary(dictionary);
     
      }
View Full Code Here

      writer.addDocument(doc);
    }
    writer.commit();
    writer.close();
    IndexReader ir = DirectoryReader.open(dir);
    Dictionary dictionary = new DocumentDictionary(ir, FIELD_NAME, WEIGHT_FIELD_NAME, PAYLOAD_FIELD_NAME);
    InputIterator inputIterator = dictionary.getEntryIterator();
    BytesRef f;
    while((f = inputIterator.next())!=null) {
      Document doc = docs.remove(f.utf8ToString());
      assertTrue(f.equals(new BytesRef(doc.get(FIELD_NAME))));
      IndexableField weightField = doc.getField(WEIGHT_FIELD_NAME);
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.spell.Dictionary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.