0
我需要能夠來搜索文本字段子,通過參數化資源庫的方法,在Neo4j的1.9.5在neo4j存儲庫中使用SDN在lucene中查詢參數?
理想我想能夠調用
getInteractionsByTermAndDateRange(String term,
long startMillis, long endMillis
,並取回每WRInteraction其中「內容」字段中包含「一詞」,具有指定範圍內的pubMillis值(「內容」被指定爲在WRInteraction對象聲明一個FULLTEXT指數)
首先嚐試:
@Query("START n=node:WRInteraction('content:*{0}*') " + " WHERE "
+ " n.pubMillis >= {1} AND n.pubMillis <= {2}" + " RETURN "
+ " n")
Iterable<WRInteraction> getInteractionsByTermAndDateRange(String term,
long startMillis, long endMillis);
這將引發
Caused by: org.apache.lucene.queryParser.ParseException: Cannot parse 'content:*{0}*':
Encountered " "}" "} "" at line 1, column 11.
Was expecting one of:
"TO" ...
<RANGEEX_QUOTED> ...
<RANGEEX_GOOP> ...
at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:211) ~[lucene-core-3.6.2.jar:3.6.2 1423725 - rmuir - 2012-12-18 19:45:40]
at org.neo4j.index.impl.lucene.IndexType.query(IndexType.java:300) ~[neo4j-lucene-index-1.9.5.jar:1.9.5]
第二個嘗試 - 通過參數傳遞整個Lucene的查詢:
@Query("START n=node:WRInteraction('content:{0}') " + " WHERE "
+ " n.pubMillis >= {1} AND n.pubMillis <= {2}" + " RETURN "
+ " n")
不會有好轉......什麼是我應該使用此模式?關鍵要求是能夠將子字符串作爲參數傳遞給存儲庫方法,並返回該字符串存在於「內容」字段中的任何WRInteractions。應該很簡單吧?
謝謝