I am using the search_api module with facetapi and when I save the facet page for one of my search indexes I get this error:
PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'facet' at row 1: INSERT INTO {facetapi} (name, searcher, realm, facet, enabled, settings) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => search_api@contacts:block:profile_background_information:field_contact_addresses:field_contact_address:last_name [:db_insert_placeholder_1] => search_api@contacts [:db_insert_placeholder_2] => block [:db_insert_placeholder_3] => profile_background_information:field_contact_addresses:field_contact_address:last_name [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => a:9:{s:6:"weight";i:0;s:6:"widget";s:14:"facetapi_links";s:7:"filters";a:0:{}s:12:"active_sorts";a:3:{s:6:"active";s:6:"active";s:5:"count";s:5:"count";s:7:"display";s:7:"display";}s:11:"sort_weight";a:3:{s:6:"active";i:-50;s:5:"count";i:-49;s:7:"display";i:-48;}s:10:"sort_order";a:3:{s:6:"active";i:3;s:5:"count";i:3;s:7:"display";i:4;}s:14:"empty_behavior";s:4:"none";s:10:"soft_limit";i:20;s:13:"show_expanded";i:0;} ) in drupal_write_record() (line 6868 of /var/www/mirp/includes/common.inc).
I'm guessing it has to do with the crazyness of what I'm indexing.
I am indexing user accounts, which have profile2 profiles, which have field_collection fields, one of which even has an addressfield in it.
So to have a post code facet I have something like:
Background information profile » Addresses » Address » Postal code
Which has the value profile_background_information:field_contact_addresses:field_contact_address:postal_code
which is 90 characters long.
The field is only varchar (64).
I know this is search_api specific but it could be an issue elsewhere so I'm assuming this falls into the responsibility of the facetapi module.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | facetapi-facet_col_length-1370274-2.patch | 922 bytes | rooby |
Comments
Comment #1
cpliakas commentedYour assumption is correct in that this is Facet API's responsibility. The length of the "facet" field is arbitrarily set to 64 chars. I think there would be no problem in bumping this up to 128 or even 255 if we feel it is necessary. This will require an update to the schema definition coupled with a schema update in an update hook. Adding to the "low hanging fruit" list.
Comment #2
rooby commentedI figure make it large so we don't have to revisit this.
Seeing as there shouldn't be thousands of rows in this table I don't think we need to be mindful of storage space.
Comment #3
cpliakas commentedLooks good to me! Thanks for the contribution.
Comment #4
cpliakas commentedCommitted at http://drupalcode.org/project/facetapi.git/commit/453319a.