2016-09-21 118 views
0

我正在使用Spring-data-neo4j來處理neo4j操作。我需要根據emailAddress屬性進行不區分大小寫的搜索。我使用followinng代碼做過濾neo4j中的大小寫不敏感的篩選器

session.loadAll(UserN.class, new Filter("emailAddress", "[email protected]"), 1); 

上面的代碼將無法取得與EMAILADDRESS爲[email protected]因爲大寫記錄。我不想像上面提到的here那樣自己編寫密碼查詢,並尋找使用Spring來完成此任務的解決方案。

回答

1

嘗試LIKE操作:

Filter filter = new Filter("emailAddress", "[email protected]"); 
filter.setComparisonOperator(ComparisonOperator.LIKE); 
session.loadAll(UserN.class, filter, 1); 
+0

非常感謝。這對我有效。我改變了你的解決方案有點像 Filter filter = new Filter(「emailAddress」,「(?i)[email protected]」); filter.setComparisonOperator(ComparisonOperator.MATCHES); 我改變了它,因爲我想要精確匹配而不是包含 –