• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SnowballAnalyzer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.lucene.analysis.snowball.SnowballAnalyzer的典型用法代码示例。如果您正苦于以下问题:Java SnowballAnalyzer类的具体用法?Java SnowballAnalyzer怎么用?Java SnowballAnalyzer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SnowballAnalyzer类属于org.apache.lucene.analysis.snowball包,在下文中一共展示了SnowballAnalyzer类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: resetSearchers

import org.apache.lucene.analysis.snowball.SnowballAnalyzer; //导入依赖的package包/类
private void resetSearchers() throws IOException {
  // New analyzers and readers since there is new data
  Analyzer fullAnalyzer = new StandardAnalyzer();
  LuceneIndexerSearch newFullSearcher = new LuceneIndexerSearch();
  newFullSearcher.setup(fullIndex, fullAnalyzer, Constants.INDEXER_FULL);
  fullSearcher = newFullSearcher;

  // New analyzers and readers since there is new data
  Analyzer directoryAnalyzer = new SnowballAnalyzer("English");
  LuceneIndexerSearch newDirectorySearcher = new LuceneIndexerSearch();
  newDirectorySearcher.setup(directoryIndex, directoryAnalyzer, Constants.INDEXER_DIRECTORY);
  directorySearcher = newDirectorySearcher;
  if (directoryIndexInitialized) {
    directorySearcherReady = true;
  }
}
 
开发者ID:Concursive,项目名称:concourseconnect-community,代码行数:17,代码来源:LuceneIndexer.java


示例2: setup

import org.apache.lucene.analysis.snowball.SnowballAnalyzer; //导入依赖的package包/类
/**
 * Sets up any Lucene Indexer classes
 *
 * @param context
 * @return
 * @throws Exception
 */
public boolean setup(IndexerContext context) throws Exception {
  // Make sure the complex queries can use more than the default clause count
  BooleanQuery.setMaxClauseCount(Integer.MAX_VALUE);

  // Setup the Indexes so they are in a state in which they can immediately
  // be accessed
  ApplicationPrefs prefs = context.getApplicationPrefs();
  {
    // Establish the full directory
    LOG.info("Starting Lucene disk index");
    File path = new File(prefs.get("FILELIBRARY") + Constants.FULL_INDEX);
    boolean create = !path.exists();
    fullIndex = FSDirectory.getDirectory(prefs.get("FILELIBRARY") + Constants.FULL_INDEX);
    if (create) {
      LOG.warn("Lucene index not found, creating new index: " + path.getPath());
      Analyzer fullAnalyzer = new StandardAnalyzer();
      fullWriter = new IndexWriter(fullIndex, fullAnalyzer, true);
      fullWriter.close();
    }
  }

  {
    // Load up the ram directory
    LOG.info("Creating Lucene RAM index...");
    // Create the Ram Directory
    directoryIndex = new RAMDirectory();
    Analyzer directoryAnalyzer = new SnowballAnalyzer("English");
    directoryWriter = new IndexWriter(directoryIndex, directoryAnalyzer, true);
    directoryWriter.close();
    LOG.info("Initialization of RAM index complete...");
  }
  // Search using the updated index
  resetSearchers();
  return true;
}
 
开发者ID:Concursive,项目名称:concourseconnect-community,代码行数:43,代码来源:LuceneIndexer.java


示例3: setUp

import org.apache.lucene.analysis.snowball.SnowballAnalyzer; //导入依赖的package包/类
protected void setUp() throws Exception {
  // Snowball
  snowballAnalyzer = new SnowballAnalyzer("English");
  snowballIndex = new RAMDirectory();
  snowballWriter = new IndexWriter(snowballIndex, snowballAnalyzer, true);
  // Standard
  standardAnalyzer = new StandardAnalyzer();
  standardIndex = new RAMDirectory();
  standardWriter = new IndexWriter(standardIndex, standardAnalyzer, true);
}
 
开发者ID:Concursive,项目名称:concourseconnect-community,代码行数:11,代码来源:AbstractLuceneTest.java


示例4: SpanishAnalyzer

import org.apache.lucene.analysis.snowball.SnowballAnalyzer; //导入依赖的package包/类
/**
 * Creates new instance of SpanishAnalyzer
 */
public SpanishAnalyzer() {
	analyzer = new SnowballAnalyzer("Spanish", SPANISH_STOP_WORDS);
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:7,代码来源:SpanishAnalyzer.java


示例5: DanishAnalyzer

import org.apache.lucene.analysis.snowball.SnowballAnalyzer; //导入依赖的package包/类
/**
 * Creates new instance of SpanishAnalyzer
 */
public DanishAnalyzer() {
    analyzer = new SnowballAnalyzer("Danish", STOP_WORDS);
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:7,代码来源:DanishAnalyzer.java


示例6: PortugueseAnalyzer

import org.apache.lucene.analysis.snowball.SnowballAnalyzer; //导入依赖的package包/类
/**
 * Creates new instance of SpanishAnalyzer
 */
public PortugueseAnalyzer() {
	analyzer = new SnowballAnalyzer("Portuguese", PORTUGUESE_STOP_WORDS);
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:7,代码来源:PortugueseAnalyzer.java


示例7: ItalianAnalyzer

import org.apache.lucene.analysis.snowball.SnowballAnalyzer; //导入依赖的package包/类
/**
 * Creates new instance of SpanishAnalyzer
 */
public ItalianAnalyzer() {
	analyzer = new SnowballAnalyzer("Italian", STOP_WORDS);
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:7,代码来源:ItalianAnalyzer.java


示例8: NorwegianAnalyzer

import org.apache.lucene.analysis.snowball.SnowballAnalyzer; //导入依赖的package包/类
/**
 * Creates new instance of SpanishAnalyzer
 */
public NorwegianAnalyzer() {
	analyzer = new SnowballAnalyzer("Norwegian", NORWEGIAN_STOP_WORDS);
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:7,代码来源:NorwegianAnalyzer.java


示例9: reindexAllData

import org.apache.lucene.analysis.snowball.SnowballAnalyzer; //导入依赖的package包/类
public boolean reindexAllData(IndexerContext context, Connection db) throws Exception {
    writeLock.lock();
    try {
      if (context.getIndexType() == Constants.INDEXER_FULL) {
        // Erase the full index
        LOG.info("Reloading the full index...");
        fullWriter = new IndexWriter(fullIndex, new StandardAnalyzer(), true);
        // Reindex all data
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.profile.dao.ProjectIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.blog.dao.BlogPostIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.wiki.dao.WikiIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.discussion.dao.ForumIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.discussion.dao.TopicIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.discussion.dao.ReplyIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.documents.dao.FileItemIndexer")).add(this, db, context);
//        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.lists.dao.TaskCategoryIndexer")).add(this, db, context);
//        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.lists.dao.TaskIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.issues.dao.TicketIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.plans.dao.RequirementIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.plans.dao.AssignmentFolderIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.plans.dao.AssignmentIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.plans.dao.AssignmentNoteIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.promotions.dao.AdIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.classifieds.dao.ClassifiedIndexer")).add(this, db, context);
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.reviews.dao.ProjectRatingIndexer")).add(this, db, context);
        // Optimize the index
        fullWriter.flush();
        fullWriter.optimize();
        fullWriter.close();
        // Update the searchers
        resetSearchers();
        return true;
      } else if (context.getIndexType() == Constants.INDEXER_DIRECTORY) {
        // Erase the directory index
        LOG.info("Reloading the directory index...");
        directoryWriter = new IndexWriter(directoryIndex, new SnowballAnalyzer("English"), true);
        // Just the project data belongs in the directory index
        ((Indexer) getObjectIndexer("com.concursive.connect.web.modules.profile.dao.ProjectIndexer")).add(this, db, context);
        // Optimize the index
        directoryWriter.flush();
        directoryWriter.optimize();
        directoryWriter.close();
        // Update the searchers
        resetSearchers();
        return true;
      }
    } catch (Exception e) {
      LOG.error("Erase index error", e);
    } finally {
      writeLock.unlock();
    }
    return false;
  }
 
开发者ID:Concursive,项目名称:concourseconnect-community,代码行数:54,代码来源:LuceneIndexer.java


示例10: testEnglish

import org.apache.lucene.analysis.snowball.SnowballAnalyzer; //导入依赖的package包/类
public void testEnglish() throws Exception {
  Analyzer analyzer = new SnowballAnalyzer(Version.LUCENE_41, "English");
  AnalyzerUtils.assertAnalyzesTo(analyzer,
                                 "stemming algorithms",
                                 new String[] {"stem", "algorithm"});
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:7,代码来源:SnowballTest.java


示例11: testSpanish

import org.apache.lucene.analysis.snowball.SnowballAnalyzer; //导入依赖的package包/类
public void testSpanish() throws Exception {
  Analyzer analyzer = new SnowballAnalyzer(Version.LUCENE_41, "Spanish");
  AnalyzerUtils.assertAnalyzesTo(analyzer,
                                 "algoritmos",
                                 new String[] {"algoritm"});
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:7,代码来源:SnowballTest.java



注:本文中的org.apache.lucene.analysis.snowball.SnowballAnalyzer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MediaInfo类代码示例发布时间:2022-05-23
下一篇:
Java Selection类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap