ashishSober
ashishSober

Reputation: 1251

How to do searching from first character in Google App Engine?

In my pageSearch there is my value which I have to search and the country is my column name and FilterOperator is my Filteration ,If I type "A"(uppercase and lowercase) then it should give value starting with the value "A" that's what I need it.

   Query query=new       Query("customerRolodex").addFilter("country",FilterOperator.EQUAL,pageSearch);//.setFilter(c_r);
   PreparedQuery pq=ds.prepare(query);
   for(Entity result:pq.asIterable()){
     //here i m using json to send and printing data; 
           p=new cust_rolo();
       p.setCountry(result.getProperty("country").toString());
       p.setRegion(result.getProperty("region").toString());
        list.add(p);

  }
   json.put("rows", list);
   out.print(json.toString()); 

Any help would be appreciated and also I applied Greater than or Equal to operator for this

Upvotes: 0

Views: 50

Answers (1)

Peter Knego
Peter Knego

Reputation: 80340

You should use query between a range of values:

.addFilter("country", FilterOperator.GREATER_THAN_OR_EQUAL, pageSearch)
.addFilter("country", FilterOperator.LESS_THAN, pageSearch + "\uffff")

Upvotes: 1

Related Questions