2011-11-02 59 views
1

我正在尋找配置XsltUpdateRequestHandler的簡單示例。如何配置XsltUpdateRequestHandler

在3.4.0 Solr的配置是最小的:

<!-- XSLT Update Request Handler 
    Transforms incoming XML with stylesheet identified by tr= 
--> 
<requestHandler name="/update/xslt" 
       startup="lazy" 
       class="solr.XsltUpdateRequestHandler" /> 

而且SOLR wiki頁面幾乎是不存在的( 「TODO:寫一個更好的文檔」):

http://wiki.apache.org/solr/XsltUpdateRequestHandler

我想我真的很想知道如何指向一個特定的XSL文件,因爲我發現「用tr =標識的樣式錶轉換傳入的XML」有點神祕。

回答

2

您可以簡單地將一個XSL樣式表添加到solr/conf/xslt目錄。

然後,您可以使用XsltUpdateRequestHandler,並在索引文檔時指定該樣式表。

例如:

curl "http://localhost:8983/solr/update/xslt?commit=true&tr=rss2solr.xsl" -H "Content-Type: text/xml" --data-binary @blogrss.xml 

有關詳細信息,一個nice article詳細解釋。 (免費下載)

+0

謝謝,清除了我的東西! – Kevin

+0

對於'nice'文章+1已經試圖找出如何最好地更新我的結構化XML文件 – lightonphiri