How can I read and write the external file field in solr?

╄→尐↘猪︶ㄣ 提交于 2019-12-25 07:45:19

问题


I am using External File field in solr for my frequently updated types of data. I had created a file _external_<myfieldTypename> in my Index directory. And my data is like :

4950 = 150.0
4951 = 65.0
4952 = 789.0
4953 = 786.0
4954 = 5.0
4955 = 21.0

Now I had created new field as:

<fieldType name="<myfieldTypename>" class="solr.ExternalFileField" keyField="Name" defVal="1" indexed="false" stored="false" valType="float"/>

<field name="MyFieldName" type="<myfieldTypename>" indexed="true" stored="true"/>

My question is that how can I read data from my external file?

Thanks in advance.


回答1:


Documentation :-

Solr looks for the external file in the index directory under the name of external_<fieldname> or external_<fieldname>.*

So in your case the external field file name should be MyFieldName.txt or external_MyFieldName.txt with the data.

External fields are not searchable. They can be used only for function queries or display.




回答2:


how can I read data from my external file?

Asked the same question to solr-user group. (See here.) Yonik Seely's answer in that thread works fine for me in Solr 4.2.1. The syntax to use is:

fl=*,field(external_file_field)

You can also alias it, like Yonik says:

fl=*,views:field(external_file_field)



来源:https://stackoverflow.com/questions/13722245/how-can-i-read-and-write-the-external-file-field-in-solr

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