Hi Sinh,

The other issue here, I suspect, is that the default Solr install does not
come with the jar files containing JtsSpatialContextFactory. You will need
to install them yourself. (Fwiw, there was an issue opened recently
requesting that this get included with Riak by default, here:
https://github.com/basho/yokozuna/issues/495 ).

As described in
https://cwiki.apache.org/confluence/display/solr/Spatial+Search (in the
Schema configuration section, under spatialContextFactory),
you want to download the JTS Topo Suite (
http://sourceforge.net/projects/jts-topo-suite/ ). Then:

1) Locate the Riak /lib directory (depends on your OS). On Ubuntu, it's
/usr/lib/riak/lib/, on RedHat it's /usr/lib64/riak/, on Mac OS it depends
on how you installed it.

2) Locate the Solr / Yokozuna lib directory, under the riak lib directory.
So, for me, it's <path to riak
lib>/yokozuna-*/priv/solr/solr-webapp/webapp/WEB-INF/lib

You'll want to copy the .jar files from the /lib directory of the JTS Topo
Suite to that solr lib directory, (and likely stop and start riak, which
will restart Solr).

Dmitri


On Mon, Jun 1, 2015 at 1:47 PM, Drew Kerrigan <d...@kerrigan.io> wrote:

> Hello Sinh
>
> Here is a working example of the setup for a "find all records within X
> miles of a lat,lon point":
>
> https://gist.github.com/drewkerrigan/c7cabcbc46c10957248e
>
> Without digging too much into the exact problem you're encountering, I
> think at a high level you should not be attempting to modify the default
> schema (http://localhost:8098/search/schema/_yz_default)
>
> Any custom schemas should be named something other than _yz_default, like
> "my_geo_schema".
>
> Thanks,
> Drew
>
>
>
> On Mon, Jun 1, 2015 at 3:37 PM sinh nguyen <sin...@gmail.com> wrote:
>
>> My goal is trying to retrieve all locations within a boundary using Solr
>> function IsWithin(Polygon()). I am using 2.1.1 and follow this
>> documentation from solr
>> https://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4.
>>
>> First, I downloaded schema from Basho git hub
>>
>> https://raw.githubusercontent.com/basho/yokozuna/develop/priv/default_schema.xml
>>
>>
>> Then I added new fieldtype to schema.xml
>>
>> <fieldType name="location_rpt"   
>> class="solr.SpatialRecursivePrefixTreeFieldType"
>>            
>> spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
>>                distErrPct="0.025"
>>                maxDistErr="0.000009"
>>                units="degrees"
>>             />
>>
>>
>> I added new field to schema.xml
>>
>> <dynamicField name="*_geotest"  type="location_rpt"  indexed="true" 
>> stored="true"  multiValued="true" />
>>
>> <field name="myloc"  type="location_rpt"  indexed="true" stored="true"  
>> multiValued="true" />
>>
>>
>> I uploaded to server
>>
>> curl -i -XPUT http://localhost:8098/search/schema/_yz_default \
>>   -H 'content-type: application/xml' \
>>   --data-binary @schema.xml
>>
>>
>> I create new object
>>
>> curl -i -H 'content-type: application/json' -X PUT 
>> 'http://localhost:8098/types/geo_type/buckets/stuff/keys/sf' -d 
>> '{"name_tssd":"San Francisco", 
>> "loc_geotest":"37.774929,-122.419416","myloc":"37.774929,-122.419416"}'
>>
>>
>> But Solr only indexes "name_tssd" and neither "loc_geotest" nor "myloc"
>> is indexed.
>>
>> Please help!
>>
>> PS: How do you remove custom schema.xml?
>>
>>
>> _______________________________________________
>> riak-users mailing list
>> riak-users@lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>
> _______________________________________________
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to