Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

geo_distance search on MULTIPOINT(45 45, 60 60,70,70,) #393

Open
msravi16 opened this issue Jun 28, 2018 · 0 comments
Open

geo_distance search on MULTIPOINT(45 45, 60 60,70,70,) #393

msravi16 opened this issue Jun 28, 2018 · 0 comments

Comments

@msravi16
Copy link

msravi16 commented Jun 28, 2018

Hi Stratio Team and Community,

Thankyou very much for developing a great plugin for cassandra, this plugin has removed the pain of integrating Cassandra with Solr. After using this plugin, search on Cassandra has become very easy.

We have a requirement to search Lat/Lng on Multipoint and we are using Cassandra - 3.11.1 and stratio plugin 3.11.1

Use Case : Entity has multiple Lat/Lng and these Lat/Lng s are stored in WKT Multipoint. Given the Lat/Lng as input I need to do geo_distance search on WKT-Multipoint.

Below are the steps which I have followed to achieve this, but I get an error ""Field 'place' requires a mapper of type 'class com.stratio.cassandra.lucene.schema.mapping.GeoPointMapper' but found 'GeoShapeMapper{field=place, column=place, validated=false, maxLevels=15, transformations=[]}"

Should I do any transformation before I index the data OR is there any other work around to do this.

CREATE KEYSPACE IF NOT EXISTS latlngsearch WITH 
    replication = {'class': 'SimpleStrategy', 'replication_factor' : 1};

CREATE TABLE IF NOT EXISTS brand (
    id text,
    place text,
    lucene text,
    PRIMARY KEY (id)
);

CREATE CUSTOM INDEX geo_idx ON brand(lucene) 
USING 'com.stratio.cassandra.lucene.Index'
WITH OPTIONS = {
   'refresh_seconds': '1',
   'schema': '{
      fields: {
         place: {
            type: "geo_shape",
            max_levels: 15
         }
      }
   }'
};


INSERT INTO brand (id, place) VALUES ('1','MULTIPOINT(22 22, 12 12)');
INSERT INTO brand (id, place) VALUES ('2','MULTIPOINT(11 11, 12 12)');
INSERT INTO brand (id, place) VALUES ('2','MULTIPOINT(33 33)');

SELECT id FROM brand WHERE expr(geo_idx, '{
    filter: [
        {
            type: "geo_distance",
            field: "place",
            latitude: 12,
            longitude: 12,
            max_distance: "1km"
        }
    ]
}');


Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant