<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>solr.xml &#8211; 記下來</title>
	<atom:link href="https://noter.tw/tag/solr-xml/feed/" rel="self" type="application/rss+xml" />
	<link>https://noter.tw</link>
	<description>一路上踩到的坑、遇到的問題，一點一滴記下來，希望能幫助到需要的人~</description>
	<lastBuildDate>Sat, 07 Nov 2020 15:17:40 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.3</generator>

<image>
	<url>https://noter.tw/wp-content/uploads/cropped-old-1130742_1920-1-32x32.jpg</url>
	<title>solr.xml &#8211; 記下來</title>
	<link>https://noter.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Solr 教學 (3) &#8211; 以 Remote Address Filter 限制存取</title>
		<link>https://noter.tw/3094/solr-%e6%95%99%e5%ad%b8-3-%e4%bb%a5-remote-address-filter-%e9%99%90%e5%88%b6%e5%ad%98%e5%8f%96/</link>
					<comments>https://noter.tw/3094/solr-%e6%95%99%e5%ad%b8-3-%e4%bb%a5-remote-address-filter-%e9%99%90%e5%88%b6%e5%ad%98%e5%8f%96/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Mon, 14 Oct 2013 15:32:54 +0000</pubDate>
				<category><![CDATA[Web Server]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Remote Address Filter]]></category>
		<category><![CDATA[限制存取]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[cloudflare]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[web.xml]]></category>
		<category><![CDATA[solr]]></category>
		<category><![CDATA[solr.xml]]></category>
		<category><![CDATA[Catalina]]></category>
		<category><![CDATA[container]]></category>
		<category><![CDATA[filter]]></category>
		<guid isPermaLink="false">http://wazai.net/?p=3094</guid>

					<description><![CDATA[<p>前面&#160;Solr 教學 (1) – 安裝篇、Solr 教學 (2) – tomcat 7 以帳號密碼限制存取頁面 講解了 Solr 安裝方式以及頁面安全性設定，這篇文章要記錄透過 tomcat&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/3094/solr-%e6%95%99%e5%ad%b8-3-%e4%bb%a5-remote-address-filter-%e9%99%90%e5%88%b6%e5%ad%98%e5%8f%96/" data-wpel-link="internal">Solr 教學 (3) &#8211; 以 Remote Address Filter 限制存取</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>前面&nbsp;<a href="https://noter.tw/3084/solr-%e6%95%99%e5%ad%b8-1-%e5%ae%89%e8%a3%9d%e7%af%87/" target="_blank" rel="noopener noreferrer" data-wpel-link="internal">Solr 教學 (1) – 安裝篇</a>、<a href="https://noter.tw/3082/solr-%e6%95%99%e5%ad%b8-2-tomcat-7-%e4%bb%a5%e5%b8%b3%e8%99%9f%e5%af%86%e7%a2%bc%e9%99%90%e5%88%b6%e5%ad%98%e5%8f%96%e9%a0%81%e9%9d%a2/" target="_blank" rel="noopener noreferrer" data-wpel-link="internal">Solr 教學 (2) – tomcat 7 以帳號密碼限制存取頁面</a> 講解了 Solr 安裝方式以及頁面安全性設定，這篇文章要記錄透過 tomcat 7 內建的 Remote Address Filter 來設定允許連線 IP 的白名單。<br><span id="more-3094"></span>這個方法非常簡單，不過要注意的是 tomcat 版本不同會有不同的設定方法，這邊小蛙的環境是 Ubuntu 13.04 64bit + Solr 4.5.0 + tomcat 7，以下的方法僅適用於 tomcat 7 這個版本！</p>
<p>在測試這個功能的時候發生一個小插曲，以往設定完馬上就可以用了，這次測試時不管怎麼做都會出現 403 Forbidden 的錯誤，簡直是晴天霹靂，完全摸不著頭緒，已經設定好小蛙自己使用的 IP，還是一樣 403，最扯的是 127.0.0.1 本機測試也還是一樣的情況，在資訊這行經常會遇到靈異現象，可能要買一包綠色乖乖才可以，不過 VPS 主機在美國要怎麼辦呢 &#8230;</p>
<p>後來 &#8230; 突然想到一件事情，小蛙的網站有使用 <a href="https://www.cloudflare.com/" target="_blank" rel="noopener noreferrer nofollow external" data-wpel-link="external" class="wpel-icon-right">CloudFlare<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 這個服務來加快網頁速度，CloudFlare 會根據使用者的設定，比如原本的 http://wazai.net/ 假設連結到小蛙的 IP (1.2.3.4)，這個 1.2.3.4 的 IP 是在美國紐約，現在有一個日本來的使用者連結了 http://wazai.net，此刻 CloudFlare 發現日本這邊也有一個 CloudFlare 伺服器，就會將日本的使用者連結到日本的 CloudFlare 伺服器以加快網站速度。</p>
<p>就在這個 moment，真正連到小蛙伺服器的 IP 就變成 CloudFlare 日本伺服器的 IP，而不是真正日本使用者的 IP，當然這邊 CloudFlare 也有提供自訂的 Header 可以取得原始日本使用者的 IP。</p>
<p>到這邊大概懂了 &#8230; 竟然被那麼奇怪的問題卡了那麼久 &#8230; 就是小蛙在測試的時候，也是連結 http://domain:8080/solr ，但真正收到的 IP 卻不是小蛙自己本身的 IP，而是接近小蛙位置的 CloudFlare Server IP，就連在本機 127.0.0.1 的時候也是一樣的狀況 &#8230; CloudFlare 為了避免這個問題，可以在網站上設定可以直接連接的 Domain，例如：domain 透過 CloudFlare，額外新增設定 nocf.domain 來避免使用 CloudFlare。</p>
<p>上教學！有兩種設定方式，一種是 <a href="http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#Remote_Address_Filter" target="_blank" rel="noopener noreferrer nofollow external" data-wpel-link="external" class="wpel-icon-right">Apache Tomcat 官網範例<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 提到的透過 web.xml 設定 &lt;filter&gt;，第二種是直接在 &lt;Host&gt; &lt;Context&gt; 等 Catalina Container 中設定。</p>
<h4>透過 &lt;filter&gt;</h4>
<ol>
<li>&lt;filter&gt; 過濾器在每個專案下的 web.xml 中設定，在 &lt;web-app&gt; &lt;/web-app&gt; 之間加入 &lt;filter&gt; 設定，IP 的部分設定為 1.2.3.4 改寫成 1\.2\.3\.4，IP 與 IP 之間以「|」分隔。
<div>
<div id="highlighter_286384" class="syntaxhighlighter  bash">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash comments"># vim /var/lib/tomcat7/webapps/solr/WEB-INF/web.xml</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<div id="highlighter_245018" class="syntaxhighlighter  xml">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">01</div>
<div class="line number2 index1 alt1">02</div>
<div class="line number3 index2 alt2">03</div>
<div class="line number4 index3 alt1">04</div>
<div class="line number5 index4 alt2">05</div>
<div class="line number6 index5 alt1">06</div>
<div class="line number7 index6 alt2">07</div>
<div class="line number8 index7 alt1">08</div>
<div class="line number9 index8 alt2">09</div>
<div class="line number10 index9 alt1">10</div>
<div class="line number11 index10 alt2">11</div>
<div class="line number12 index11 alt1">12</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">filter</code><code class="xml plain">&gt;</code></div>
<div class="line number2 index1 alt1"><code class="xml spaces">&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">filter-name</code><code class="xml plain">&gt;Remote Address Filter&lt;/</code><code class="xml keyword">filter-name</code><code class="xml plain">&gt;</code></div>
<div class="line number3 index2 alt2"><code class="xml spaces">&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">filter-class</code><code class="xml plain">&gt;org.apache.catalina.filters.RemoteAddrFilter&lt;/</code><code class="xml keyword">filter-class</code><code class="xml plain">&gt;</code></div>
<div class="line number4 index3 alt1"><code class="xml spaces">&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">init-param</code><code class="xml plain">&gt;</code></div>
<div class="line number5 index4 alt2"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">param-name</code><code class="xml plain">&gt;allow&lt;/</code><code class="xml keyword">param-name</code><code class="xml plain">&gt;</code></div>
<div class="line number6 index5 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">param-value</code><code class="xml plain">&gt;127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1&lt;/</code><code class="xml keyword">param-value</code><code class="xml plain">&gt;</code></div>
<div class="line number7 index6 alt2"><code class="xml spaces">&nbsp;&nbsp;</code><code class="xml plain">&lt;/</code><code class="xml keyword">init-param</code><code class="xml plain">&gt;</code></div>
<div class="line number8 index7 alt1"><code class="xml plain">&lt;/</code><code class="xml keyword">filter</code><code class="xml plain">&gt;</code></div>
<div class="line number9 index8 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">filter-mapping</code><code class="xml plain">&gt;</code></div>
<div class="line number10 index9 alt1"><code class="xml spaces">&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">filter-name</code><code class="xml plain">&gt;Remote Address Filter&lt;/</code><code class="xml keyword">filter-name</code><code class="xml plain">&gt;</code></div>
<div class="line number11 index10 alt2"><code class="xml spaces">&nbsp;&nbsp;</code><code class="xml plain">&lt;</code><code class="xml keyword">url-pattern</code><code class="xml plain">&gt;/*&lt;/</code><code class="xml keyword">url-pattern</code><code class="xml plain">&gt;</code></div>
<div class="line number12 index11 alt1"><code class="xml plain">&lt;/</code><code class="xml keyword">filter-mapping</code><code class="xml plain">&gt;</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</li>
<li>設定完成！重新啟動 tomcat。</li>
</ol>
<h4>&nbsp;</h4>
<h4>透過 &lt;Context&gt;</h4>
<ol>
<li>進入到 solr 個別設定檔，在 &lt;Context&gt; &lt;/Context&gt; 之間加入 &lt;Value /&gt;
<div>
<div id="highlighter_646750" class="syntaxhighlighter  bash">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash comments"># vim /var/lib/tomcat7/conf/Catalina/localhost/solr.xml</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<div id="highlighter_936594" class="syntaxhighlighter  xml">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
<div class="line number2 index1 alt1">2</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">Valve</code> <code class="xml color1">className</code><code class="xml plain">=</code><code class="xml string">"org.apache.catalina.valves.RemoteAddrValve"</code></div>
<div class="line number2 index1 alt1"><code class="xml spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="xml color1">allow</code><code class="xml plain">=</code><code class="xml string">"127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1"</code><code class="xml plain">/&gt;</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</li>
<li>IP 設定規則同 &lt;filter&gt; 第一點。</li>
<li>設定完成！重新啟動 tomcat。</li>
</ol>


<p><strong>Solr 系列文章：</strong></p>



<ul class="my-li bg-darkblue wp-block-list"><li><a href="https://noter.tw/3084/solr-%e6%95%99%e5%ad%b8-1-%e5%ae%89%e8%a3%9d%e7%af%87/" data-wpel-link="internal">Solr 教學 (1) &#8211; 安裝篇</a></li><li><a href="https://noter.tw/3082/solr-%e6%95%99%e5%ad%b8-2-tomcat-7-%e4%bb%a5%e5%b8%b3%e8%99%9f%e5%af%86%e7%a2%bc%e9%99%90%e5%88%b6%e5%ad%98%e5%8f%96%e9%a0%81%e9%9d%a2/" data-wpel-link="internal">Solr 教學 (2) – tomcat 7 以帳號密碼限制存取頁面</a></li><li><a href="https://noter.tw/3094/solr-%e6%95%99%e5%ad%b8-3-%e4%bb%a5-remote-address-filter-%e9%99%90%e5%88%b6%e5%ad%98%e5%8f%96/" data-wpel-link="internal">Solr 教學 (3) – 以 Remote Address Filter 限制存取</a></li><li><a href="https://noter.tw/3160/solr-%e6%95%99%e5%ad%b8-4-%e4%bd%bf%e7%94%a8-dataimport-%e5%8c%af%e5%85%a5%e8%b3%87%e6%96%99%e5%ba%ab%e8%b3%87%e6%96%99/" data-wpel-link="internal">Solr 教學 (4) – 使用 DataImport 匯入資料庫資料</a></li><li><a href="https://noter.tw/3170/solr-%e6%95%99%e5%ad%b8-5-%e5%bb%ba%e7%ab%8b%e6%96%b0%e7%9a%84-core/" data-wpel-link="internal">Solr 教學 (5) – 建立新的 Core</a></li></ul>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/3094/solr-%e6%95%99%e5%ad%b8-3-%e4%bb%a5-remote-address-filter-%e9%99%90%e5%88%b6%e5%ad%98%e5%8f%96/" data-wpel-link="internal">Solr 教學 (3) &#8211; 以 Remote Address Filter 限制存取</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/3094/solr-%e6%95%99%e5%ad%b8-3-%e4%bb%a5-remote-address-filter-%e9%99%90%e5%88%b6%e5%ad%98%e5%8f%96/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Solr 教學 (1) &#8211; 安裝篇</title>
		<link>https://noter.tw/3084/solr-%e6%95%99%e5%ad%b8-1-%e5%ae%89%e8%a3%9d%e7%af%87/</link>
					<comments>https://noter.tw/3084/solr-%e6%95%99%e5%ad%b8-1-%e5%ae%89%e8%a3%9d%e7%af%87/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Mon, 14 Oct 2013 13:55:32 +0000</pubDate>
				<category><![CDATA[Web Server]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[安裝心得]]></category>
		<category><![CDATA[教學]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[solr]]></category>
		<category><![CDATA[solr.xml]]></category>
		<category><![CDATA[solrconfig.xml]]></category>
		<guid isPermaLink="false">http://wazai.net/?p=3084</guid>

					<description><![CDATA[<p>Solr 真是一個不錯的東西，想說架一個來玩，安裝時花了很多時間，網路上大部分查到的都是直接用 jetty 來執行，問了同事之後得知可以把 example 下的 solr.war 檔案直接拉到 tom&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/3084/solr-%e6%95%99%e5%ad%b8-1-%e5%ae%89%e8%a3%9d%e7%af%87/" data-wpel-link="internal">Solr 教學 (1) &#8211; 安裝篇</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>

Solr 真是一個不錯的東西，想說架一個來玩，安裝時花了很多時間，網路上大部分查到的都是直接用 jetty 來執行，問了同事之後得知可以把 example 下的 solr.war 檔案直接拉到 tomcat 目錄下，但怎麼試就是沒辦法，這篇記錄 solr 與 tomcat 搭配的過程。

</p>



<span id="more-3084"></span>



<p>花了不少時間，怎麼 war 檔不是直接拉到 tomcat 目錄下就可以使用 &#8230; 這安裝也太麻煩了，先記錄下來，如果有什麼意外要再灌一次才知道怎麼弄。苦痛的記憶開始 &#8230; 小蛙的環境是：Ubuntu 13.04 64bit + Solr 4.5.0 + tomcat 7。 </p>



<p>安裝 tomcat 7 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">apt-get install tomcat7</pre>



<p>下載 solr 4.5，假設放在 /usr/src 下 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">cd /usr/src
wget http://apache.stu.edu.tw/lucene/solr/4.5.0/solr-4.5.0.zip</pre>



<p>解壓縮 (如果沒有 unzip 就 # apt-get install unzip，不想安裝的話也可以到 這邊下載 tgz 版本)</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">unzip solr-4.5.0.zip</pre>



<p>複製需要的 war 檔案到 tomcat 目錄下 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">cd solr-4.5.0
cp ./example/webapps/solr.war /var/lib/tomcat7/webapps/solr.war</pre>



<p>建立 solr.xml 設定檔，底下的 /opt/solr 是 solr 的資料放置目錄 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">vim /var/lib/tomcat7/conf/Catalina/localhost/solr.xml</pre>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;Context path="/solr" docBase="/var/lib/tomcat7/webapps/solr.war" crossContext="true" privileged="true" antiResourceLocking="false"&gt;&nbsp;&nbsp;
  &lt;Environment name="solr/home" type="java.lang.String" value="/opt/solr" override="true" /&gt;
&lt;/Context&gt;</pre>



<p>建立 solr 資料目錄，並新增 solr.xml 設定檔 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">mkdir -p /opt/solr
vim /opt/solr/solr.xml</pre>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
&lt;solr persistent="true"&gt;&nbsp;&nbsp;&nbsp;&nbsp;
  &lt;cores adminPath="/admin/cores"&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  &lt;core name="example" instanceDir="example" /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  &lt;!-- adding extra cores!
  &lt;core name="another_example" instanceDir="another_example_directory" /&gt;--&gt;
  &lt;/cores&gt;
&lt;/solr&gt;</pre>



<p>更改擁有者及群組 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">chown -R tomcat7:tomcat7 /opt/solr/example</pre>



<p>複製必須的設定檔 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">cp /usr/src/solr-4.5.0/example/solr/collection1/conf/*.txt /opt/solr/example/conf/
cp /usr/src/solr-4.5.0/example/multicore/core0/conf/*.xml /opt/solr/example/conf/</pre>



<p>增加以下設定 (參考資料1，先照著做) </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">vim /opt/solr/example/conf/solrconfig.xml</pre>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">&lt;requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy"&gt;&lt;/requestHandler&gt;
&lt;requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" /&gt;
&lt;requestHandler name="/spell" class="solr.SearchHandler" startup="lazy"&gt;
	&lt;lst name="defaults"&gt;
		&lt;str name="spellcheck.onlyMorePopular"&gt;false&lt;/str&gt;
		&lt;str name="spellcheck.extendedResults"&gt;false&lt;/str&gt;
		&lt;str name="spellcheck.count"&gt;1&lt;/str&gt;
	&lt;/lst&gt;
	&lt;arr name="last-components"&gt;
		&lt;str&gt;spellcheck&lt;/str&gt;
	&lt;/arr&gt;
&lt;/requestHandler&gt;
&lt;searchComponent name="suggest" class="solr.SpellCheckComponent"&gt;
	&lt;lst name="spellchecker"&gt;
		&lt;str name="name"&gt;suggest&lt;/str&gt;
		&lt;str name="classname"&gt;org.apache.solr.spelling.suggest.Suggester&lt;/str&gt;
		&lt;str name="lookupImpl"&gt;org.apache.solr.spelling.suggest.tst.TSTLookup&lt;/str&gt;
		&lt;str name="field"&gt;title&lt;/str&gt;
		&lt;str name="buildOnCommit"&gt;true&lt;/str&gt;
	&lt;/lst&gt;
&lt;/searchComponent&gt;
&lt;requestHandler name="/suggest" class="org.apache.solr.handler.component.SearchHandler"&gt;
	&lt;lst name="defaults"&gt;
		&lt;str name="spellcheck"&gt;true&lt;/str&gt;
		&lt;str name="spellcheck.dictionary"&gt;suggest&lt;/str&gt;
		&lt;str name="spellcheck.count"&gt;10&lt;/str&gt;
	&lt;/lst&gt;
	&lt;arr name="components"&gt;
		&lt;str&gt;suggest&lt;/str&gt;
	&lt;/arr&gt;
&lt;/requestHandler&gt;</pre>



<p>這應該是一種報應，小蛙設定 Eclipse RSE 時不小心做了刪除動作，結果就把整個 tomcat/webapps 全刪了 &#8230; 照著上面的步驟重做一次後發現漏掉這一步 = =，把執行 solr 需要的 JAR 加入到 lib 資料夾中 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">cp /usr/src/solr-4.5.0/example/lib/ext/* /var/lib/tomcat7/webapps/solr/WEB-INF/lib/</pre>



<p>重新啟動 tomcat </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">service tomcat7 restart</pre>



<p>到這邊大致上就完成囉！如果沒有改 tomcat port 的話，http://your_domain:8080/solr 就可以連到 solr 囉！裡面只有剛剛複製的 collection1，之後開始新增 / 修改 / 刪除 資料時，再把過程記錄下來！ </p>



<p><strong>Solr 系列文章：</strong></p>



<ul class="my-li bg-darkblue wp-block-list"><li><a href="https://noter.tw/3084/solr-%e6%95%99%e5%ad%b8-1-%e5%ae%89%e8%a3%9d%e7%af%87/" data-wpel-link="internal">Solr 教學 (1) &#8211; 安裝篇</a></li><li><a href="https://noter.tw/3082/solr-%e6%95%99%e5%ad%b8-2-tomcat-7-%e4%bb%a5%e5%b8%b3%e8%99%9f%e5%af%86%e7%a2%bc%e9%99%90%e5%88%b6%e5%ad%98%e5%8f%96%e9%a0%81%e9%9d%a2/" data-wpel-link="internal">Solr 教學 (2) – tomcat 7 以帳號密碼限制存取頁面</a></li><li><a href="https://noter.tw/3094/solr-%e6%95%99%e5%ad%b8-3-%e4%bb%a5-remote-address-filter-%e9%99%90%e5%88%b6%e5%ad%98%e5%8f%96/" data-wpel-link="internal">Solr 教學 (3) – 以 Remote Address Filter 限制存取</a></li><li><a href="https://noter.tw/3160/solr-%e6%95%99%e5%ad%b8-4-%e4%bd%bf%e7%94%a8-dataimport-%e5%8c%af%e5%85%a5%e8%b3%87%e6%96%99%e5%ba%ab%e8%b3%87%e6%96%99/" data-wpel-link="internal">Solr 教學 (4) – 使用 DataImport 匯入資料庫資料</a></li><li><a href="https://noter.tw/3170/solr-%e6%95%99%e5%ad%b8-5-%e5%bb%ba%e7%ab%8b%e6%96%b0%e7%9a%84-core/" data-wpel-link="internal">Solr 教學 (5) – 建立新的 Core</a></li></ul>



<h2 class="para wp-block-heading"><strong>參考資料：</strong> </h2>



<ol class="my-li bg-darkblue wp-block-list"><li>How to install SOLR 4.0 Cloud with Tomcat 7 on Ubuntu 12.04 LTS @ nodeX<br><a href="http://www.nodex.co.uk/article/10-12-12/how-to-install-solr-4-0-cloud-with-tomcat-7-on-ubuntu-12-04-lts" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">http://www.nodex.co.uk/article/10-12-12/how-to-install-solr-4-0-cloud-with-tomcat-7-on-ubuntu-12-04-lts<span class="wpel-icon wpel-image wpel-icon-6"></span></a></li></ol>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/3084/solr-%e6%95%99%e5%ad%b8-1-%e5%ae%89%e8%a3%9d%e7%af%87/" data-wpel-link="internal">Solr 教學 (1) &#8211; 安裝篇</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/3084/solr-%e6%95%99%e5%ad%b8-1-%e5%ae%89%e8%a3%9d%e7%af%87/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
