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 Bertie Shen <be...@gmail.com> on 2009/11/21 21:30:13 UTC

Question about lat/long data type in localsolr

Hey everyone,

  I used localsolr and locallucene to do local search. But I could not make
longitude and latitude successfully indexed. During DataImport process,
there is an exception. Do you have some ideas about it?

  I copy solrconfig.xml and schema.xml from your
http://www.gissearch.com/localsolr. Only change I made is to replace names
lat and lng by latitude and longtitude respectively, which are field name in
my index. Should "str" in <str name="latField">lat</str> should be replaced
by "double" according to the following exception?

  Thanks.

Solr log about Exception.

<exception>
    <message>java.lang.ClassCastException: java.lang.Double cannot be cast
to java.lan\
g.String</message>
    <frame>
      <class>com.pjaol.search.solr.update.LocalUpdaterProcessor</class>
      <method>processAdd</method>
      <line>136</line>
    </frame>
    <frame>
      <class>org.apache.solr.handler.dataimport.SolrWriter</class>
      <method>upload</method>
      <line>75</line>
    </frame>
    <frame>
      <class>org.apache.solr.handler.dataimport.DataImportHandler$1</class>
      <method>upload</method>
      <line>292</line>
    </frame>
    <frame>
      <class>org.apache.solr.handler.dataimport.DocBuilder</class>
      <method>buildDocument</method>
      <line>392</line>
    </frame>
    <frame>
      <class>org.apache.solr.handler.dataimport.DocBuilder</class>
      <method>doFullDump</method>
      <line>242</line>
    </frame>
    <frame>
      <class>org.apache.solr.handler.dataimport.DocBuilder</class>
      <method>execute</method>
      <line>180</line>
    </frame>
    <frame>
      <class>org.apache.solr.handler.dataimport.DataImporter</class>
      <method>doFullImport</method>
      <line>331</line>
    </frame>
    <frame>
      <class>org.apache.solr.handler.dataimport.DataImporter</class>
      <method>runCmd</method>
      <line>389</line>
    </frame>
    <frame>
      <class>org.apache.solr.handler.dataimport.DataImporter$1</class>
      <method>run</method>
      <line>370</line>
    </frame>
  </exception>


How do I set up local indexing

Here is what I have done to set up local indexing.
1) Download localsolr. I download it from
http://developer.k-int.com/m2snapshots/localsolr/localsolr/1.5/ and put jar
file (in my case, localsolr-1.5.jar) in your application's WEB_INF/lib
directory of application server.

2) Download locallucene. I download it from
http://sourceforge.net/projects/locallucene/ and put jar file (in my case,
locallucene.jar in locallucene_r2.0/dist/ diectory) in your application's
WEB_INF/lib directory of application server. I also need to copy
gt2-referencing-2.3.1.jar, geoapi-nogenerics-2.1-M2.jar, and jsr108-0.01.jar
under locallucene_r2.0/lib/ directory to WEB_INF/lib. Do not copy
lucene-spatial-2.9.1.jar under Lucene codebase. The namespace has been
changed from com.pjaol.blah.blah.blah to org.apache.blah blah.

3) Update your solrconfig.xml and schema.xml. I copy it from
http://www.gissearch.com/localsolr.

Re: Question about lat/long data type in localsolr

Posted by Bertie Shen <be...@gmail.com>.
Sorry, I forgot to mention that I already did double -> tdouble
replacement.

Yesterday, I downloaded localsolr https://locallucene.svn.
sourceforge.net/svnroot/locallucene/trunk/localsolr and use
lucene-spatial-2.9.0-dev.jar. The indexing is succcessful, although
currently I am still figuring out why the search returns 0 result or throw
an exception.

Thanks.

On Sat, Nov 21, 2009 at 1:43 PM, Ian Ibbotson <ia...@googlemail.com>wrote:

> Heya...
>
> I think you need to use the newer types in your schema.xml, IE
>
>   <field name="lat" type="tdouble" indexed="true" stored="true"/>
>   <field name="lng" type="tdouble" indexed="true" stored="true"/>
>   <field name="geo_distance" type="tdouble"/>
>
> as doubles are no longer index-compatible (AFAIK)
>
> To use the above, make sure you have the tdouble types declared with
>
>    <fieldType name="tdouble" class="solr.TrieDoubleField"
> precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
>
> in your <types> section.
>
> HTH
>
> Ian.
>
>
> 2009/11/21 Bertie Shen <be...@gmail.com>:
> > Hey everyone,
> >
> >  I used localsolr and locallucene to do local search. But I could not
> make
> > longitude and latitude successfully indexed. During DataImport process,
> > there is an exception. Do you have some ideas about it?
> >
> >  I copy solrconfig.xml and schema.xml from your
> > http://www.gissearch.com/localsolr. Only change I made is to replace
> names
> > lat and lng by latitude and longtitude respectively, which are field name
> in
> > my index. Should "str" in <str name="latField">lat</str> should be
> replaced
> > by "double" according to the following exception?
> >
> >  Thanks.
> >
> > Solr log about Exception.
> >
> > <exception>
> >    <message>java.lang.ClassCastException: java.lang.Double cannot be cast
> > to java.lan\
> > g.String</message>
> >    <frame>
> >      <class>com.pjaol.search.solr.update.LocalUpdaterProcessor</class>
> >      <method>processAdd</method>
> >      <line>136</line>
> >    </frame>
> >    <frame>
> >      <class>org.apache.solr.handler.dataimport.SolrWriter</class>
> >      <method>upload</method>
> >      <line>75</line>
> >    </frame>
> >    <frame>
> >
>  <class>org.apache.solr.handler.dataimport.DataImportHandler$1</class>
> >      <method>upload</method>
> >      <line>292</line>
> >    </frame>
> >    <frame>
> >      <class>org.apache.solr.handler.dataimport.DocBuilder</class>
> >      <method>buildDocument</method>
> >      <line>392</line>
> >    </frame>
> >    <frame>
> >      <class>org.apache.solr.handler.dataimport.DocBuilder</class>
> >      <method>doFullDump</method>
> >      <line>242</line>
> >    </frame>
> >    <frame>
> >      <class>org.apache.solr.handler.dataimport.DocBuilder</class>
> >      <method>execute</method>
> >      <line>180</line>
> >    </frame>
> >    <frame>
> >      <class>org.apache.solr.handler.dataimport.DataImporter</class>
> >      <method>doFullImport</method>
> >      <line>331</line>
> >    </frame>
> >    <frame>
> >      <class>org.apache.solr.handler.dataimport.DataImporter</class>
> >      <method>runCmd</method>
> >      <line>389</line>
> >    </frame>
> >    <frame>
> >      <class>org.apache.solr.handler.dataimport.DataImporter$1</class>
> >      <method>run</method>
> >      <line>370</line>
> >    </frame>
> >  </exception>
> >
> >
> > How do I set up local indexing
> >
> > Here is what I have done to set up local indexing.
> > 1) Download localsolr. I download it from
> > http://developer.k-int.com/m2snapshots/localsolr/localsolr/1.5/ and put
> jar
> > file (in my case, localsolr-1.5.jar) in your application's WEB_INF/lib
> > directory of application server.
> >
> > 2) Download locallucene. I download it from
> > http://sourceforge.net/projects/locallucene/ and put jar file (in my
> case,
> > locallucene.jar in locallucene_r2.0/dist/ diectory) in your application's
> > WEB_INF/lib directory of application server. I also need to copy
> > gt2-referencing-2.3.1.jar, geoapi-nogenerics-2.1-M2.jar, and
> jsr108-0.01.jar
> > under locallucene_r2.0/lib/ directory to WEB_INF/lib. Do not copy
> > lucene-spatial-2.9.1.jar under Lucene codebase. The namespace has been
> > changed from com.pjaol.blah.blah.blah to org.apache.blah blah.
> >
> > 3) Update your solrconfig.xml and schema.xml. I copy it from
> > http://www.gissearch.com/localsolr.
> >
>

Re: Question about lat/long data type in localsolr

Posted by Ian Ibbotson <ia...@googlemail.com>.
Heya...

I think you need to use the newer types in your schema.xml, IE

   <field name="lat" type="tdouble" indexed="true" stored="true"/>
   <field name="lng" type="tdouble" indexed="true" stored="true"/>
   <field name="geo_distance" type="tdouble"/>

as doubles are no longer index-compatible (AFAIK)

To use the above, make sure you have the tdouble types declared with

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

in your <types> section.

HTH

Ian.


2009/11/21 Bertie Shen <be...@gmail.com>:
> Hey everyone,
>
>  I used localsolr and locallucene to do local search. But I could not make
> longitude and latitude successfully indexed. During DataImport process,
> there is an exception. Do you have some ideas about it?
>
>  I copy solrconfig.xml and schema.xml from your
> http://www.gissearch.com/localsolr. Only change I made is to replace names
> lat and lng by latitude and longtitude respectively, which are field name in
> my index. Should "str" in <str name="latField">lat</str> should be replaced
> by "double" according to the following exception?
>
>  Thanks.
>
> Solr log about Exception.
>
> <exception>
>    <message>java.lang.ClassCastException: java.lang.Double cannot be cast
> to java.lan\
> g.String</message>
>    <frame>
>      <class>com.pjaol.search.solr.update.LocalUpdaterProcessor</class>
>      <method>processAdd</method>
>      <line>136</line>
>    </frame>
>    <frame>
>      <class>org.apache.solr.handler.dataimport.SolrWriter</class>
>      <method>upload</method>
>      <line>75</line>
>    </frame>
>    <frame>
>      <class>org.apache.solr.handler.dataimport.DataImportHandler$1</class>
>      <method>upload</method>
>      <line>292</line>
>    </frame>
>    <frame>
>      <class>org.apache.solr.handler.dataimport.DocBuilder</class>
>      <method>buildDocument</method>
>      <line>392</line>
>    </frame>
>    <frame>
>      <class>org.apache.solr.handler.dataimport.DocBuilder</class>
>      <method>doFullDump</method>
>      <line>242</line>
>    </frame>
>    <frame>
>      <class>org.apache.solr.handler.dataimport.DocBuilder</class>
>      <method>execute</method>
>      <line>180</line>
>    </frame>
>    <frame>
>      <class>org.apache.solr.handler.dataimport.DataImporter</class>
>      <method>doFullImport</method>
>      <line>331</line>
>    </frame>
>    <frame>
>      <class>org.apache.solr.handler.dataimport.DataImporter</class>
>      <method>runCmd</method>
>      <line>389</line>
>    </frame>
>    <frame>
>      <class>org.apache.solr.handler.dataimport.DataImporter$1</class>
>      <method>run</method>
>      <line>370</line>
>    </frame>
>  </exception>
>
>
> How do I set up local indexing
>
> Here is what I have done to set up local indexing.
> 1) Download localsolr. I download it from
> http://developer.k-int.com/m2snapshots/localsolr/localsolr/1.5/ and put jar
> file (in my case, localsolr-1.5.jar) in your application's WEB_INF/lib
> directory of application server.
>
> 2) Download locallucene. I download it from
> http://sourceforge.net/projects/locallucene/ and put jar file (in my case,
> locallucene.jar in locallucene_r2.0/dist/ diectory) in your application's
> WEB_INF/lib directory of application server. I also need to copy
> gt2-referencing-2.3.1.jar, geoapi-nogenerics-2.1-M2.jar, and jsr108-0.01.jar
> under locallucene_r2.0/lib/ directory to WEB_INF/lib. Do not copy
> lucene-spatial-2.9.1.jar under Lucene codebase. The namespace has been
> changed from com.pjaol.blah.blah.blah to org.apache.blah blah.
>
> 3) Update your solrconfig.xml and schema.xml. I copy it from
> http://www.gissearch.com/localsolr.
>