I have an existing datastore entity as below:
@Data
@Entity
public class Data
{
@Id @Index long id;
boolean expired;
}
I am in need to filter the data based on expired field, so I have to change the entity to have the filed expired now indexed. The modified entity is as below:
@Data
@Entity
public class Data
{
@Id @Index long id;
@Index boolean expired;
}
Below is the existing data in the datastore before the Index created:
Column : Data
id : 1
expired : true
id : 2
expired : false
id : 3
expired : false
My intention is to fetch the data using objectify with a filter on expired, so I have my code modified to use the below objectify quering:
return (List<Data>) ofy.load().type( Data.class ).filter( "expired = ", false ).list();
It is supposed to return two records, however it does return nothing. BTW, after Index created, I added a new record into the entity as below
id : 4
expired : false
If I query back, I now see one result and that is with id = 4. Seems the filter works only on the newly added records and the index dint apply on all the old records? How to resolve this problem?