google-code-export / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
1 stars 0 forks source link

unindexed class with enum field can't do filter() #118

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create the class Foo
@Unindexed
public class Foo{
 @Id Long id;
 Type type;  //Type is enum
 int value;
 public Foo(){ value=1; }
 //skip getter and setter
}

2. test the Foo
Objectify ofy = ObjectifyService.begin();
Foo data = new Foo();
ofy.put(data);

System.out.println(ofy.query(Foo.class).list());  //it's fine
System.out.println(ofy.query(Foo.class).filter("value", 1).list());  //empty 
list

What version of the product are you using? On what operating system?
ojbectify 3.0.1, GAE 1.6.1, GPE 2.5.1

Please provide any additional information below.
If remove the "@Unindexed" annotation or add "@Indexed" annotation to every 
field in Foo, it will work fine.

Original issue reported on code.google.com by PT2Club on 27 Jan 2012 at 7:14

GoogleCodeExporter commented 9 years ago
This is the fundamental nature of GAE and the intentional design of Objectify.  
You can only filter by indexed fields.  If the data isn't in the index, the 
query can't find it.  If you are confused, consider posting to the 
objectify-appengine Google Group.

Original comment by lhori...@gmail.com on 27 Jan 2012 at 7:19

GoogleCodeExporter commented 9 years ago
I am sorry to bother you, I make some mistakes in transform class into 
unindexed, so test is wrong... :(

Thank you and your answer

Original comment by PT2Club on 27 Jan 2012 at 7:53