You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by al...@apache.org on 2017/11/19 23:14:01 UTC
svn commit: r1815762 - in /ctakes/trunk:
ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/ae/UmlsToSnomedLuceneConsumerImpl.java
ctakes-utils/src/main/java/org/apache/ctakes/utils/wiki/WikiIndex.java
Author: alexz
Date: Sun Nov 19 23:14:01 2017
New Revision: 1815762
URL: http://svn.apache.org/viewvc?rev=1815762&view=rev
Log:
CTAKES-465: Fix deprecation for IndexReader
Modified:
ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/ae/UmlsToSnomedLuceneConsumerImpl.java
ctakes/trunk/ctakes-utils/src/main/java/org/apache/ctakes/utils/wiki/WikiIndex.java
Modified: ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/ae/UmlsToSnomedLuceneConsumerImpl.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/ae/UmlsToSnomedLuceneConsumerImpl.java?rev=1815762&r1=1815761&r2=1815762&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/ae/UmlsToSnomedLuceneConsumerImpl.java (original)
+++ ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/ae/UmlsToSnomedLuceneConsumerImpl.java Sun Nov 19 23:14:01 2017
@@ -24,6 +24,7 @@ import org.apache.ctakes.dictionary.look
import org.apache.ctakes.dictionary.lookup.MetaDataHit;
import org.apache.ctakes.dictionary.lookup.lucene.LuceneDictionaryImpl;
import org.apache.log4j.Logger;
+import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.store.FSDirectory;
@@ -91,7 +92,7 @@ public class UmlsToSnomedLuceneConsumerI
// For the sample dictionary, we use the following lucene index.
//indexPath = "lookup/snomed-like_codes_sample";
- indexReader = IndexReader.open( FSDirectory.open( indexDir ) );
+ indexReader = DirectoryReader.open( FSDirectory.open( indexDir ) );
IndexSearcher indexSearcher = new IndexSearcher( indexReader );
String lookupFieldName = props.getProperty( CUI_MAPPING_PRP_KEY );
Modified: ctakes/trunk/ctakes-utils/src/main/java/org/apache/ctakes/utils/wiki/WikiIndex.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-utils/src/main/java/org/apache/ctakes/utils/wiki/WikiIndex.java?rev=1815762&r1=1815761&r2=1815762&view=diff
==============================================================================
--- ctakes/trunk/ctakes-utils/src/main/java/org/apache/ctakes/utils/wiki/WikiIndex.java (original)
+++ ctakes/trunk/ctakes-utils/src/main/java/org/apache/ctakes/utils/wiki/WikiIndex.java Sun Nov 19 23:14:01 2017
@@ -28,11 +28,7 @@ import org.apache.ctakes.utils.struct.Co
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.index.Terms;
-import org.apache.lucene.index.TermsEnum;
+import org.apache.lucene.index.*;
import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.search.IndexSearcher;
@@ -53,6 +49,7 @@ import org.apache.lucene.util.Version;
public class WikiIndex {
public static int defaultMaxHits = 10;
+ // TODO: remove dependency of a hardcoded path
public static String defaultIndexPath = "/home/dima/i2b2/wiki-index/index_nometa";
public static String defaultSearchField = "text";
@@ -89,7 +86,7 @@ public class WikiIndex {
public void initialize() throws CorruptIndexException, IOException {
- indexReader = IndexReader.open(FSDirectory.open(new File(indexPath)));
+ indexReader = DirectoryReader.open(FSDirectory.open(new File(indexPath)));
numDocs = indexReader.numDocs();
indexSearcher = new IndexSearcher(indexReader);
standardAnalyzer = new StandardAnalyzer(Version.LUCENE_40);