Php Zend_Search_Lucene尝试分配3503812093817007931字节
我有大约250kb的静态HTML需要搜索。我想我会用Zend Lucene来做这个。创建索引需要几秒钟,一切都很好,除非我搜索“关于”,结果如下:Php Zend_Search_Lucene尝试分配3503812093817007931字节,php,zend-framework,search,lucene,Php,Zend Framework,Search,Lucene,我有大约250kb的静态HTML需要搜索。我想我会用Zend Lucene来做这个。创建索引需要几秒钟,一切都很好,除非我搜索“关于”,结果如下: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 3503812093817007931 bytes) in /var/www/u1938159/data/www/----- /protected/vendors/Zend/Search/
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate
3503812093817007931 bytes) in /var/www/u1938159/data/www/-----
/protected/vendors/Zend/Search/Lucene/Storage/File/Filesystem.php on line 163
Error occured while file reading.
其他词似乎也可以。此外,这些文件还包含一些外来文本。所以我必须使用不区分大小写的分析器
Zend_Search_Lucene_Analysis_Analyzer::setDefault(
new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive()
);
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
在这种情况下,加载需要花费很长时间,并且根本不起作用,因此:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate
3503812093817007931 bytes) in /var/www/u1938159/data/www/-----
/protected/vendors/Zend/Search/Lucene/Storage/File/Filesystem.php on line 163
Error occured while file reading.
Lucene有严重的问题还是我自己搞砸了 Lucene没有这些问题,但是
Zend\u Search\u Lucene
有。我不确定你要搜索多少,如果这是一次性的,但我会调查一下
你能用一些数据来扩展你的问题吗
还有一些托管服务,如果您需要更多的指针,请告诉我。我不知道Zend Lucene的具体问题是什么,但是如果您试图搜索一个相对较小的HTML文件,您可能只想尝试使用grep。例如,在命令行上:
cat file.html | grep-i about
查找包含about一词的行
或
cat file.html | grep-i-o-p.{30}About.{30}'
如果你想让About这个词的两边都有30个字符。有多少html文件?因为答案与问题无关,所以被否决。他不是在问其他的搜索方法——他是在问如何解决一个特定的错误。