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
具有多场面的Solr分组_Solr_Lucene - Fatal编程技术网

具有多场面的Solr分组

具有多场面的Solr分组,solr,lucene,Solr,Lucene,我想知道是否可以使用solr query: 需要考虑的两列:位置1、位置2 要在两列上都做一个面 以下查询将起作用: http://localhost:8983/solr/select/? q=*:*&version=2.2&rows=0&facet=true&facet.field=location1&facet.field=location2 响应: <response> <lst name="respons

我想知道是否可以使用solr query

  • 需要考虑的两列:位置1、位置2
  • 要在两列上都做一个面 以下查询将起作用:

    http://localhost:8983/solr/select/? q=*:*&version=2.2&rows=0&facet=true&facet.field=location1&facet.field=location2
    
    响应:

        <response>
            <lst name="responseHeader">
                <int name="status">0</int>
                <int name="QTime">13</int>
            </lst>
            <result name="response" numFound="7789" start="0"/>
            <lst name="facet_counts">
            <lst name="facet_queries"/>
            <lst name="facet_fields">
            <lst name="location1">
                <int name="Chicago">100</int>
                <int name="NewYork">50</int>
                <int name="Washington">30</int>
            </lst>
            <lst name="location2">
                <int name="Washington">200</int>
                <int name="Philadelphia">100</int>
                <int name="Chicago">50</int>
            </lst>
    <response>
    
    目前,我们在服务层进行这项工作。但是,在solr中使用结果分组可以做到这一点吗?我的理解是,结果分组提供了所有数据的聚合,但没有进行方面主题聚合。

    Solr没有字段

    您可能可以在索引时使用组合值创建一个新字段,并将这些字段用于刻面

    编辑:-
    使用复制字段将两个字段的内容复制到单个字段,并对其执行facet。只需更改模式并重新索引数据

    您需要将
    位置1
    位置2
    存储在一个多值字段中,例如
    位置
    。然后可以发出此方面查询以获取所需内容:

    q=*:*&rows=0&facet=true&facet.field=locations
    

    谢谢Jayendra!但对我来说,位置1和位置2不是多值字段。我能得到这些计算结果吗?如果它不是多值字段,那么你如何在其上刻面?它们是两个不同的字段,位置1和位置2。I这两个字段都是方面搜索的一部分。类似这样的事情:facet.field=location1&facet.field=location2使用复制字段将两个字段的内容复制到单个字段,并对其执行facet。只需要模式更改和数据更新的重新索引:分组方面支持单值和多值字段。默认值为false。Solr4.0除了在服务层进行分组外,没有其他方法可以对这两个字段进行分组吗?比如说解析json并将其与自定义代码分组?
    Support for grouping on a multi-valued field has not yet been implemented. 
    
    q=*:*&rows=0&facet=true&facet.field=locations