Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8394415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:03:24+00:00 2026-06-09T20:03:24+00:00

I am encountering the following issue: I am trying to grab the users that

  • 0

I am encountering the following issue:
I am trying to grab the users that are within x [miles/km] from the user’s cell
phone. I am using the datastore api for google app engine, I cant figure out
what is the problem. The issue is that when i fetch the record using the
itiration – an error appears telling me i cant use diffeant properties in the
combination filter.

    package com.linkedlive.business;

    import java.io.IOException;
    import java.util.Iterator;

    import javax.servlet.http.*;

    import org.json.JSONArray;
    import org.json.JSONObject;

    import com.biomedica.server.geolocation.GeoLocation;
    import com.biomedica.server.searchtools.SearchForGeolocEntitiy;
    import com.google.appengine.api.datastore.DatastoreService;
    import com.google.appengine.api.datastore.DatastoreServiceFactory;
    import com.google.appengine.api.datastore.Entity;
    import com.google.appengine.api.datastore.KeyFactory;

    @SuppressWarnings("serial")
    public class Venue extends HttpServlet {

    public void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws IOException {
        this.doPost(req, resp);

    }

    public void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws IOException {

        DatastoreService datastore =
      DatastoreServiceFactory.getDatastoreService();


        String cmd=req.getParameter("cmd");
        if(cmd.equals("venuenearby"))
        {
            GeoLocation geo=new GeoLocation();
            SearchForGeolocEntitiy search=new
    SearchForGeolocEntitiy("accounts");// this is a class that i created to set the
    query filters see bellow
            // get request parameters
            float lat=Float.valueOf(req.getParameter("lat"));
            float lng=Float.valueOf(req.getParameter("lng"));
            float rad=Float.valueOf(req.getParameter("rad"));
            // calculate the distance


            Iterable<Entity>
    ent=search.GetJSONForEntitiyNearByUsingBounds(lat,
    lng,geo.getGeoLocationBounds(lat, lng, rad) );
            Iterator<Entity> i=ent.iterator();
            JSONObject json=new JSONObject();
            JSONArray injson=new JSONArray();
            json.put("result", "venuenearby");

            while(i.hasNext())
            {
                try {
                    JSONObject j=new JSONObject();
                    Entity t=i.next();
                    j.put("key",
    KeyFactory.keyToString(t.getKey()));
                    j.put("userid",
    t.getProperty("userid"));
                    j.put("filepath",
    t.getProperty("filepath"));
                    injson.put(j);
                } catch (NullPointerException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

            }
            json.put("body",injson);
            resp.getWriter().write(json.toString());
        }


    }
    }





///////////////////////////////////////////////////////////////////////////////
////////////////////
//////////////////////////  SearchForGeolocEntitiy      
////////////////////////////////////


    package com.biomedica.server.searchtools;

    import java.lang.reflect.Array;
    import java.util.Arrays;

    import com.biomedica.server.geolocation.GeoLocation;
    import com.google.appengine.api.datastore.DatastoreService;
    import com.google.appengine.api.datastore.DatastoreServiceFactory;
    import com.google.appengine.api.datastore.Entity;
    import com.google.appengine.api.datastore.PreparedQuery;
    import com.google.appengine.api.datastore.Query;
    import com.google.appengine.api.datastore.Query.CompositeFilterOperator;
    import com.google.appengine.api.datastore.Query.Filter;
    import com.google.appengine.api.datastore.Query.FilterOperator;
    import com.google.appengine.api.datastore.Query.FilterPredicate;
    import com.google.appengine.api.datastore.Query.CompositeFilter;

     public class SearchForGeolocEntitiy {
     private String EntitiyName;
     private Query q;

     public SearchForGeolocEntitiy(String name)
    {
        EntitiyName=name;
        q=new Query(name);

    }
    public Iterable<Entity> GetJSONForEntitiyNearBy(double lang,double
    lat,double rad,int max_result)
    {
        DatastoreService datastore =
    DatastoreServiceFactory.getDatastoreService();
        // decleeraing filter object




                Filter filter_min_lngt=new
    FilterPredicate("lng", FilterOperator.GREATER_THAN, lang-rad);
                Filter filter_max_lngt=new
    FilterPredicate("lng", FilterOperator.LESS_THAN, lang+rad);
                Filter filter_min_lat=new
    FilterPredicate("lat", FilterOperator.GREATER_THAN, lat-rad);
                Filter filter_max_lat=new
    FilterPredicate("lat", FilterOperator.LESS_THAN, lat+rad);

                Filter filter_lng=new
    CompositeFilter(CompositeFilterOperator.AND,Arrays.asList(filter_min_lngt,filte
    r_max_lngt));
                Filter filter_lat=new
    CompositeFilter(CompositeFilterOperator.AND,Arrays.asList(filter_min_lat,filter
    _max_lat));


                Filter filter=new
    CompositeFilter(CompositeFilterOperator.AND,Arrays.asList(filter_lng,filter_lat
     ));

                q.setFilter(filter);
                PreparedQuery pq = datastore.prepare(q);


                return pq.asIterable();

    }
    public Iterable<Entity> GetJSONForEntitiyNearByUsingSSID(String
    EntityName,String entityID,String SSID)
    {
        DatastoreService datastore =
    DatastoreServiceFactory.getDatastoreService();
        // decleeraing filter object


            Filter filter_entityID=new FilterPredicate(EntityName,
    FilterOperator.EQUAL, entityID);

                Filter filter_min_lngt=new
    FilterPredicate("lng", FilterOperator.EQUAL, SSID);

                Filter filter=new
    CompositeFilter(CompositeFilterOperator.AND,Arrays.asList(filter_entityID,filte
    r_min_lngt));

                q.setFilter(filter);

                PreparedQuery pq = datastore.prepare(q);
                return pq.asIterable();


    }
    public Iterable<Entity> GetJSONForEntitiyNearByUsingBounds(float
    lng,float lat,GeoLocation.GeoLocationBoundry bound)
    {
        DatastoreService datastore =
    DatastoreServiceFactory.getDatastoreService();

        Filter filter_min_lngt=new FilterPredicate("lng",
    FilterOperator.LESS_THAN, bound.lng1);
        Filter filter_max_lngt=new FilterPredicate("lng",
    FilterOperator.LESS_THAN, bound.lng2);
        Filter filter_min_lat=new FilterPredicate("lat",
    FilterOperator.GREATER_THAN, bound.lat1);
        Filter filter_max_lat=new FilterPredicate("lat",
    FilterOperator.LESS_THAN, bound.lat2);

        Filter filter_lng=new
    CompositeFilter(CompositeFilterOperator.AND,Arrays.asList(filter_min_lngt,filte
    r_max_lngt));
        Filter filter_lat=new
    CompositeFilter(CompositeFilterOperator.AND,Arrays.asList(filter_min_lat,filter
    _max_lat));


        Filter filter=new
    CompositeFilter(CompositeFilterOperator.AND,Arrays.asList(filter_lng,filter_lat
    ));

        q.setFilter(filter);

        PreparedQuery pq = datastore.prepare(q);


        return pq.asIterable();
    }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:03:25+00:00Added an answer on June 9, 2026 at 8:03 pm

    You’re hitting a limitation of the datastore. Inequality filters can only be on one property.

    https://developers.google.com/appengine/docs/java/datastore/queries#Restrictions_on_Queries

    The easiest way around this is to use the Search API. Otherwise, you need to build your own geohashing like mechanism to search within a range without using multiple inequality filters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm encountering the following error when attempting to (svn) import from within Xcode). Import
I'm encountering the following error when transcoding using FFMPEG. From what I've been able
Probably the following description of the issue I'm encountering will be a bit vague,
I have the following methods that are encountering some sort of failure with my
I am encountering problems writing XML files using PHP. The following is my php
I'm encountering a consistency issue with an E_DEPRECATED message. I have the following snippet
I am encountering following error on installing pykpass module from http://www.huque.com/software/pykpass/ . Following is
Hi i am encountering the following error when deploying an project from my jdeveloper
I'm new to writing custom ASP.NET server controls, and I'm encountering the following issue:
I am using Cuda SDK 4.0 and am encountering an issue which has taken

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.