我是 Infinispan 的新手,目前正在尝试使用搜索功能。我已经尝试密切关注文档。首先我更新我的cache.xml:
<namedCache
name="cache">
<transaction transactionMode="NON_TRANSACTIONAL"/>
<indexing enabled="true" indexLocalOnly="true"/>
</namedCache>
我正在尝试编写一个查询,该查询将为我提供 search_value 属性的结果列表。这是我拥有的Java代码:
SearchManager searchManager = org.infinispan.query.Search.getSearchManager(cache);
Term t = new Term("attribute_name", search_value);
Query q = new TermQuery(t);
CacheQuery cacheQuery = searchManager.getQuery(q);
List<Object> found = cacheQuery.list();
但是,当我尝试运行测试时,出现此错误:
org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@.\Key\write.lock
at org.apache.lucene.store.Lock.obtain(Lock.java:84)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1098)
at org.hibernate.search.backend.impl.lucene.IndexWriterHolder.createNewIndexWriter(IndexWriterHolder.java:148)
at org.hibernate.search.backend.impl.lucene.IndexWriterHolder.getIndexWriter(IndexWriterHolder.java:115)
at org.hibernate.search.backend.impl.lucene.AbstractWorkspaceImpl.getIndexWriter(AbstractWorkspaceImpl.java:117)
at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.applyUpdates(LuceneBackendQueueTask.java:101)
at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.run(LuceneBackendQueueTask.java:67)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
13/08/02 14:08:25 ERROR lucene.LuceneBackendQueueTask: HSEARCH000072: Couldn't open the IndexWriter because of previous error: operation skipped, index ouf of sync!
是什么导致写锁错误?我什至尝试仅使用索引配置删除 Java 部分,并且存在相同的错误。我没有正确配置缓存吗?任何帮助是极大的赞赏!谢谢!