Closed (fixed)
Project:
Search API Solr
Version:
7.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
17 Mar 2011 at 12:57 UTC
Updated:
2 Apr 2011 at 21:41 UTC
Jump to comment: Most recent file
Comments
Comment #1
d.olaresko commentedPatch that adds hook_search_api_solr_index_items_alter(). Also contains hook description
Comment #2
drunken monkeyWhy not just rename your custom field to "t_body:summary"?
Regardless, this would really be a useful addition to the module. However, I do think something like
hook_search_api_solr_field_mapping_alter($index, &$fields)would be better. The hook you are proposing largely overlaps withhook_search_api_index_items_alter(), and couldn't really be called at search time. (OK, you could easily do it by providing an empty array, but there is really no point, in my opinion.) However, if you index your data in a different field, chances are pretty high you'll also want to search that field, not another, empty one. This can of course already be altered, but I think we could and should just include it in that hook.How about the attached patch, would that also fit your requirements? Or would you say there is a use case for only altering field mappings when indexing, or only when searching? (We could do this just by using an additional
$phaseparameter, but the code just looks so good right now that I don't want to add this, unless necessary.)Comment #3
d.olaresko commentedCoz sometimes we have complicated fields (property_type "struct") or need to use body and custom fields... if I understood the question correctly.
In my case i`m altering field mapping when indexing and searching. Your patch looks great. I think this will be enough. Thx.
Comment #4
drunken monkeyNo, I don't think so, as I don't really understand your answer.
If I'm not mistaken, you said that you had defined an additional field in the schema.xml as
<field name="body_summary" … />>and wanted to index the node body summary in this field, instead of the dynamic field "t_body:summary". However, if you just define a field with<field name="t_body:summary" … />>, this will have the same effect — i.e., use your field definition instead of the one for the dynamic field. This way, you can easily have fields with custom types, without changing the module's field mapping logic.But, as said, this has its use cases anyways.
OK, committed. Thanks for your input!
Comment #5
d.olaresko commentedit was simple example. In my case latitute solr library need two defined fields named as "lat" and "lng" and location module creates additional property`s for nodes (not fields, something like author settings or comment...).