You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2011/09/26 14:49:48 UTC
svn commit: r1175842 - in /incubator/opennlp/sandbox/corpus-server/src/main:
java/org/apache/opennlp/corpus_server/search/
resources/org/apache/opennlp/corpus_server/search/
Author: joern
Date: Mon Sep 26 12:49:48 2011
New Revision: 1175842
URL: http://svn.apache.org/viewvc?rev=1175842&view=rev
Log:
OPENNLP-299 Fixed handling of index mapping file.
Added:
incubator/opennlp/sandbox/corpus-server/src/main/resources/org/apache/opennlp/corpus_server/search/LuceneIndexer.xml (with props)
Removed:
incubator/opennlp/sandbox/corpus-server/src/main/resources/org/apache/opennlp/corpus_server/search/wikinews.xml
Modified:
incubator/opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/search/LuceneSearchService.java
incubator/opennlp/sandbox/corpus-server/src/main/resources/org/apache/opennlp/corpus_server/search/TypeSystem.xml
Modified: incubator/opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/search/LuceneSearchService.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/search/LuceneSearchService.java?rev=1175842&r1=1175841&r2=1175842&view=diff
==============================================================================
--- incubator/opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/search/LuceneSearchService.java (original)
+++ incubator/opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/search/LuceneSearchService.java Mon Sep 26 12:49:48 2011
@@ -25,11 +25,9 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -83,7 +81,8 @@ public class LuceneSearchService impleme
// Set the index mapping file for this corpus in the analysis engine descriptor
CorpusStore corpusStore = CorpusServer.getInstance().getStore().getCorpus(corpusId);
- XMLInputSource in = new XMLInputSource(new ByteArrayInputStream(corpusStore.getIndexMapping()), new File(""));
+ XMLInputSource in = new XMLInputSource(LuceneSearchService.class.getResourceAsStream(
+ "/org/apache/opennlp/corpus_server/search/LuceneIndexer.xml"), new File(""));
try {
AnalysisEngineDescription specifier;
@@ -93,13 +92,11 @@ public class LuceneSearchService impleme
File mappingTmpFile = File.createTempFile("lucas-mapping", corpusId + ".xml");
mappingTmpFile.deleteOnExit();
-
- InputStream mappingFileIn = null;
+
+ InputStream mappingFileIn = new ByteArrayInputStream(corpusStore.getIndexMapping());
OutputStream mappingTmpOut = null;
try {
- mappingFileIn = LuceneSearchService.class.getResourceAsStream(
- "/org/apache/opennlp/corpus_server/search/" + corpusId + ".xml");
mappingTmpOut = new FileOutputStream(mappingTmpFile);
byte buffer[] = new byte[1024];
@@ -128,7 +125,6 @@ public class LuceneSearchService impleme
}
}
-
specifier.getAnalysisEngineMetaData().
getConfigurationParameterSettings().setParameterValue("mappingFile",
mappingTmpFile.getAbsolutePath());
Added: incubator/opennlp/sandbox/corpus-server/src/main/resources/org/apache/opennlp/corpus_server/search/LuceneIndexer.xml
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/corpus-server/src/main/resources/org/apache/opennlp/corpus_server/search/LuceneIndexer.xml?rev=1175842&view=auto
==============================================================================
--- incubator/opennlp/sandbox/corpus-server/src/main/resources/org/apache/opennlp/corpus_server/search/LuceneIndexer.xml (added)
+++ incubator/opennlp/sandbox/corpus-server/src/main/resources/org/apache/opennlp/corpus_server/search/LuceneIndexer.xml Mon Sep 26 12:49:48 2011
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <primitive>true</primitive>
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <annotatorImplementationName>org.apache.opennlp.corpus_server.search.LuceneIndexer</annotatorImplementationName>
+ <processingResourceMetaData>
+ <name>LuceneIndexer</name>
+ <description/>
+ <version>0.6</version>
+ <vendor>apache</vendor>
+ <configurationParameters>
+ <configurationParameter>
+ <name>mappingFile</name>
+ <description>path to the mapping file</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>mappingFile</name>
+ <value>
+ <string>file-will-be-set-by-ae-integration</string>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+ <typeSystemDescription/>
+ <typePriorities/>
+ <fsIndexCollection/>
+ <capabilities>
+ <capability>
+ <inputs/>
+ <outputs/>
+ <languagesSupported/>
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>false</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </processingResourceMetaData>
+
+ <resourceManagerConfiguration>
+ <externalResources>
+ <externalResource>
+ <name>LucasIndexWriterProvider</name>
+ <description>Provides a index writer instance.</description>
+ <fileResourceSpecifier>
+ <fileUrl>file:src/test/resources/IndexWriter.properties</fileUrl>
+ </fileResourceSpecifier>
+ <implementationName>org.apache.uima.lucas.indexer.IndexWriterProviderImpl</implementationName>
+ </externalResource>
+ </externalResources>
+ <externalResourceBindings>
+ <externalResourceBinding>
+ <key>indexWriterProvider</key>
+ <resourceName>LucasIndexWriterProvider</resourceName>
+ </externalResourceBinding>
+ </externalResourceBindings>
+ </resourceManagerConfiguration>
+
+</analysisEngineDescription>
Propchange: incubator/opennlp/sandbox/corpus-server/src/main/resources/org/apache/opennlp/corpus_server/search/LuceneIndexer.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/opennlp/sandbox/corpus-server/src/main/resources/org/apache/opennlp/corpus_server/search/TypeSystem.xml
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/corpus-server/src/main/resources/org/apache/opennlp/corpus_server/search/TypeSystem.xml?rev=1175842&r1=1175841&r2=1175842&view=diff
==============================================================================
--- incubator/opennlp/sandbox/corpus-server/src/main/resources/org/apache/opennlp/corpus_server/search/TypeSystem.xml (original)
+++ incubator/opennlp/sandbox/corpus-server/src/main/resources/org/apache/opennlp/corpus_server/search/TypeSystem.xml Mon Sep 26 12:49:48 2011
@@ -9,7 +9,7 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,