Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在ApacheSolr的schema.xml中定义字段名以仅获取文档文件的名称_Apache_Solarium_Cakephp 2.6_Solr5 - Fatal编程技术网

如何在ApacheSolr的schema.xml中定义字段名以仅获取文档文件的名称

如何在ApacheSolr的schema.xml中定义字段名以仅获取文档文件的名称,apache,solarium,cakephp-2.6,solr5,Apache,Solarium,Cakephp 2.6,Solr5,我开始在solr 5.3.1中工作,并通过以下方式运行solr server: D:\solr\solr-5.3.1\bin>solr start ; 然后我在独立模式下创建一个核心: D:\solr\solr-5.3.1\bin>solr create -c mycore 我需要从系统文件(word和pdf)编制索引,模式API没有文档的字段“name”,然后我使用curl添加此字段: curl -X POST -H 'Content-type:application/json

我开始在solr 5.3.1中工作,并通过以下方式运行solr server:

D:\solr\solr-5.3.1\bin>solr start ;
然后我在独立模式下创建一个核心:

D:\solr\solr-5.3.1\bin>solr create -c mycore
我需要从系统文件(word和pdf)编制索引,模式API没有文档的字段“name”,然后我使用curl添加此字段:

curl -X POST -H 'Content-type:application/json' --data-binary '{
  "add-field":{
     "name":"name",
     "type":"text_general",
     "stored":true,
     “indexed”:true }
}' http://localhost:8983/solr/mycore/schema
并使用windows SimplepostTools重新索引所有文档:

D:\solr\solr-5.3.1>java -classpath example\exampledocs\post.jar -Dauto=yes -Dc=mycore -Ddata=files -Drecursive=yes org.apache.solr.util.SimplePostTool D:\Lucene\document ;
但是,即使成功地添加了字段“name”,它也是空的;字段标题仅获取pdf文档的名称,而不获取msword(.doc和.docx)的名称

然后我选择使用techproducts示例编制索引,因为他不使用schema.xml API,然后我可以修改我的模式:

D:\solr\solr-5.3.1>solr –e techproducts
Techproducts返回所有文件的名称。xml索引

然后,我在solr_home example/techproducts/solr中创建了一个新的核心,并在这个名为demo的新核心中使用techproducts中的schema.xml(contient字段“name”)和solrConfig.xml。 当我为所有文档编制索引时,字段名存在,但对于所有已编制索引的文件,字段名仍然为空


我的问题是如何只获取每个文档的名称(msword和pdf),而不是像字段“id”或字段“ressource_name”那样的路径;我必须创建新的Typefield或以另一种方式存在。

这是一个Apache Solr而不是Solarium的问题。@NuMessiah我们可以将字段添加到slor服务器的action cakephp和Solarium中。