zhengyu zhengyu - 2 years ago 110
SQL Question

Solr query doesn't show all the fields

I am learning solr (5.5.0) and running in a standalone mode.

Here is the solr-data-config.xml:

<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://" user="root" password="root"/>
<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" />

And I add fields accordingly into managed-schema:

<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" />

But when I do query on the webpage of solr, for example,
, results only show the
, how to make those fields visible in results? And what does the
field mean in results?

One example of results:

"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

Answer Source

You need to provide a fl parameter, to get all stored fields, do &fl=*, or a comma seperated list of fields you want i.e. &fl=id,userid,planname,del for example.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download