Introduction
I created this guide, so you don't have to go through the 2 days of hell I had to go through. Mainly trawling countless websites that all seemed to contradict them selves.. However this is how i managed to get LocalSolr working on my Solr Server. Enjoy
Prerequisites
Before you start using LocalSolr, you'll need to install solr. You can following my guide on installing Solr 1.4 on windows here
Steps
- Download LocalSolr from here
I took a backup of the solr-example.tgz when i wrote this blog in case they remove the link or update the files inside
- Extract to a temporary folder
- Next you'll have to update your solrconfig.xml file
- Add the following code to your solrconfig.xml file
<updateRequestProcessorChain> <processor class="com.pjaol.search.solr.update.LocalUpdateProcessorFactory"> <str name="latField">lat</str> <str name="lngField">lng</str> <int name="startTier">4</int> <int name="endTier">25</int> </processor> <processor class="solr.RunUpdateProcessorFactory" /> <processor class="solr.LogUpdateProcessorFactory" /> </updateRequestProcessorChain>
<searchComponent name="localsolr" class="com.pjaol.search.solr.component.LocalSolrQueryComponent" />
<requestHandler name="geo" class="org.apache.solr.handler.component.SearchHandler"> <!-- default values for query parameters --> <lst name="defaults"> <str name="echoParams">explicit</str> <!-- <int name="rows">10</int> <str name="fl">*</str> <str name="version">2.1</str> --> </lst> <arr name="components"> <str>localsolr</str> <str>facet</str> <str>mlt</str> <str>highlight</str> <str>debug</str> </arr> </requestHandler>
Here you can see where I added the lines to the existing file (Click image to see large version).
- Next you'll have to update your schema
- Add the following code to your schema.xml file
<field name="lat" type="tdouble" indexed="true" stored="true"/> <field name="lng" type="tdouble" indexed="true" stored="true"/> <field name="geo_distance" type="tdouble"/> <dynamicfield name="_local*" type="tdouble" indexed="true" stored="true"/>
- Stop Apache TomCat Service
- Delete contents of the Data Folder
solr\Data
- Copy 2 files from the extract folder
solr-example\apache-solr-1.4.0\example\solr\lib\localsolr.jar
solr-example\apache-solr-1.4.0\example\solr\lib\lucene-spatial-2.9.1.jar
- to your solr\lib folder
- Start Apache TomCat Service
- Perform a solr Geo Search
- Check normal searches still work
- Try adding some data to Solr and Re-doing both searches
- Remember that the geo search also requires a text query. So make sure you include text that's indexed.
I used the following reference sites when creating this guide:
References can be found:
ReplyDeletehttp://issues.apache.org/jira/browse/SOLR-773
http://www.gissearch.com/localsolr
i did a fresh 1.4 install and tested it, worked fine. then changed config and schema as above but now get:
ReplyDelete"java.lang.NoClassDefFoundError: org/apache/solr/handler/component/SearchComponent"
i am on linux, not windows. if anyone has any ideas that'd be great.
Thanks for the post, could you comment on the reason to use triedouble vs sortabledouble fields for the lat and lng?
ReplyDeletethanks,
david
i was thinking about creating a blog too and your post has helped me where to look. i just hope it gets closer to as good as yours then i am all set
ReplyDeleteThanks for the post, could you comment on the reason to use triedouble vs sortabledouble fields for the lat and lng?
ReplyDeleteEyelash extensions las vegas
Very nice article to know more about the Karatbars go the website
ReplyDeletehttps://cyberflixtv.xyz was propelled in 2018 and has a very decent reach to the individuals. Time by time it is being famous among the clients around the world. There are numerous explanations behind this.
ReplyDelete대전콜걸
ReplyDelete세종콜걸
광주콜걸
서울콜걸
울산콜걸
인천콜걸
부산콜걸
대구콜걸
i just hope it gets closer to as good as yours then i am all set
ReplyDeletekrnl.fun
hdstreamz apk