geo_distance search on MULTIPOINT(45 45, 60 60,70,70,)
msravi16 opened this issue · 0 comments
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"
}
]
}');