Package org.apache.lucene.analysis.core

Examples of org.apache.lucene.analysis.core.SimpleAnalyzer


    {
        indexDir = newTempDir(LifecycleScope.SUITE);
        directory = FSDirectory.open(indexDir);
        closeAfterSuite(directory);
        LuceneIndexUtils.createAndPopulateIndex(directory,
            new SimpleAnalyzer(Version.LUCENE_CURRENT));
    }
View Full Code Here


    @SuppressWarnings("deprecation")
    @BeforeClass
    public static void prepareIndex() throws Exception
    {
        directory = new RAMDirectory();
        analyzer = new SimpleAnalyzer(Version.LUCENE_CURRENT);
        LuceneIndexUtils.createAndPopulateIndex(directory, analyzer);
    }
View Full Code Here

   * @throws SearchException in case of lock acquisition timeouts, IOException, or if a corrupt index is found
   */
  public static void initializeIndexIfNeeded(Directory directory) {
    //version doesn't really matter as we won't use the Analyzer
    Version version = Environment.DEFAULT_LUCENE_MATCH_VERSION;
    SimpleAnalyzer analyzer = new SimpleAnalyzer( version );
    try {
      if ( ! DirectoryReader.indexExists( directory ) ) {
        IndexWriterConfig iwriterConfig = new IndexWriterConfig( version, analyzer ).setOpenMode( OpenMode.CREATE );
        IndexWriter iw = new IndexWriter( directory, iwriterConfig );
        iw.close();
      }
    }
    catch (IOException e) {
      throw new SearchException( "Could not initialize index", e );
    }
    finally {
      analyzer.close();
    }
  }
View Full Code Here

    private final SimpleAnalyzer simpleAnalyzer;

    @Inject
    public SimpleAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
        super(index, indexSettings, name, settings);
        this.simpleAnalyzer = new SimpleAnalyzer();
        this.simpleAnalyzer.setVersion(version);
    }
View Full Code Here

   * @throws SearchException in case of lock acquisition timeouts, IOException, or if a corrupt index is found
   */
  public static void initializeIndexIfNeeded(Directory directory) {
    //version doesn't really matter as we won't use the Analyzer
    Version version = Environment.DEFAULT_LUCENE_MATCH_VERSION;
    SimpleAnalyzer analyzer = new SimpleAnalyzer( version );
    try {
      if ( ! DirectoryReader.indexExists( directory ) ) {
        IndexWriterConfig iwriterConfig = new IndexWriterConfig( version, analyzer ).setOpenMode( OpenMode.CREATE );
        IndexWriter iw = new IndexWriter( directory, iwriterConfig );
        iw.close();
      }
    }
    catch (IOException e) {
      throw new SearchException( "Could not initialize index", e );
    }
    finally {
      analyzer.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.analysis.core.SimpleAnalyzer

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.