Solr查询未显示所有字段

时间:2016-04-19 07:34:35

标签: mysql solr

我正在学习solr(5.5.0)并以独立模式运行。

这是solr-data-config.xml:

<dataConfig>
    <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://127.0.0.1/DBN" user="root" password="root"/> 
    <document>
        <entity name="planexample" query="select * from plan where userid=60 limit 3">
            <field column="planid" name="id" />
            <field column="userid" name="userid" />
            <field column="planname" name="planname" />
            <field column="del" name="del" />
        </entity>
    </document>
</dataConfig>

我相应地将字段添加到托管架构中:

<field name="userid" type="int" indexed="true" stored="true" required="true" multiValued="true"/>
<field name="planname" type="string" indexed="true" stored="true" required="true" multiValued="true"/>
<field name="del" type="int" indexed="true" stored="true" required="true"  multiValued="true"/>
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />

但是当我在solr的网页上查询时,例如ip:8983/solr/corename/select?q=del%3A1&wt=json&indent=trueip:8983/solr/corename/select?q=userid%3A60&wt=json&indent=true,结果只会显示除id以外的userid,planname,del,如何制作这些字段在结果中可见? score字段在结果中意味着什么?

结果的一个例子:

{
    "responseHeader": {
        "status": 0,
        "QTime": 1,
        "params": {
            "indent": "true",
            "q": "del:1",
            "_": "1461050814466",
            "wt": "json"
         }
    },
    "response": {
        "numFound": 10,
        "start": 0,
        "maxScore": 0.90468985,
        "docs": [
            {
                "id": "985963",
                "score": 0.90468985
            },
            {
                "id": "1033572",
                "score": 0.90468985
            },
            {
                "id": "1763216",
                "score": 0.90468985
            }
        ]
    }
}

1 个答案:

答案 0 :(得分:1)

您需要提供fl参数,以获取所有存储的字段, 执行&fl=*或逗号分隔的字段列表,即 例如&fl=id,userid,planname,del