问题
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>
orexternal_<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