-
lucene IndexReader.open(dir) 报错5
请问大师,下面的错误是怎么导致的?
java.security.AccessControlException: Access denied (java.lang.reflect.ReflectPermission suppressAccessChecks)
at java.security.AccessController.checkPermission(AccessController.java:108)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:544)
at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:118)
at org.apache.lucene.store.MMapDirectory$1.run(MMapDirectory.java:166)
at java.security.AccessController.doPrivileged(AccessController.java:251)
at org.apache.lucene.store.MMapDirectory.cleanMapping(MMapDirectory.java:162)
at org.apache.lucene.store.MMapDirectory$MMapIndexInput.close(MMapDirectory.java:440)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:647)
at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:72)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:256)
at JavaAgent.getResult(Unknown Source)
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
java.lang.NullPointerException
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
报错修改代码为:
FSDirectory dir = SimpleFSDirectory.open(folder);
IndexReader reader = IndexReader.open(dir);
其中folder确定是存在的,路径无误。2013年6月24日 09:43
目前还没有答案
相关推荐
IndexReader reader = DirectoryReader.open(directory); IndexSearcher searcher = new IndexSearcher(reader); QueryParser parser = new QueryParser("content", new StandardAnalyzer()); Query query = ...
IndexReader reader = DirectoryReader.Open(dir); IndexSearcher searcher = new IndexSearcher(reader); QueryParser parser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "content", new ...
var directory = FSDirectory.Open(new DirectoryInfo("index_dir")); var indexWriterConfig = new IndexWriterConfig(LuceneVersion.LUCENE_48, analyzer); using (var indexWriter = new IndexWriter...
dir.close(); ``` #### 四、Lucene依赖包配置 为了在项目中使用Lucene,需要在项目的构建文件(如Maven的`pom.xml`文件)中添加以下依赖项: ```xml <lucene-version>5.3.1</lucene-version> <groupId>...
IndexReader reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo("path/to/index"))); IndexSearcher searcher = new IndexSearcher(reader); Query q = new QueryParser(Version.LUCENE_29, ...
Directory directory = FSDirectory.open(new File("index_dir")); IndexWriterConfig config = new IndexWriterConfig(LuceneVersion.LUCENE_33, new IKAnalyzer()); IndexWriter indexWriter = new IndexWriter...
Directory directory = FSDirectory.open(Paths.get("index_dir")); IndexWriterConfig config = new IndexWriterConfig(analyzer); IndexWriter writer = new IndexWriter(directory, config); Document doc = new...
Directory dir = FSDirectory.open(Paths.get("path_to_index_dir")); IndexWriterConfig config = new IndexWriterConfig(analyzer); IndexWriter indexWriter = new IndexWriter(dir, config); ``` 5. **添加文档...
Directory dir = FSDirectory.open(new File("index_dir")); IndexWriter writer = new IndexWriter(dir, config); Document doc = new Document(); doc.add(new TextField("title", "示例文档标题", Store.YES)); ...
IndexReader reader = IndexReader.open(dir); IndexSearcher searcher = new IndexSearcher(reader); TopDocs docs = searcher.search(new TermQuery(new Term("desc", "car")), 10); System.out.println(docs....
Directory directory = FSDirectory.open(Paths.get("index_dir")); IndexWriter indexWriter = new IndexWriter(directory, config); // 添加文档到索引 Document doc = new Document(); doc.add(new TextField(...
- **IndexReader**:`open(IndexDirectory dir)`打开索引目录,`doc(int docId)`获取指定ID的文档。 - **Searcher**:`search(Query query, Collector results)`执行查询,`explain(int doc, Query query)`解释...