Lucene index inet mapper is intended to map CQL inet data type. The only advantage on it is to make parsing more flexible. For example, given the following data:
CREATE TABLE t (
pk int PRIMARY KEY,
address inet
) ;
CREATE CUSTOM INDEX i ON t ()
USING 'com.stratio.cassandra.lucene.Index'
WITH OPTIONS = {
'refresh_seconds': '1',
'schema': '{
fields : {
address : {type: "inet"},
address_s : {type: "string", column: "address"}
}
}'};
INSERT INTO t(pk, address) VALUES (0, '::FFFF:8:8:8');
All these queries will found the indexed row:
SELECT * FROM t WHERE expr(i, '{filter:{type:"match", field:"address", value: "::ffFF:8:8:8"}}');
SELECT * FROM t WHERE expr(i, '{filter:{type:"match", field:"address", value: "::0:ffff:8:8:8"}}');
SELECT * FROM t WHERE expr(i, '{filter:{type:"match", field:"address", value: "0:0:0:0:ffff:8:8:8"}}');
However, the same queries wouldn't work with a string mapper:
SELECT * FROM t WHERE expr(i, '{filter:{type:"match", field:"address_s", value: "::ffFF:8:8:8"}}');
SELECT * FROM t WHERE expr(i, '{filter:{type:"match", field:"address_s", value: "::0:ffff:8:8:8"}}');
SELECT * FROM t WHERE expr(i, '{filter:{type:"match", field:"address_s", value: "0:0:0:0:ffff:8:8:8"}}');
SELECT * FROM t WHERE expr(i, '{filter:{type:"wildcard", field:"address_s", value: "*:8:8:8"}}');
Aside from this, the generated Lucene field is a string field, so there is no special treatment for wildcard or range queries, that should use the expanded format of the IP address and will have a lexicographical behaviour:
SELECT * FROM t WHERE expr(i, '{filter:{type:"wildcard", field:"address", value: "*:8:8:8"}}');
SELECT * FROM t WHERE expr(i, '{filter:{type:"range", field:"address", lower: "::FFFF:8:8:7"}}');