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

Reply via email to