问题
Domain class as following:
@NodeEntity
public class Product{
private Long nodeId;
@Indexed(indexName = "productCode")
private String code;
...
}
Repository class:
public interface ProductRepository extends GraphRepository<Product>{
@Query(value="start product=node:productCode(code={0}) return product")
public Set<Product> findProducts(String code);
}
how can I make code lookup case insensitive? I try regular expression and fail.Code as following:
public interface ProductRepository extends GraphRepository<Product>{
@Query(value="start product=node:productCode(code=~{0}) return product")
public Set<Product> findProducts(String code);
}
I know one way works but the performance will be not good, the code as following:
public interface ProductRepository extends GraphRepository<Product>{
@Query(value="start product=node:__types__(className='Product') where product.code='~{0}' return product")
public Set<Product> findProducts(String code);
}
回答1:
One way would be to try and use where clause with regular expressions:
See the latest 2.0 milestone or here for 1.9.5
来源:https://stackoverflow.com/questions/20701091/spring-neo4j-how-can-i-search-data-by-index-field-case-insensitive