How to annotate multi field index in apache geode spring boot application - spring-boot

I am developing a Spring Boot Client cache application (spring-geode-starter version 1.7.5) with a region name say 'Element' having 5 fields (say, id, code1,stDate,endDate,code2). Now I have OQL , i.e. a single select statement from the 4 fields (code1,stDate,endDate,code2) with and & where conditions. I see #Indexed for single fields and #EnableIndexing are used in tutorials to create indexes. ( https://docs.spring.io/spring-boot-data-geode-build/1.7.x/reference/html5/ )
my objective is: To create a single index from client cache application on these 4 fields in sequence code1+code2+stDate+endDate, i.e. single multi field index
can any one help me ?

Related

Changing the token length of Spring Boot Elasticsearch pattern matching size

I am using Spring Boot and Elasticsearch and I am trying to use three character searches but the searches only match on five characters or more.
If I have a user name of 'Bob Smith' I can find the match searching for 'Smith' but searching for 'Bob' does not find a match.
I suspect this is something that needs to be changed in my class ''SearchMappingConfig implements HibernateOrmSearchMappingConfigurer'' but I can't find any information about changing the size of the tokens needed to successfully match a result.
My ''#Entity'' tables have ''#FullTextField(analyzer = "english")'' annotations on the fields I want included in the token searches.
How do I change the length of the search match?
Ideally I would like any three letters to form a match, so a search for 'Ron' would match 'Ronald' and 'Laronda'
Elasticsearch 7.14
Spring Boot 2.7.6
I have been reading Spring Boot and Elasticsearch documentation but cannot find any information about changing the match length.
Hibernate is able to use an Elasticsearch or Lucene client. Our existing project uses Lucene and it would have been a large undertaking to replace that.
The recommended solution is to create new analyzers so that incoming data creates smaller tokens, I didn't want to change analyzers on my existing database.
A lot of the documentation I was able to find pointed to using the Elasticsearch query builder or the Hibernate 5 method of using a wildcard.
I tested our Elasticsearch and found that the wildcard solution would work.
I ended up using the Hibernate 6 method for wildcard searching and it works well.
SearchResult<DataClass> result = searchSession.search(DataClass.class)
.where(f -> f.wildcard()
.fields(
"firstname",
"lastname",
"username",
"currentLegalName")
.matching("*"+searchText.toLowerCase()+"*"))
.fetch(10);
long totalHitCount = result.total().hitCount();
logger.debug("Search results size {}", totalHitCount);

Spring Boot CRUD findall without orderBy: is the order predictable?

Does the list returned by a CRUD repository method such as the following have a predictable order?
List<UserProfile> findAllByGroupKey (String groupKey);
The database is MySQL 5 and Spring Boot version is 2.2.7. I'd like the order of the items in the list to be the same as they were stored in the database, but I'm not sure if it's enough to omit `orderBy' to achieve this result. I couldn't find any documentation on this.
I did some testing with the specified configuration (MySQL 5 and Spring Boot 2.2.7). The answer is definitely "no", at least if the index is not a progressive number (in my case it is an UUID).
The order is in no way predictable based on how the data was entered.
The only way to get the rows in the same order as they were entered into the database is to add an additional sort variable (such as a sequence number or a timestamp) and explicitly sort the rows with "orderBy" based on that variable.

using queries generated by name with Spring Boot

I am trying to write a query in Spring Boot, I have the query written like this
, but when I search for the vehicle objects by year by doing http://localhost:8080/vehicles?year=(year) it returns to me all of the vehicle objects instead of only ones that match the year.
Try this
http://localhost:8080/vehicles?year=2001
If still error try your query in sql command, i think any mistake in your query or check again in your controller file

How to include the boundary values while using spring data jpa

I am writing an application which contains an entity with property named addedDate of type Date.
I have written an interface which extends MongoRepository and defined a method named
findByAddedDateBetween(Date startDate,Date endDate);
But when I query with 2 dates the output only contain list entities between the dates,Not including the entities whose addedDates is the queried dates. I want to include the boundary values also.
According to Spring JPA documentation for MongoDB, the between keyword is not inclusive in Mongo DB if you use 2 parameters.
As an alternative, you can use the spring Range class. You must use this method in order to include boundaries.
findByAddedDateBetween(Range<Date> range)
Where Range is declared like this :
Range<Date> range = Range.of(Range.Bound.inclusive(dateStart), Range.Bound.inclusive(dateEnd));

oData service not returning CLOB field

I have a simple Oracle table with 3 fields: ID (int), Name (nvarchar), and configJSON (CLOB).
The configJSON field is over 10,000 characters.
I am trying to use this table in an oData web service using entity framework. I do not get an error message, but the response is simply blank. When I remember the CLOB column I see the other 2 data fields so I think the issue relates to the large CLOB field. I am not tied to that particular data type but I thought that was the best to use since my field is so large.
What is the best way to return a large data field within an oData web service?
I was able to resolve the issue by changing the field type to a LONG.

Resources