Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么Solr for Windows需要这么多内存?_Solr_Lucene_Full Text Search_Solr5_Fulltext Index - Fatal编程技术网

为什么Solr for Windows需要这么多内存?

为什么Solr for Windows需要这么多内存?,solr,lucene,full-text-search,solr5,fulltext-index,Solr,Lucene,Full Text Search,Solr5,Fulltext Index,为什么Solr for Windows需要这么多内存 我的Solr数据是SEO关键字(1-10个单词,最多120个符号长度,8亿行)和一些其他数据。架构是: <?xml version="1.0" encoding="UTF-8" ?> <schema name="suggests" version="1.5"> <copyField source="suggest" dest="suggest_exact"/> <types> <

为什么Solr for Windows需要这么多内存

我的Solr数据是SEO关键字(1-10个单词,最多120个符号长度,8亿行)和一些其他数据。架构是:

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="suggests" version="1.5">
<copyField source="suggest" dest="suggest_exact"/>

<types>
    <fieldType name="text_stem" class="solr.TextField" positionIncrementGap="100">
        <analyzer>
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.SnowballPorterFilterFactory" language="Russian" />
        </analyzer>
    </fieldType>
    <fieldType name="text_exact" class="solr.TextField" positionIncrementGap="100">
        <analyzer>
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
        </analyzer>
    </fieldType>
    <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
</types>
<fields>
    <field name="suggest" type="text_stem" indexed="true" stored="true"/>
    <field name="suggest_exact" type="text_exact" indexed="true" stored="false"/>
    <field name="length" type="int" indexed="true" stored="true"/>
    <field name="position" type="int" indexed="true" stored="true"/>
    <field name="wordstat1" type="int" indexed="true" stored="true"/>
    <field name="wordstat3" type="int" indexed="true" stored="true"/>
    <field name="ln" type="int" indexed="true" stored="true"/>
    <field name="wc" type="int" indexed="true" stored="true"/>
 </fields>
那么,我到底想做什么

我向Solr添加了8亿行。这还不是全部——我有30亿行的数据集。行是SEO关键词,如“求职”、“在纽约找工作”等。“建议”字段包含许多相同的常用词,如“工作”、“下载”等。我认为,10%的行中都有“下载”这个词

我提供服务,用户可以在这里进行“下载”之类的查询,并获取包含“下载”一词的所有文档

我创建了一个桌面软件(.NET)来在web服务接口(PHP+MySQL)和Solr之间进行通信。该软件从web服务获取任务,对Solr进行查询,下载Solr结果并提供给用户

要获取所有结果,我向Solr发送get查询,如下所示:

http://localhost:8983/solr/suggests2/select?q=suggest:(job%20AND%20new%20AND%20york)&fq=length:[1%20TO%2032]&fq=position:[1%20TO%2010]&fq=wc:[1%20TO%2032]&fq=ln:[1%20TO%20256]&fq=wordstat1:[0%20TO%20*]&fq=wordstat3:[1%20TO%20100000000]&sort=wordstat3%20desc&start=0&rows=100000&fl=suggest%2Clength%2Cposition%2Cwordstat1%2Cwordstat3&wt=csv&csv.separator=;
如您所见-我使用fq和排序,而不使用分组。 也许有人看到我在Solr查询或方法中的错误-请随时告诉我。
谢谢。

您正在一个未启用DocValues的TrieIntField上排序。这意味着Solr将在堆上保留一个值的副本。对于800M的值,这就是3.2GB的堆。为您的
wordstat3
-字段设置
docValues=“true”
,并重新编制索引应该会大大降低这一要求,但会牺牲一些性能


请注意,Solr(Lucene)不支持单个碎片中超过20亿个文档。这是一个硬限制。如果您计划将30亿个文档索引到同一个逻辑索引中,则必须使用多分片SolrCloud。

您还可以提供缓存大小配置表单
solrconfig.xml
?当然可以。实际上,我不需要Solr中的缓存,因为来自用户的请求是完全不同的。我想可能是大尺寸的不同缓存消耗了内存。但是您只使用默认大小的缓存。那么,我能做什么呢?:)所以,我试过了,效果很好。Solr现在使用的内存不足4GB。非常感谢你!
http://localhost:8983/solr/suggests2/select?q=suggest:(job%20AND%20new%20AND%20york)&fq=length:[1%20TO%2032]&fq=position:[1%20TO%2010]&fq=wc:[1%20TO%2032]&fq=ln:[1%20TO%20256]&fq=wordstat1:[0%20TO%20*]&fq=wordstat3:[1%20TO%20100000000]&sort=wordstat3%20desc&start=0&rows=100000&fl=suggest%2Clength%2Cposition%2Cwordstat1%2Cwordstat3&wt=csv&csv.separator=;