问题
Is it possible to retrieve the "text" field when performing a "real time" get ?
When I perfom a /get request the returned json does not contain the content of the 'text' field.
When I perform a search (/select request) the returned json does contain the content of the 'text' field.
Here is an example where the id is 123:
The search request http://localhost:8984/solr/real/select?q=id:123 returns:
{
"responseHeader":{
"zkConnected":true,
"status":0,
"QTime":4,
"params":{
"q":"id:123"}},
"response":{"numFound":1,"start":0,"maxScore":9.250275,"docs":[
{
"id":"123",
"filename":"SKMBT_C45212120410351.pdf",
"file_size":1793774.0,
"archive_date":"2012-12-04T08:38:12Z",
"content_type":["text/plain; charset=UTF-8"],
"_version_":1611231085639761920,
"text":[TEXT_CONTENT]}]
}
}
Now the get request: http://localhost:8984/solr/real/get?id=123 returns:
{
"doc":
{
"id":"123",
"filename":"SKMBT_C45212120410351.pdf",
"file_size":1793774.0,
"archive_date":"2012-12-04T08:38:12Z",
"content_type":["text/plain; charset=UTF-8"],
"_version_":1611231085639761920
}
}
As you can see the 'text' field is missing.
Is it possible to have the 'text' field included in the /get request response ?
Note that in the schema the 'text' field is correctly marked as stored:
<field name="text" type="text_general" indexed="true" stored="true"/>
回答1:
Real Time Get
As per above link Real Time Get relies on the update log feature. So, you will get the latest document for that id. So, If your last indexing process is missing text field then real-time get wont return that field.
Check the following screenshot.
Screenshot of real-time get and update
来源:https://stackoverflow.com/questions/52261059/solr-real-time-get-how-to-include-text-field