You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ian Ibbotson <ia...@googlemail.com> on 2009/11/02 20:48:11 UTC

LocalSolr, Maven, build files and release candidates (Just for info) and spatial radius (A question)

Hallo All. I've been trying to prepare a project using localsolr for the
impending (I hope) arrival of solr 1.4 and Lucene 2.9.1.. Here are some
notes in case anyone else is suffering similarly. Obviously everything here
may change by next week.

First problem has been the lack of any stable maven based lucene and solr
artifacts to wire into my poms. Because of that, and as an interim only
measure, I've built the latest branches of the lucene 2.9.1 and solr 1.4
trees and made them into a *temporary* maven repository at
http://developer.k-int.com/m2snapshots/. in there you can find all the jar
artifacts tagged as xxx-ki-rc1 (For solr) and xxx-ki-rc3 (For lucene) and
finally, a localsolr.localsolr build tagged as 1.5.2-rc1. Sorry for the
naming, but I don't want these artifacts to clash with the real ones when
they come along. This is really just for my own use, but I've seen messages
and spoken to people who are really struggling to get their maven deps
right, if this helps anyone, please feel free to use these until the real
apache artifacts appear. I can't take any responsibility for their quality.
All the poms have been altered to look for the correct dependent artifacts
in the same repository, adding the stanza

  <!-- Emergency repository for storing interim builds of lucene and solr
whilst they sort their act out -->
  <repositories>
    <repository>
      <id>k-int-m2-snapshots</id>
      <name>K-int M2 Snapshots</name>
      <url>http://developer.k-int.com/m2snapshots</url>
      <releases>
        <enabled>true</enabled>
      </releases>
    </repository>
  </repositories>

to your pom will let you use these deps temporarily until we see an official
build. If you're a maven developer and I've gone way around the houses with
this, please tell me of an easier solution :) This repo *will* go away when
the real builds turn up.

The localsolr in this repo also contains the patches I've submitted (A good
while ago) to the localsolr project to make it build with the lucene 2.9.1
rc3 as the downloadable dist is currently built against an older 2.9 release
that had a different API (IE won't work with the new lucene and solr)

All this means that there is a working localsolr build.

Second up, I've also seen emails (And seen the exception myself) around
asking about the following when trying to get all these revisions working
together.

java.lang.NumberFormatException: Invalid shift value in prefixCoded string
(is encoded value really a LONG?)

There are some threads out there telling you that the Lucene indexes are not
binary compatible between versions, but if you're using localsolr, what you
really need to know is:

1) Make sure that your schema.xml contains at least the following fieldType
defs

   <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8"
omitNorms="true" positionIncrementGap="0"/>

2) Convert your old solr sdouble fields to tdoubles:

  <field name="lat" type="tdouble" indexed="true" stored="true"/>
  <field name="lng" type="tdouble" indexed="true" stored="true"/>
  <dynamicField name="_local*" type="tdouble" indexed="true" stored="true"/>

Pretty sure you would need to rebuild your indexes.

Ok, with those changes I managed to get a working spatial search.

My only problem now is that the radius param on the command line seems to
need to be way bigger than it needs to be in order to find anything.
Specifically, if I search with a radius of 220 I get a record back which
marks it's geo_distance as "83.76888211666025". Shuffling the radius around
ends up that a radius of 205 returns that doc, 204 and it's filtered. I'm
going to dig into this now, but if anyone knows about this I'd really
appreciate any help.

Cheers all, hope this is of use to someone out there, if anyone has
corrections/comments I'd really appreciate any info.

Best,
Ian.