Solr “real time” get - How to include 'text' field?

你。 提交于 2019-12-08 12:25:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!