Stratio / cassandra-lucene-index

Lucene based secondary indexes for Cassandra
Apache License 2.0
600 stars 171 forks source link

Issue with geo_shape search #348

Closed SaiKiranBurle closed 7 years ago

SaiKiranBurle commented 7 years ago

I'm using cassandra-2.2.8 cassandra-lucene-index 2.2.9.1

I'm having difficulty with the geo_shape operation "contains"

Here is what I did:

CREATE KEYSPACE geo_test
WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};
USE geo_test;
CREATE TABLE IF NOT EXISTS test (
   id int,
   shape text,
   lucene text,
   PRIMARY KEY (id)
);
CREATE CUSTOM INDEX test_idx ON test(lucene) USING 'com.stratio.cassandra.lucene.Index'
WITH OPTIONS = {
   'refresh_seconds': '1',
   'schema': '{
      fields: {
         shape: {
            type: "geo_shape",
            max_levels: 15
         }
      }
   }'
};

INSERT INTO test(id, shape) VALUES (1, 'POINT(10 11)');

INSERT INTO test(id, shape) VALUES (2, 'POLYGON((8 9, 12 9, 12 13, 8 13, 8 9))');

-- Note that the point is inside the polygon

-- finds one result as expected (the point with id=1)
SELECT * FROM test
WHERE lucene ='{filter : {
              type : "geo_shape",
             field : "shape",
          relation : "is_within",
             shape : "POLYGON((8 9, 12 9, 12 13, 8 13, 8 9))"
             }}';

--finds one result (the point with id=1, not expected)
SELECT * FROM test
WHERE lucene ='{filter : {
              type : "geo_shape",
             field : "shape",
          relation : "contains",
             shape : "POINT(10 11)"
             }}';
It returns a single result(the point with id=1)

Am I wrong in expecting the POLYGON to be returned with this? (because the polygon clearly has the point inside of it)
SaiKiranBurle commented 7 years ago

The problem was the I was using "relation" instead of "operation"

ealonsodb commented 7 years ago

Yes, and also you are using an incorrect plugin version. Please read Build and Install

SaiKiranBurle commented 7 years ago

Yes, I'm aware of that. I was facing some issues when I'm using lucene 2.2.8 with cassandra 2.2.8. So, I went a version higher in Lucene, haven't faced any problems/issues until now.

ealonsodb commented 7 years ago

Hi @bsaikiran535:

IMHO, I believe in the correct use of language to describe problems and situations to be efficient. Our product name is not lucene, we use the Apache Lucene library. Our product is an integration between Apache Cassandra and Apache Lucene and its name is cassandra-lucene-index.

Also, there is no cassandra-lucene-index 2.2.8 version. There is 2.2.8.0.

Also, we don't support mismatched versions, we are not going to run any cassandra node with mismatched version at all ever. This is not the correct way

Also, if you had some problems with that versions, why didn't you ask for solutions?

Thank you