proximityFetch with ORed baseQuery

36 views
Skip to first unread message

Joe Knapp

unread,
Dec 10, 2010, 9:05:08 PM12/10/10
to javageomodel-discuss
Great utility--currently using the java version in an AppEngine/
Android app. I have a question about proximityFetch() --how does one
do a query on more than one field value, logically ORed together?
E.g., I want the base query to effectively be "foo == param1 || foo ==
param2"

I tried this to no avail:

List<Object> params = new ArrayList<Object>();
params.add("searchterm1") ;
params.add("searchterm2") ;
GeocellQuery baseQuery = new GeocellQuery("fts == searchterm1 || fts
== searchterm2", "String searchterm1, String searchterm2",params) ;
List<Place> objects = GeocellManager.proximityFetch(center, 40, 0,
Place.class, baseQuery, pm);

Result:
UnsupportedDatastoreFeatureException

Joe

Alexandre Gellibert

unread,
Dec 11, 2010, 5:07:23 PM12/11/10
to javageomod...@googlegroups.com
Maybe you could try with parenthesis around "(foo == param1 || foo ==
param2)", because then the proximity fetch method is adding " && geocells.contains(geocellsP)" to your base query.

Can you write the exact message you get in the stack trace ?
--
Alexandre Gellibert
alexandre...@gmail.com

Joe Knapp

unread,
Dec 11, 2010, 7:10:19 PM12/11/10
to javageomod...@googlegroups.com
The parentheses did the trick Alexandre! Thanks so much.

Without the parentheses I was getting the attached stack trace.

Joe

-------------------------------------------------------

org.datanucleus.store.appengine.query.DatastoreQuery$UnsupportedDatastoreFeatureException:
Problem with query <SELECT FROM org.restlet.placeset.server.Place
WHERE fts == searchterm || fts == searchterm2 &&
geocells.contains(geocellsP) PARAMETERS String searchterm, String
searchterm2, String geocellsP>: 'or' filters can only check equality
at org.datanucleus.store.appengine.query.DatastoreQuery.checkForUnsupportedOrOperator(DatastoreQuery.java:902)
at org.datanucleus.store.appengine.query.DatastoreQuery.addExpression(DatastoreQuery.java:845)
at org.datanucleus.store.appengine.query.DatastoreQuery.addExpression(DatastoreQuery.java:855)
at org.datanucleus.store.appengine.query.DatastoreQuery.addFilters(DatastoreQuery.java:827)
at org.datanucleus.store.appengine.query.DatastoreQuery.performExecute(DatastoreQuery.java:228)
at org.datanucleus.store.appengine.query.JDOQLQuery.performExecute(JDOQLQuery.java:89)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
at org.datanucleus.store.query.Query.executeWithArray(Query.java:1371)
at org.datanucleus.jdo.JDOQuery.executeWithArray(JDOQuery.java:312)
at com.beoui.geocell.GeocellManager.proximityFetch(GeocellManager.java:285)
at com.beoui.geocell.GeocellManager.proximityFetch(GeocellManager.java:405)
at org.restlet.placeset.server.Geo.proxQuery(Geo.java:189)
at org.restlet.placeset.server.PlaceQueryHandler$1.handle(PlaceQueryHandler.java:46)
at org.restlet.routing.Filter.doHandle(Filter.java:156)

etc.

Alexandre Gellibert

unread,
Dec 12, 2010, 3:24:47 AM12/12/10
to javageomod...@googlegroups.com
ok, i'm gonna add the parenthesis on the geocell manager side. I dont think it can add a regression in some cases.

Thanks,
Alex
--
Alexandre Gellibert
alexandre...@gmail.com
Reply all
Reply to author
Forward
0 new messages