dse搜索apache uima集成

时间:2017-07-12 16:47:54

标签: solr datastax-enterprise uima datastax-startup

我在CentOS 7.3.1611(Core)上安装了DSE 5.1,solr 6.0.1。并且UIMA在eclipse中为我的注释器项目配置。

我正在关注Solr文档: https://wiki.apache.org/solr/Solr4UIMA

使用UIMA创建的项目有一个简单的注释器来获取人员名称,在UIMA的CAS Visual Debugger中已经正常工作。并且jar已经在solr lib目录中创建并复制(DSE_HOME / solr / lib),这里也是用于集成uima的solr的jar(SOLR_HOME / contrib / uima / lib,SOLR_HOME / contrib / uima / lucene-lib ,SOLR_HOME / dist / solr-uima-version)。

我在cassandra中创建的表是:

CREATE TABLE uima_solr.person_annotator (
    id int PRIMARY KEY,
    apellido text,
    nombre text,
    nombrecompleto text,
    solr_query text,
    uimaname set<text>

solr核心使用架构:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<schema name="autoSolrSchema" version="1.5">
  <types>
    <fieldType class="org.apache.solr.schema.TextField" name="TextField">
      <analyzer>
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>
    <fieldType class="org.apache.solr.schema.TrieIntField" name="TrieIntField"/>
  </types>
  <fields>
    <field indexed="true" multiValued="false" name="nombrecompleto" stored="true" type="TextField"/>
    <field indexed="true" multiValued="false" name="apellido" stored="true" type="TextField"/>
    <field indexed="true" multiValued="false" name="nombre" stored="true" type="TextField"/>
    <field docValues="true" indexed="true" multiValued="false" name="id" stored="true" type="TrieIntField"/>
    <field indexed="true" multiValued="false" name="all" stored="false" type="TextField"/>
    <field indexed="true" multiValued="true" name="uimaname" stored="true" type="TextField"/>
  </fields>
  <uniqueKey>id</uniqueKey>
  <defaultSearchField>all</defaultSearchField>
  <copyField source="nombrecompleto" dest="all"/>
  <copyField source="apellido" dest="all"/>
  <copyField source="nombre" dest="all"/>
</schema>

solr_config如下:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<config>
  <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
  <luceneMatchVersion>LUCENE_6_0_0</luceneMatchVersion>
  <dseTypeMappingVersion>2</dseTypeMappingVersion>
  <directoryFactory class="solr.StandardDirectoryFactory" name="DirectoryFactory"/>
  <indexConfig>
    <rt>false</rt>
    <useCompoundFile>false</useCompoundFile>
    <ramBufferSizeMB>512</ramBufferSizeMB>
    <mergeFactor>10</mergeFactor>
    <reopenReaders>true</reopenReaders>
    <deletionPolicy class="solr.SolrDeletionPolicy">
      <str name="maxCommitsToKeep">1</str>
      <str name="maxOptimizedCommitsToKeep">0</str>
    </deletionPolicy>
    <infoStream file="INFOSTREAM.txt">false</infoStream>
  </indexConfig>
  <jmx/>
  <updateHandler class="solr.DirectUpdateHandler2">
    <autoSoftCommit>
      <maxTime>10000</maxTime>
    </autoSoftCommit>
  </updateHandler>
  <query>
    <maxBooleanClauses>1024</maxBooleanClauses>
    <filterCache class="solr.SolrFilterCache" highWaterMarkMB="256" lowWaterMarkMB="128"/>
    <enableLazyFieldLoading>true</enableLazyFieldLoading>
    <useColdSearcher>true</useColdSearcher>
    <maxWarmingSearchers>16</maxWarmingSearchers>
  </query>
  <requestDispatcher handleSelect="true">
    <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000"/>
    <httpCaching never304="true"/>
  </requestDispatcher>
  <requestHandler class="solr.SearchHandler" default="true" name="search">
    <lst name="defaults">
      <int name="rows">10</int>
    </lst>
  </requestHandler>
  <requestHandler class="com.datastax.bdp.search.solr.handler.component.CqlSearchHandler" name="solr_query">
    <lst name="defaults">
      <int name="rows">10</int>
    </lst>
  </requestHandler>
  <!--<requestHandler class="solr.UpdateRequestHandler" name="/update"/>-->
  <requestHandler class="solr.UpdateRequestHandler" name="/update/csv" startup="lazy"/>
  <requestHandler class="solr.UpdateRequestHandler" name="/update/json" startup="lazy"/>
  <requestHandler class="solr.FieldAnalysisRequestHandler" name="/analysis/field" startup="lazy"/>
  <requestHandler class="solr.DocumentAnalysisRequestHandler" name="/analysis/document" startup="lazy"/>
  <requestHandler class="solr.admin.AdminHandlers" name="/admin/"/>
  <requestHandler class="solr.PingRequestHandler" name="/admin/ping">
    <lst name="invariants">
      <str name="qt">search</str>
      <str name="q">solrpingquery</str>
    </lst>
    <lst name="defaults">
      <str name="echoParams">all</str>
    </lst>
  </requestHandler>
  <requestHandler class="solr.DumpRequestHandler" name="/debug/dump">
    <lst name="defaults">
      <str name="echoParams">explicit</str>
      <str name="echoHandler">true</str>
    </lst>
  </requestHandler>
  <admin>
    <defaultQuery>*:*</defaultQuery>
  </admin>



  <updateRequestProcessorChain default="true" name="uima">
    <processor class="org.apache.solr.uima.processor.UIMAUpdateRequestProcessorFactory">
      <lst name="uimaConfig">
        <lst name="runtimeParameters"></lst>
        <!-- Under $SOLR_HOME/solr/example-->
        <str name="analysisEngine">desc/descPersonAnnotator.xml</str>
        <bool name="ignoreErrors">false</bool>
        <lst name="analyzeFields">
          <bool name="merge">false</bool>
          <arr name="fields">
            <str>nombrecompleto</str>
          </arr>
        </lst>
        <lst name="fieldMappings">
          <lst name="type">
            <str name="name">org.apache.uima.annotator.person</str>
            <lst name="mapping">
              <str name="feature">name</str>
              <str name="field">uimaname</str>
            </lst>
          </lst>
        </lst>
      </lst>
    </processor>
    <processor class="solr.LogUpdateProcessorFactory"/>
    <processor class="solr.RunUpdateProcessorFactory"/>
  </updateRequestProcessorChain>
  <requestHandler class="solr.UpdateRequestHandler" name="/update">
    <lst name="defaults">
      <str name="update.processor">uima</str>
    </lst>
  </requestHandler>


</config>

当我使用CQL插入数据时,数据已在Lucene中正确编制索引,搜索工作正常,但是uima注释器无法正常工作。此外,当我上传文件到solr trought Sol命令时,文档成功编制索引,搜索也可以在CQL中工作,但uima既不起作用。我检查了日志,但没有显示任何错误。

我在Solr Apache发行版(v6.0.1)中做了相同的过程,它按预期工作。

我没有看到DSE_HOME中的核心文件编辑文件是为了方便,我还没有在DSE搜索中成功实现UIMA集成,我在DSE搜索的核心配置中缺少什么?

1 个答案:

答案 0 :(得分:1)

通过不遵循Solr文档程序找到答案,而是使用DSE文档,特别是Update request processor and field transformer (FIT) [2017-07-17]。

可以在DSE here [2017-07-17]

中找到一个示例

上面链接的过程显示了索引时如何映射字段。通过创建一个适合UITA项目的jar到FIT项目并将类添加到solrconfig.xml

此过程允许使用Solr命令和带有solr_query的cql对添加的元数据进行搜索。