<?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>Kurt Jarchow&#039;s Blog &#187; geo</title>
	<atom:link href="http://www.kurtjarchow.com/tag/geo/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kurtjarchow.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 02 Jul 2010 14:09:30 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SOLR, Drupal, and GEO Spatial Results</title>
		<link>http://www.kurtjarchow.com/2008/12/14/solr-drupal-geo-spatia/</link>
		<comments>http://www.kurtjarchow.com/2008/12/14/solr-drupal-geo-spatia/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 22:05:38 +0000</pubDate>
		<dc:creator>Kurt Jarchow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[geo]]></category>
		<category><![CDATA[solr]]></category>
		<category><![CDATA[spatial]]></category>

		<guid isPermaLink="false">http://jarchowk.wordpress.com/?p=68</guid>
		<description><![CDATA[Our search needed to preform typical longitude and latitude geo-radius spatial results (I&#8217;ve mashed up all of those keywords because I really am not sure what someone will search for to find this post, apologies for the grammar!).  Since I took on SOLR as our search engine I needed to find an elegant solution.
After some [...]]]></description>
			<content:encoded><![CDATA[<p>Our search needed to preform typical longitude and latitude geo-radius spatial results (I&#8217;ve mashed up all of those keywords because I really am not sure what someone will search for to find this post, apologies for the grammar!).  Since I took on SOLR as our search engine I needed to find an elegant solution.</p>
<p>After some search, I found the holy grail: <a href="http://www.gissearch.com/localsolr">Local SOLR</a>.  Not finding much instruction on the official site, I found a <a href="http://www.nsshutdown.com/blog/index.php?itemid=87">great blog post</a> with an explanation and example.  Its fairly easy to install and integrate into drupal.</p>
<ol>
<li>Extract the files and copy them into your solr directory (if your main solr instance is under &#8220;example&#8221;, make it &#8220;example2&#8243;.</li>
<li>Stop your sorl instance (I&#8217;m assuming your on a dev box!) and start the local solr.</li>
<li>Test to see if its working using the localhost cinema example.</li>
<li>If it works find the java files and copy them into your solr project.</li>
<li>Update your solr.config and schema files.  Sorry I don&#8217;t have the exact lines (not at work) but its pretty obvious what lines are local solr related. &lt;edit: read below&gt;</li>
<li>Update the drupal code to send the extra fields (I&#8217;ll try to find the exact ones later) .</li>
<li>You&#8217;re done!</li>
</ol>
<p>The only gotcha I found, resulting in a few lost hairs and an increase in blood pressure, was a funny error concerning the comments field.  The error I received was a integer conversion error, which I eventually found out was the number of comments being blank.  Just make sure you adjust your apachesolr.module file to set comments to zero when it is null.</p>
<p>I&#8217;ll try to get the drupal developers to support local solr so we can have some official code for you to use.</p>
<p>That&#8217;s it for now!</p>
<p>&lt;update&gt;</p>
<p>As suggested I&#8217;ll post this on the Drupal website, but for anyone interested the updates to the solr.config and scheme files:</p>
<p>::schema.xml</p>
<p>&lt;field name=&#8221;lat&#8221; type=&#8221;sdouble&#8221; indexed=&#8221;true&#8221; stored=&#8221;true&#8221;/&gt;<br />
&lt;field name=&#8221;lng&#8221; type=&#8221;sdouble&#8221; indexed=&#8221;true&#8221; stored=&#8221;true&#8221;/&gt;<br />
&lt;field name=&#8221;geo_distance&#8221; type=&#8221;sdouble&#8221;/&gt;<br />
&lt;dynamicField name=&#8221;_local*&#8221; type=&#8221;sdouble&#8221; indexed=&#8221;true&#8221; stored=&#8221;true&#8221;/&gt;</p>
<p>::solr.config</p>
<p>line 177</p>
<p>&lt;searchComponent name=&#8221;localsolr&#8221;     class=&#8221;com.pjaol.search.solr.</p>
<div id="10m" class="ArwC7c ckChnd">component.LocalSolrQueryComponent&#8221; &gt;<br />
&lt;str name=&#8221;latField&#8221;&gt;lat&lt;/str&gt;<br />
&lt;str name=&#8221;lngField&#8221;&gt;lng&lt;/str&gt;<br />
&lt;/searchComponent&gt;</p>
<p>&lt;!&#8211; local lucene request handler &#8211;&gt;<br />
&lt;requestHandler name=&#8221;geo&#8221; class=&#8221;org.apache.solr.handler.component.SearchHandler&#8221;&gt;<br />
&lt;lst name=&#8221;defaults&#8221;&gt;<br />
&lt;str name=&#8221;echoParams&#8221;&gt;explicit&lt;/str&gt;<br />
&lt;/lst&gt;<br />
&lt;arr name=&#8221;components&#8221;&gt;<br />
&lt;str&gt;localsolr&lt;/str&gt;<br />
&lt;str&gt;facet&lt;/str&gt;<br />
&lt;str&gt;mlt&lt;/str&gt;<br />
&lt;str&gt;highlight&lt;/str&gt;<br />
&lt;str&gt;debug&lt;/str&gt;<br />
&lt;/arr&gt;<br />
&lt;/requestHandler&gt;</p></div>
<div class="ArwC7c ckChnd"></div>
<div class="ArwC7c ckChnd">line 574</div>
<div class="ArwC7c ckChnd">
&lt;searchComponent name=&#8221;localsolr&#8221;     class=&#8221;com.pjaol.search.solr.</p>
<div id="10m" class="ArwC7c ckChnd">component.LocalSolrQueryComponent&#8221; &gt;<br />
&lt;str name=&#8221;latField&#8221;&gt;lat&lt;/str&gt;<br />
&lt;str name=&#8221;lngField&#8221;&gt;lng&lt;/str&gt;<br />
&lt;/searchComponent&gt;</p>
<p>&lt;!&#8211; local lucene request handler &#8211;&gt;<br />
&lt;requestHandler name=&#8221;geo&#8221; class=&#8221;org.apache.solr.handler.component.SearchHandler&#8221;&gt;<br />
&lt;lst name=&#8221;defaults&#8221;&gt;<br />
&lt;str name=&#8221;echoParams&#8221;&gt;explicit&lt;/str&gt;<br />
&lt;/lst&gt;<br />
&lt;arr name=&#8221;components&#8221;&gt;<br />
&lt;str&gt;localsolr&lt;/str&gt;<br />
&lt;str&gt;facet&lt;/str&gt;<br />
&lt;str&gt;mlt&lt;/str&gt;<br />
&lt;str&gt;highlight&lt;/str&gt;<br />
&lt;str&gt;debug&lt;/str&gt;<br />
&lt;/arr&gt;<br />
&lt;/requestHandler&gt;</p></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.kurtjarchow.com/2008/12/14/solr-drupal-geo-spatia/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
