Skip to content
This repository was archived by the owner on Feb 14, 2020. It is now read-only.

Commit ed1e752

Browse files
author
Jeff Boone
authored
Merge pull request #11 from mzhangsfly/query_update
Query update
2 parents e37944e + 9d78dac commit ed1e752

File tree

7 files changed

+33
-301
lines changed

7 files changed

+33
-301
lines changed

src/main/java/com/aerospike/helper/query/Qualifier.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class Qualifier implements Map<String, Object>, Serializable {
6767
protected Map<String, Object> internalMap;
6868

6969
public enum FilterOperation {
70-
EQ, GT, GTEQ, LT, LTEQ, NOTEQ, BETWEEN, START_WITH, ENDS_WITH,
70+
EQ, GT, GTEQ, LT, LTEQ, NOTEQ, BETWEEN, START_WITH, ENDS_WITH,CONTAINING,
7171
LIST_CONTAINS, MAP_KEYS_CONTAINS, MAP_VALUES_CONTAINS,
7272
LIST_BETWEEN, MAP_KEYS_BETWEEN, MAP_VALUES_BETWEEN, GEO_WITHIN
7373
}
@@ -201,8 +201,9 @@ public String luaFilterString() {
201201
luaFieldString(getField()),
202202
value1,
203203
value1);
204+
case CONTAINING:
205+
return String.format("string.find(%s, %s)", luaFieldString(getField()), value1);
204206
case GEO_WITHIN:
205-
System.out.println(value1);
206207
return String.format("%s %d %s %s)", getField(), ParticleType.GEOJSON, value1, value1);
207208
}
208209
return "";

src/main/java/org/springframework/data/aerospike/convert/MappingAerospikeConverter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import com.aerospike.client.Bin;
5454
import com.aerospike.client.Record;
5555
import com.aerospike.client.Value;
56-
import com.aerospike.client.Value.GeoJSONValue;
5756
import com.aerospike.client.Value.MapValue;
5857

5958
/**

src/main/java/org/springframework/data/aerospike/example/CLRentPageRepository.java

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/main/java/org/springframework/data/aerospike/example/RepositoryExample.java

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package org.springframework.data.aerospike.example;
55

66
import java.util.Arrays;
7-
import java.util.Date;
87
import java.util.List;
98

109
import org.springframework.beans.factory.annotation.Autowired;
@@ -13,7 +12,6 @@
1312
import org.springframework.data.aerospike.core.AerospikeOperations;
1413
import org.springframework.data.aerospike.core.AerospikeTemplate;
1514
import org.springframework.data.aerospike.example.config.TestRepositoryConfig;
16-
import org.springframework.data.aerospike.example.data.CLRentPage;
1715
import org.springframework.data.aerospike.example.data.Person;
1816

1917
import com.aerospike.client.AerospikeClient;
@@ -28,9 +26,6 @@
2826
*/
2927
public class RepositoryExample {
3028

31-
@Autowired
32-
protected CLRentPageRepository clrepository;
33-
3429
@Autowired
3530
protected PersonRepository repository;
3631

@@ -45,7 +40,6 @@ public class RepositoryExample {
4540
*/
4641
public RepositoryExample(ApplicationContext ctx) {
4742
aerospikeOperations = ctx.getBean(AerospikeTemplate.class);
48-
clrepository = (CLRentPageRepository) ctx.getBean("CLRentPageRepository");
4943
repository = (PersonRepository) ctx.getBean("personRepository");
5044
client = ctx.getBean(AerospikeClient.class);
5145
}
@@ -87,25 +81,12 @@ protected void cleanUp() {
8781
*
8882
*/
8983
protected void executeRepositoryCall() {
90-
// System.out.println("Results for name startting with letter 'M'");
91-
// List<Person> resultPartial = repository.findByNameStartsWith("M");
92-
// for (Person person : resultPartial) {
93-
// System.out.println(person.toString());
94-
// }
95-
//
96-
97-
98-
99-
System.out.println("Querying by Location.....");
100-
long t = new Date().getTime() - 10*3600*1000;//1484690036000L;
101-
// List<CLRentPage> pages = clrepository.findByGeoLocationWithin( -122.429245, 37.705574 ,10000);
102-
// List<CLRentPage> pages = clrepository.findByPostDateAfterAndGeoLocationWithin(t, -122.429245, 37.705574 ,10000);
103-
List<CLRentPage> pages = clrepository.findByGeoLocationWithinAndPostDateAfter(-122.429245, 37.705574 ,10000, t);
104-
// List<CLRentPage> pages = clrepository.findByPostDateAfter(t);
105-
System.out.println("result count: " + pages.size());
106-
for(CLRentPage p : pages){
107-
System.out.println("......id=" + p.getId() + ", postTime=" + p.getPostDate());
84+
System.out.println("Results for name startting with letter 'M'");
85+
List<Person> resultPartial = repository.findByNameStartsWith("M");
86+
for (Person person : resultPartial) {
87+
System.out.println(person.toString());
10888
}
89+
10990
List<Person> result = repository.findByName("Beauford");
11091
System.out.println("Results for exact match of 'Beauford'");
11192
for (Person person : result) {

src/main/java/org/springframework/data/aerospike/example/data/CLRentPage.java

Lines changed: 0 additions & 229 deletions
This file was deleted.

src/main/java/org/springframework/data/aerospike/repository/query/AerospikeQueryCreator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ private Criteria from(Part part, AerospikePersistentProperty property, Criteria
9898
case STARTING_WITH:
9999
return criteria.startingWith(parameters.next(), fieldName);
100100
case ENDING_WITH:
101-
case CONTAINING:
102101
return null;
102+
case CONTAINING:
103+
return criteria.containing(parameters.next(), fieldName);
103104
case NOT_CONTAINING:
104105
return null;
105106
case REGEX:

0 commit comments

Comments
 (0)