DocFetcher-1.1.22(最新简体中文版)


个人自用,花了几个小时翻译得来。全为精校版的简体中文。谢谢下载~
资源截图
代码片段和文件信息
#!/usr/bin/env python
# -*- coding: utf-8 -*-

“““
This script sends the given command-line arguments as a query to the running
DocFetcher instance. The results returned by the latter are printed as filename-
filepath pairs on the standard output.

For more advanced processing of the results call the search function below
directly. In principle you can also reuse the code in the search function for
arbitrarily scripting the DocFetcher instance.

By default DocFetcher‘s scripting support is disabled due to security reasons
and must be enabled by setting the variable “PythonApiEnabled“ in the advanced
settings file (program-conf.txt) to “true“.

Running this script requires Py4J (https://www.py4j.org/). DocFetcher already
ships with a Py4J distribution but it only works if the py4j folder is in the
same folder as this script. To script DocFetcher from a different location move
the py4j folder there or install Py4J separately.

Note that only the main DocFetcher program instance supports scripting not the
DocFetcher daemon.
“““

def main():
import sys
if len(sys.argv) <= 1:
print(“No query specified.“)
return
query = “ “.join(sys.argv[1:])
try:
result_docs = search(query 28834)
for doc in result_docs:
print(doc.getFilename() + “ “ + doc.getPathStr())
except:
print(“ERROR: “ + str(sys.exc_info()[1]))

# string int -> [ResultDocument]
def search(query port):
“““Sends the given query string to the running DocFetcher instance at the
given port and returns a list of result objects.

The result objects provide the following getter methods for accessing their
attributes:
- getAuthors
- getDateStr - e-mail send date
- getFilename
- getLastModifiedStr - last-modified date on files
- getPathStr - file path
- getScore - result score as int
- getSender - e-mail sender
- getSizeInKB - file size as int
- gettitle
- getType
- isEmail - boolean indicating whether result object is e-mail or file

This method will throw an error if communication with the DocFetcher
instance fails.
“““
from py4j.java_gateway import JavaGateway GatewayParameters
from py4j.java_gateway import java_import

gateway = JavaGateway(gateway_parameters=GatewayParameters(port=port))
java_import(gateway.jvm “net.sourceforge.docfetcher.gui.Application“)
application = gateway.jvm.net.sourceforge.docfetcher.gui.Application

indexRegistry = application.getIndexRegistry()
searcher = indexRegistry.getSearcher()
results = searcher.search(query)
return results

if __name__ == “__main__“:
main()

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-08-15 08:15  conf
     文件        7362  2018-07-30 15:32  confprogram-conf.txt
     文件        2688  2018-08-15 15:48  confsettings-conf.txt
     文件      366089  2018-07-30 15:32  docfetcher-daemon-linux
     文件      563621  2018-07-30 15:32  docfetcher-daemon-windows.exe
     文件         310  2018-07-30 15:32  DocFetcher-GTK2.sh
     文件         291  2018-07-30 15:32  DocFetcher-GTK3.sh
     目录           0  2018-08-15 08:15  DocFetcher.app
     目录           0  2018-08-15 08:15  DocFetcher.appContents
     文件         902  2018-07-30 15:32  DocFetcher.appContentsInfo.plist
     目录           0  2018-08-15 08:15  DocFetcher.appContentsMacOS
     文件         503  2018-07-30 15:32  DocFetcher.appContentsMacOSDocFetcher
     目录           0  2018-08-15 08:15  DocFetcher.appContentsResources
     文件      183618  2018-07-30 15:32  DocFetcher.appContentsResourcesDocFetcher.icns
     文件       39424  2018-07-30 15:32  DocFetcher.exe
     目录           0  2018-08-15 08:15  help
     目录           0  2018-08-15 08:15  helpChinese
     文件       13370  2018-07-30 15:32  helpChineseDocFetcher_Manual.html
     目录           0  2018-08-15 08:15  helpChineseDocFetcher_Manual_files
     文件         167  2018-07-30 15:32  helpChineseDocFetcher_Manual_filesullet.png
     文件        5944  2018-07-30 15:32  helpChineseDocFetcher_Manual_filesIndexing_Options.html
     文件        3109  2018-07-30 15:32  helpChineseDocFetcher_Manual_filesMemory_Limit.html
     文件        4245  2018-07-30 15:32  helpChineseDocFetcher_Manual_filesPortable_Repositories.html
     文件        2900  2018-07-30 15:32  helpChineseDocFetcher_Manual_filesPreferences.html
     文件        8822  2018-07-30 15:32  helpChineseDocFetcher_Manual_filesQuery_Syntax.html
     文件        5137  2018-07-30 15:32  helpChineseDocFetcher_Manual_filesRegular_expressions.html
     文件        2022  2018-07-30 15:32  helpChineseDocFetcher_Manual_filesRelease_Notification.html
     文件        1162  2018-07-30 15:32  helpChineseDocFetcher_Manual_filesstyle.css
     文件        1301  2018-07-30 15:32  helpChineseDocFetcher_Manual_filesWatch_Limit.html
     目录           0  2018-08-15 08:15  helpEnglish
     文件       15508  2018-07-30 15:32  helpEnglishDocFetcher_Manual.html
............此处省略222个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)