2011-05-13 63 views
2

我試圖掃描目錄中的所有pdf/doc文件。這工作正常,我可以掃描所有文件。如何使用Solr的FileListEntityProcessor在搜索結果中顯示文件名

我正在嘗試做的下一件事是也在搜索結果中接收文件的文件名。然而,文件名從來沒有出現。我嘗試了幾件事,但文檔對於如何做到這一點並不是很有幫助。

我使用Solr的分佈發現Solr的配置:Apache的Solr的-3.1.0 /例子/例子-DIH/Solr的/蒂卡/ conf目錄

這是我dataConfig:

<dataConfig> 
    <dataSource type="BinFileDataSource" name="bin"/> 
    <document> 
    <entity name="f" processor="FileListEntityProcessor" recursive="true" 
      rootEntity="false" dataSource="null" baseDir="C:/solrtestsmall" 
      fileName=".*\.(DOC)|(PDF)|(pdf)|(doc)" onError="skip"> 

     <entity name="tika-test" processor="TikaEntityProcessor" 
       url="${f.fileAbsolutePath}" format="text" dataSource="bin" 
       onError="skip"> 
     <field column="Author" name="author" meta="true"/> 
     <field column="title" name="title" meta="true"/> 
     <field column="text" name="text"/> 
     </entity> 

     <field column="fileName" name="fileName"/> 
    </entity> 
    </document> 
</dataConfig> 

我感興趣的是如何正確配置此方法,以及任何其他地方,我可以找到特定的文檔。

回答

3

您應該使用文件而不是文件名中

<field column="file" name="fileName"/> 

不要忘記將「文件名」添加到該領域部分schema.xml中。

<field name="fileName" type="string" indexed="true" stored="true" />