Sunspot solr get field_names from searchable

87 Views Asked by At

how can i retrieve field list defined in searchable block ?

For example from:

Class Model < ...
searchable do 
string :field_string
int :field_int 
...
end 
end

get [:field_string, :field_int, ....]

Thanks

1

There are 1 best solutions below

0
EricLavault On

Use field_list (@see documentation and field_list.rb) :

field_list [:field_string, :field_int]

It is mapped to Solr fl parameter :

The fl parameter limits the information included in a query response to a specified list of fields.
The fields must be either stored="true" or docValues="true"