【问题标题】:html files encryption for client side客户端的html文件加密
【发布时间】:2012-09-22 15:38:22
【问题描述】:

在搜索我想在那里显示 html 文件的关键字后,我正在使用 lucene 在客户端进行索引和搜索。那么有什么方法可以存储和访问 html 文件。实际上 html 文件存储图像和链接,它们应该在 java api 中作为普通 html 文件打开。 我正在使用以下代码进行 lucene 索引

  try
  {

        IndexWriter indexWriter = new IndexWriter(

        FSDirectory.open(indexDir),

        new SimpleAnalyzer(),

        true,
        IndexWriter.MaxFieldLength.LIMITED);
        indexWriter.setUseCompoundFile(false);
        indexDirectory(indexWriter, dataDir, suffix);

        Document doc = new Document();

        doc.add(new Field("contents", new FileReader(f))); 

        doc.add(new Field("filename",f.getCanonicalPath(),

        Field.Store.YES,Field.Index.ANALYZED));
        indexWriter.addDocument(doc);

        numIndexed = indexWriter.maxDoc();

        indexWriter.optimize();

        indexWriter.close();

        } 

        catch(Exception ex)
        {
        }

我应该如何在客户端显示匹配搜索条件的html文件

【问题讨论】:

  • 正如所写(甚至在编辑之后),您的问题难以理解。什么 HTML 文件?这些文件是如何添加到 Lucene 中的,它们存储在哪里?您是在谈论桌面(Swing)客户端还是 Web 客户端?客户是否有权访问原始文件?
  • 我的建议是你退后一步,画出你的应用程序框图,然后再问你的问题。除非该代码以某种方式特定于您的问题(它看起来像是将文档添加到 Lucene 索引的通用代码),否则只需将其删除。

标签: java swing lucene swingutilities


【解决方案1】:

您可能正在寻找 browse(),它“启动默认浏览器以显示 URI”。或者,可以使用editor pane,尽管支持是limited

【讨论】:

  • @David:我很难在(垃圾桶)之外思考。 :-)
猜你喜欢
  • 1970-01-01
  • 2016-09-07
  • 1970-01-01
  • 2020-03-23
  • 2011-11-30
  • 2017-11-07
  • 1970-01-01
  • 2022-11-10
  • 1970-01-01
相关资源
最近更新 更多