org.apache.lucene.analysis.Analyzer.close()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.apache.lucene.analysis.Analyzer.close()方法的一些代码示例,展示了Analyzer.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Analyzer.close()方法的具体详情如下:
包路径:org.apache.lucene.analysis.Analyzer
类名称:Analyzer
方法名:close

Analyzer.close介绍

[英]Frees persistent resources used by this Analyzer
[中]释放此分析器使用的持久性资源

代码示例

代码示例来源:origin: jeremylong/DependencyCheck

/**
 * Closes the CPE Index.
 */
@Override
public synchronized void close() {
  final int count = INSTANCE.usageCount.get() - 1;
  if (count <= 0) {
    INSTANCE.usageCount.set(0);
    if (searchingAnalyzer != null) {
      searchingAnalyzer.close();
      searchingAnalyzer = null;
    }
    if (indexReader != null) {
      try {
        indexReader.close();
      } catch (IOException ex) {
        LOGGER.trace("", ex);
      }
      indexReader = null;
    }
    queryParser = null;
    indexSearcher = null;
    if (index != null) {
      index.close();
      index = null;
    }
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
  public void close() {
    super.close();
    if (scope == AnalyzerScope.INDEX) {
      analyzer.close();
    }
  }
}

代码示例来源:origin: org.opencms/opencms-core

/**
 * Closes the analyzer.<p>
 */
public void closeAnalyzer() {
  if (m_analyzer != null) {
    m_analyzer.close();
  }
}

代码示例来源:origin: net.bolbat/bb-kit

/**
 * Close {@link Analyzer} instance.
 * 
 * @param analyzer
 *            {@link Analyzer}
 */
public static void close(final Analyzer analyzer) {
  if (analyzer != null)
    analyzer.close();
}

代码示例来源:origin: org.elasticsearch/elasticsearch

analyzer.close();

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
  public void close() {
    super.close();
    if (scope == AnalyzerScope.INDEX) {
      analyzer.close();
    }
  }
}

代码示例来源:origin: org.codelibs/elasticsearch-querybuilders

@Override
  public void close() {
    super.close();
    if (scope == AnalyzerScope.INDEX) {
      analyzer.close();
    }
  }
}

代码示例来源:origin: apache/servicemix-bundles

@Override
  public void close() {
    super.close();
    if (scope == AnalyzerScope.INDEX) {
      analyzer.close();
    }
  }
}

代码示例来源:origin: kiegroup/appformer

@Override
public void dispose() {
  indexEngine.dispose();
  indexManager.dispose();
  metaModelStore.dispose();
  analyzer.close();
}

代码示例来源:origin: synhershko/HebMorph

@After
public void tearDown() throws Exception {
  if (analyzer != null)
    analyzer.close();
}

代码示例来源:origin: rdelbru/SIREn

@Override
@After
public void tearDown()
throws Exception {
 super.tearDown();
 _a.close();
}

代码示例来源:origin: mrgambal/elasticsearch-ukrainian-lemmatizer

public void testSpecialCharsTokenStream() throws Exception {
  Analyzer a = new UkrainianAnalyzer(Lucene.VERSION);
  assertAnalyzesTo(a, "м'яса м'я\u0301са м\u02BCяса м\u2019яса м\u2018яса м`яса",
      new String[]{"м'ясо", "м'ясо", "м'ясо", "м'ясо", "м'ясо", "м'ясо"});
  a.close();
}

代码示例来源:origin: mrgambal/elasticsearch-ukrainian-lemmatizer

public void testCapsTokenStream() throws Exception {
  Analyzer a = new UkrainianAnalyzer(Lucene.VERSION);
  assertAnalyzesTo(a, "Цих Чайковського і Ґете.",
      new String[]{"Чайковське", "Чайковський", "Гете"});
  a.close();
}

代码示例来源:origin: mrgambal/elasticsearch-ukrainian-lemmatizer

public void testSampleSentence() throws Exception {
  Analyzer a = new UkrainianAnalyzer(Lucene.VERSION);
  assertAnalyzesTo(a, "Це — проект генерування словника з тегами частин мови для української мови.",
      new String[]{"проект", "генерування", "словник", "тег", "частина", "мова", "українська", "український", "Українська", "мова"});
  a.close();
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testParentPathSearchingTokenization() throws Exception {
  try {
    TokenStream ts = parentPathSearchingAnalyzer.tokenStream("text", new StringReader("/jcr:a/b/jcr:c"));
    assertTokenStreamContents(ts, new String[]{"/jcr:a/b"});
  } finally {
    parentPathSearchingAnalyzer.close();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testDirectChildrenPathSearchingTokenization() throws Exception {
  try {
    TokenStream ts = directChildrenPathSearchingAnalyzer.tokenStream("text", new StringReader("/jcr:a/jcr:b"));
    assertTokenStreamContents(ts, new String[]{"/jcr:a/jcr:b"});
  } finally {
    directChildrenPathSearchingAnalyzer.close();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testAllChildrenSearchingTokenization() throws Exception {
  try {
    TokenStream ts = allChildrenPathSearchingAnalyzer.tokenStream("text", new StringReader("/jcr:a/jcr:b/jcr:c"));
    assertTokenStreamContents(ts, new String[]{"/jcr:a/jcr:b/jcr:c"});
  } finally {
    allChildrenPathSearchingAnalyzer.close();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testExactPathIndexingTokenizationAndSearch() throws Exception {
  try {
    TokenStream ts = exactPathAnalyzer.tokenStream("text", new StringReader("/jcr:a/jcr:b/c"));
    assertTokenStreamContents(ts, new String[]{"/jcr:a/jcr:b/c"});
  } finally {
    exactPathAnalyzer.close();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testParentPathIndexingTokenization() throws Exception {
  try {
    TokenStream ts = parentPathIndexingAnalyzer.tokenStream("text", new StringReader("/a/b"));
    assertTokenStreamContents(ts, new String[]{"/a/b"});
  } finally {
    parentPathIndexingAnalyzer.close();
  }
}

代码示例来源:origin: mrgambal/elasticsearch-ukrainian-lemmatizer

/**
   * blast some random strings through the analyzer
   */
  public void testRandomStrings() throws Exception {
    Analyzer analyzer = new UkrainianAnalyzer(Lucene.VERSION);
    checkRandomData(random(), analyzer, 1000 * RANDOM_MULTIPLIER);
    analyzer.close();
  }
}

相关文章