PyLucene安装与初试
2016-02-03 10:46
453 查看
安装
尝试在Windows上安装,遇到各种各样的bug,遂放弃在Linux上安装,下载源码,解压缩后根据官网安装指南(http://lucene.apache.org/pylucene/install.html)进行安装
在安装中遇到了如下的问题:
1. 依赖:java jdk, ant
2. 修改MakeFile文件时,环境变量在文件中修改会出问题,需要在terminal中export所有的环境变量
3. 如果需要安装中文分词的工具(Smart Chinese Analyzer), 需要将其对应的jar包解注释,并且找到
–exclude org.apache.lucene.sandbox.queries.regex.JakartaRegexpCapabilities \
在附近加入一句:
–exclude org.apache.lucene.analysis.cn.smart.AnalyzerProfile\
参考文献:http://m.blog.csdn.net/blog/DSbatigol/14448151
初试
现在PyLucene对应的lucene的版本是4.9.0,在使用的过程中发现:1 直接import Lucene是不能直接工作的,需要像Java的引入方式一样才可以。我觉得PyLucene基本就是在用python的语法写java的程序了。类似于:
import sys, os, lucene, threading, time from org.apache.lucene.analysis.miscellaneous import LimitTokenCountAnalyzer from org.apache.lucene.analysis.standard import StandardAnalyzer from org.apache.lucene.document import Document, Field, FieldType from org.apache.lucene.index import FieldInfo, IndexWriter, IndexWriterConfig from org.apache.lucene.store import SimpleFSDirectory from org.apache.lucene.util import Version
2 lucene的每个版本是不向下兼容的,不同版本的代码用的函数的名称可能不一样,所以需要根据安装的版本号,看相应的文档,不过直接看安装包自带的example还是比较方便快捷的。
相关文章推荐
- 在iOS中使用手指简单画线
- Android之SVN异常
- Python日志输出——logging模块
- AsyncTask简单使用
- 小知识点
- Android事件传递机制
- Tencent-电话面试C语言问题汇总
- SharePoint Server 2016 RC 版本输入Query之后无法返回Search Result的解决方案
- Oracle 函数 wmsys.wm_concat 的几个用法
- 关于开源项目pulltorefresh的一些
- SCOI2015 day1
- 一次关闭多个activity最简单方法
- 二分图的最大匹配(匈牙利算法)HDU1083
- Excel 2007 打开 UTF-8 编码 CSV 文件的乱码BUG
- 【数据结构学习笔记】——二叉树的建立、交换、求宽度
- Java日志框架——JCL
- VCL标准化皮肤组件Alphacontrols正式发布v10.24|附下载
- 从头编译php源代码
- oracle分析函数(3)
- 解决 Caused by: android.view.InflateException: Binary XML file line #57: Error inflating class fragmen