Examples of SpellChecker


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

        spellCheckerCache = CacheBuilder.newBuilder().build(
                new CacheLoader<String, SpellChecker>() {
                    @Override
                    public SpellChecker load(String field) throws Exception {
                        SpellChecker spellChecker = new SpellChecker(ramDirectoryCache.get(field));
                        IndexWriterConfig indexWriterConfig = new IndexWriterConfig(Version.LUCENE_44, new WhitespaceAnalyzer(Version.LUCENE_44));
                        spellChecker.indexDictionary(dictCache.getUnchecked(field), indexWriterConfig, false);
                        return spellChecker;
                    }
                }
        );
View Full Code Here

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

            if (ramDirectory != null) {
                ramDirectory.close();
                ramDirectoryCache.invalidate(field);
            }

            SpellChecker spellChecker = spellCheckerCache.getIfPresent(field);
            if (spellChecker != null) {
                spellCheckerCache.refresh(field);
                try {
                    spellChecker.close();
                } catch (IOException e) {
                    logger.error("Could not close spellchecker in indexshard [{}] for field [{}]", e, indexShard, field);
                }
            }
View Full Code Here

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

            dictCache.refresh(field);
        }

        try {
            for (String field : spellCheckerCache.asMap().keySet()) {
                SpellChecker oldSpellchecker = spellCheckerCache.getUnchecked(field);
                RAMDirectory oldRamDirectory = ramDirectoryCache.getUnchecked(field);
                ramDirectoryCache.refresh(field);
                spellCheckerCache.refresh(field);
                oldRamDirectory.close();
                oldSpellchecker.close();
            }
        } catch (IOException e ) {
            logger.error("Error refreshing spell checker cache [{}]", e, shardId);
        }
View Full Code Here

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

    if (_spellChecker == null) {
      String spellIndexDirectory = ERXProperties.stringForKey("er.examples.textsearchdemo.spellCheckIndexPath");
      File spellingDir = new File(spellIndexDirectory);
      try {
        Directory spellingDirectory = FSDirectory.open(spellingDir);
        _spellChecker = new SpellChecker(spellingDirectory);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return _spellChecker;
View Full Code Here

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

    if (_spellChecker == null) {
      String spellIndexDirectory = ERXProperties.stringForKey("er.examples.textsearchdemo.didYouMeanIndexPath");
      File spellingDir = new File(spellIndexDirectory);
      try {
        Directory spellingDirectory = FSDirectory.open(spellingDir);
        _spellChecker = new SpellChecker(spellingDirectory);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return _spellChecker;
View Full Code Here

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

         this.spellIndexDirectory = FSDirectory.getDirectory(path, new NativeFSLockFactory(path));
         if (IndexReader.indexExists(spellIndexDirectory))
         {
            this.lastRefresh = System.currentTimeMillis();
         }
         this.spellChecker = new SpellChecker(spellIndexDirectory);
         this.spellChecker.setAccuracy(0.55f);
         refreshSpellChecker();
      }
View Full Code Here

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

                  lastRefresh = System.currentTimeMillis();
               }
               return null;
            }
         });
         this.spellChecker = new SpellChecker(spellIndexDirectory);
         this.spellChecker.setAccuracy(minDistance);
         this.morePopular = morePopular;
         refreshSpellChecker();
      }
View Full Code Here

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

                  lastRefresh = System.currentTimeMillis();
               }
               return null;
            }
         });
         this.spellChecker = new SpellChecker(spellIndexDirectory);
         this.spellChecker.setAccuracy(minDistance);
         this.morePopular = morePopular;
         refreshSpellChecker();
      }
View Full Code Here

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

                  lastRefresh = System.currentTimeMillis();
               }
               return null;
            }
         });
         this.spellChecker = new SpellChecker(spellIndexDirectory);
         this.spellChecker.setAccuracy(minDistance);
         this.morePopular = morePopular;
         refreshSpellChecker();
      }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.core.query.lucene.SpellChecker

    *
    * @return the spell checker or <code>null</code> if none is configured or an error occurs.
    */
   public SpellChecker createSpellChecker(QueryHandler handler)
   {
      SpellChecker spCheck = null;
      if (getSpellCheckerClass() != null)
      {
         try
         {
            Class spellCheckerClass = Class.forName(getSpellCheckerClass(), true, this.getClass().getClassLoader());
            spCheck = (SpellChecker)spellCheckerClass.newInstance();
            spCheck.init(handler);
         }
         catch (Exception e)
         {
            log.warn("Exception initializing spell checker: " + getSpellCheckerClass(), e);
         }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.