问题
solr mysql response is not proper am using solr 5.5.0 this is my codes
<dataconfig>
<datasource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/dbname" user="user" password="password"/>
<document name="user">
<entity name="user" query="select * from user">
<field column="id" name="id"/>
<field column="name" name="name"/>
</entity>
</document>
</dataconfig>
schema.xml schema file ,I am retrieving id and name indexed
<field column="name" name="name" indexed="true" stored="true"/>
<field column="id" indexed="true" stored="true" name="id"/>
MY output
"responseHeader": {
"status": 0,
"QTime": 5,
"params": {
"q": "*:*",
"indent": "true",
"wt": "json",
"_": "1456634392166"
}
},
"response": {
"numFound": 38,
"start": 0,
"docs": [
{
"id": "1",
"_version_": 1527391572777238500
}
numFound
and id
is correct name
is not coming.
回答1:
The response returns the fields which are specified in the fl
parameter.
Just append fl=id,name
to your query.
来源:https://stackoverflow.com/questions/35679927/solr-5-5-0-response-is-not-proper