I was trying to work out why some fields that have sub-properties can be added as the field itself, and some can't.
Eg, I have image fields and I can add either the whole field, or expand the field and add the sub-properties.
But with a geolocation field, I can't add the whole field.
It looks like it's this code which is removing the field, because its type isn't recognized:
// Don't allow indexing of properties with unmapped types. Also, prefer
// a "parent.child" type mapping (taking into account the parent property
// for, e.g., text fields).
$type = $property->getDataType();
if ($parent_child_type && !empty($type_mapping[$parent_child_type])) {
$type = $parent_child_type;
}
elseif (empty($type_mapping[$type])) {
// Remember the type only if it was not explicitly mapped to FALSE.
if (!isset($type_mapping[$type])) {
$this->unmappedFields[$type][] = $label_prefix . $label;
}
$can_be_indexed = FALSE;
}
The UI should really explain why this is happening, otherwise it's really confusing. A message appended to the field label such as "No handling available for data type foobar".
Comments
Comment #2
ndrake86 commentedAn explanation would be ideal, not so much cause I care to index some of the field properties but that I get opaque warnings in the reports tab
Warning while retrieving available fields for index index: could not find a type mapping for the following fields Solution type » Taxonomy term (type entity:taxonomy_term)even though without the add button I wouldn't even try to index it since that is completely disabled. Also it looks like the types are allowed are just hardcoded in the module is that correct?and there is a hook to alter the mappings but what happens if I were to alter the taxonmy term type mapping wouldn't this just blow up, I think knowing why I cant would help out there.
Comment #3
drunken monkeyYou should be able to just add a mapping from
entity:taxonomy_termtointeger. We could also just do it in the module, I guess. The log message is there so we can collect data types which we missed before and add them to the mapping. But I guess we'll have to (or, at least, should) remove it before creating a stable release. In production use, the warning is really too confusing – as you say, it doesn't really warn you that anything is wrong on your site, it just warns the module's developers that there are data types they didn't include in the mapping.At that point, we could also think about whether we want to do anything else with that information, to better inform users.
Comment #4
drunken monkeyTwo patches: the first would just remove the warning, the second would move it to the bottom of the page and give instructions what to do about it.
Any opinions on which we should commit, or suggestions for a third alternative? (Also, suggestions for improving the phrasing of all text in the new UI element are very welcome.)
Comment #5
ndrake86 commentedI like the second option, it still gives you the notification but doesn't push it to reports (where truthfully I never check, someone else brought it to my attention and I was trying to figure out how I screwed it up). I know it probably not possible to say why the storage is unavailable but that would nice (wishful thinking). My only real comment on verbage is maybe change:
The following fields cannot be indexed since there is no type mapping for them:to
The following fields cannot be indexed as they have no available(usable) type mappings:But that is just my brain spitting that out as what I understand the problem to be; the storage definition for a particular field is unavailable because of xy reason. Probably some custom storage being used my those fields.
+1 for RTBC but will wait to see if anyone else has any other comments.
Comment #6
borisson_Comment #8
drunken monkeyThanks for reviewing, both of you!
Committed.
No, not quite. It's that, for some reason, we don't have a mapping for the property's type to one of our Search API data types. Either because we don't know about the type, or because the type (as in the case of
entity:*) represents complex data which can't just be indexed in a single field.Comment #9
drunken monkey