Created
December 8, 2021 19:42
-
-
Save Hkazanci93/2e64ad8a48f3cf1659b7ddffc6d2a596 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.yourcompany.repositories; | |
import java.util.*; | |
import org.springframework.data.geo.Distance; | |
import org.springframework.data.geo.Point; | |
import org.springframework.data.repository.query.Param; | |
import com.yourcompany.domain.Company; | |
import com.redis.om.spring.annotations.Query; | |
import com.redis.om.spring.repository.RedisDocumentRepository; | |
public interface CompanyRepository extends RedisDocumentRepository<Company, String> { | |
// find one by property | |
Optional<Company> findOneByName(String name); | |
// geospatial query | |
Iterable<Company> findByLocationNear(Point point, Distance distance); | |
// find by tag field, using JRediSearch "native" annotation | |
@Query("@tags:{$tags}") | |
Iterable<Company> findByTags(@Param("tags") Set<String> tags); | |
// find by numeric property | |
Iterable<Company> findByNumberOfEmployees(int noe); | |
// find by numeric property range | |
Iterable<Company> findByNumberOfEmployeesBetween(int noeGT, int noeLT); | |
// starting with/ending with | |
Iterable<Company> findByNameStartingWith(String prefix); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment