Retrieving specific fields in a Solr query?

2019-01-22 10:39发布

I am running a Solr instance on Jetty and when I search using the Solr admin panel, it returns the entire document. What should I do to get only specified fields from each Solr document returned by the search?

标签: lucene solr
5条回答
可以哭但决不认输i
2楼-- · 2019-01-22 11:11

From the Solr Admin home page, click on "Full Interface". On that page there is a box called "Fields to Return". You can list the you want here (comma-separated). "*" means all fields.

查看更多
聊天终结者
3楼-- · 2019-01-22 11:11

The best way is to run the query from Admin concole. When we run it, it also provides the actuall SQL query executed. Just copy the query and use it.

About the question: select specific fields from the table. In the admin console look for 'FL' text box. write the field names you want to retrieve, comma sapereted. Hit the 'Execute Query' button. Top right side the SQL will be available.

Generated Query: ......select?fl=FIELDNAME&indent=on&q=:&wt=json

查看更多
放我归山
4楼-- · 2019-01-22 11:22
http://xx.xxx.xx.xx:8983/solr/corename/select?indent=on&q=*:*&wt=json&fl=ImageID,Imagepath,Category

This link has fl parameter: fl is a field list, which will display the specified fields from the indexed list.

查看更多
▲ chillily
5楼-- · 2019-01-22 11:28

you can simply pass fl parameter with required fields name in your query.

&fl=field1,field2,field3&query=:

your response documents contains only mentioned fields.

查看更多
该账号已被封号
6楼-- · 2019-01-22 11:34
/?q=query&fl=field1,field2,field3
查看更多
登录 后发表回答