Package org.apache.lucene.search.spell

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


   */
  @Override
  protected final void indexCR(final IndexLocation indexLocation, final CRConfigUtil config) throws CRException {

    log.debug("Starting to clear index.");
    CustomSpellChecker spellchecker = didyoumean.getSpellchecker();
    try {
      spellchecker.clearIndex();
      didyoumean.getDidyoumeanLocation().resetIndexJobCreationTimes();
    } catch (IOException e) {
      log.error("Could not clear index", e);
    }
    log.debug("Finished clearing index.");
View Full Code Here


    UseCase ucReIndex = MonitorFactory.startUseCase("reIndex()");
    // build a dictionary (from the spell package)
    log.debug("Starting to reindex didyoumean index.");
    IndexAccessor sourceAccessor = didyoumean.getSourceLocation().getAccessor();
    IndexReader sourceReader = sourceAccessor.getReader(false);
    CustomSpellChecker spellchecker = didyoumean.getSpellchecker();
    Collection<String> fields = null;

    if (didyoumean.isAll()) {
      fields = sourceReader.getFieldNames(IndexReader.FieldOption.ALL);
    } else {
      fields = didyoumean.getDym_fields();
    }
    try {
      for (String fieldname : fields) {
        LuceneDictionary dict = new LuceneDictionary(sourceReader, fieldname);
        spellchecker.indexDictionary(dict);
      }
    } finally {
      if (sourceAccessor != null && sourceReader != null) {
        sourceAccessor.release(sourceReader, false);
      }
View Full Code Here

      dym_fields = new ArrayList<String>(1);
      dym_fields.add(this.didyoumeanfield);
    }

    try {
      spellchecker = new CustomSpellChecker(didyoumeanLocation, minDScore, minDFreq);
    } catch (IOException e1) {
      log.error("Could not create didyoumean index.", e1);
      if (spellchecker != null) {
        spellchecker.close();
      }
View Full Code Here

    if (subscribeToIndexFinished) {
      EventManager.getInstance().register(this);
    }

    try {
      spellchecker = new CustomSpellChecker(didyoumeanLocation, minDScore, minDFreq);
    } catch (IOException e) {
      log.debug("Could not create Spellchecker", e);
      // without spellchecker the extension won't work - stop it
      this.stop();
    }
View Full Code Here

TOP

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

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.