Skip to content

Secondary Index problem #1626

@frknlbhr

Description

@frknlbhr

I added a secondary index for an Integer attribute of my SimpleFeature

NumericIndexStrategy indexStrategy = new SimpleIntegerIndexStrategy(); FeatureAttributeDimensionField[] dimensionFields = {new FeatureAttributeDimensionField(getPlaneFeatureType().getDescriptor("flightId"))}; CommonIndexModel indexModel = new BasicIndexModel(dimensionFields); Index numericIndex = new CustomNameIndex(indexStrategy, indexModel, "flightIdIndex");

"flightId" is declared as an attribute at my SimpleFeatureType definition as;
sftBuilder.add(atBuilder.binding(Integer.class).nillable(false).buildDescriptor("flightId"));

When I run my code, it creates two tables for my two different indicies;
cassandraDataStore.addType(adapterForPlane, spatialTemporalIndex, numericIndexForFlightId);
and I am not sure It should be like that or not. Each table has 1 million rows data right now and when I try to query for flightId with the secondary index(my numeric index defined above), query returns nothing. And when I try the same query with my spatial temporal index, query works fine and returns true result but it takes really too much time (approximately 60 seconds).
My query;

final CloseableIterator<SimpleFeature> iterator2 = cassandraDataStore.query( bldr.addTypeName(adapterForPlane.getTypeName()) .allIndicies().constraints( bldr.constraintsFactory() .cqlConstraints("flightId = 8812")) .build());
while (iterator2.hasNext()) { SimpleFeature sf = iterator2.next(); resultList.add(sf); }

So what am I doing wrong about this secondary index for querying in millions of data at cassandra datastore according to Integer field?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions