Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
I have content with table field. I need to perform a search in the table, but it is impossible to index the tablfield value with Search API module.
Environment:
- Modules: Search API, Search API Solr, Tablefield
- Configured Solr Server and Default index
- Content type with tablefield
I can't index the table field from the Default Index configuration page, because there is no tablefield property that can be indexed.
Comment | File | Size | Author |
---|---|---|---|
#16 | tablefield-indexing-2746421-16.patch | 1.81 KB | Eric_A |
#9 | Sample index purple.dev_.jpeg | 66.93 KB | lolandese |
#9 | tablefield-indexing-2746421-9.patch | 1.46 KB | lolandese |
#2 | tablefield-indexing-2746421-2.patch | 1.25 KB | nikolabintev |
Comments
Comment #2
nikolabintev CreditAttribution: nikolabintev commentedHere is my patch that allows to index the data in the table field. I've created a table_value property that can be indexed. Also I've created a getter callback tablefield_get_table_value that implodes all the table cells data in one string.
Comment #3
nikolabintev CreditAttribution: nikolabintev commentedComment #4
nikolabintev CreditAttribution: nikolabintev commentedComment #5
jenlamptonSee related #2243877: ApacheSolr not indexing nodes with tablefield
Comment #6
nikolabintev CreditAttribution: nikolabintev commentedComment #7
jenlampton@nikolabintev any particular reason for the bump from normal to major?
Comment #8
jenlamptonThis still needs a review, so sadly won't be making it into the next release. @nikolabintev if you could find someone to test it out for us I'd love to see it get in soon!
Comment #9
lolandese CreditAttribution: lolandese at HCL Technologies Limited commentedRerolled patch against latest dev. Tried with solr server.
As opposed to before applying the patch the table field can now be selected to be indexed at admin/config/search/search_api/index/[sample_index]/fields:
Comment #11
lolandese CreditAttribution: lolandese at HCL Technologies Limited commentedComment #14
lolandese CreditAttribution: lolandese at HCL Technologies Limited commentedThe same need seems to exist for Drupal 8. See #2923928: The table content in Drupal 8 cannot be indexed with the Search API..
Comment #15
Eric_A CreditAttribution: Eric_A at Dutch Open Projects commentedComment #16
Eric_A CreditAttribution: Eric_A at Dutch Open Projects commentedHere's a forward port. Anyone able to test or review?
Comment #17
Eric_A CreditAttribution: Eric_A at Dutch Open Projects commentedComment #18
rolfmeijer CreditAttribution: rolfmeijer at Dutch Open Projects commentedYes, the patch works.
Comment #19
lolandese CreditAttribution: lolandese at HCL Technologies Limited commentedChanging status based on #18.
Comment #20
efrainhI confirm #16 is working, i tested with the same environment described above, i got a new item when adding a new field to the search index, it appears as "Stringified table value (field_table:table_value)", I added it as FullText, and now after reindexing i can find the content of the tables when searching on my site.
Thanks Eric_A.
Comment #22
Liam MorlandComment #24
lolandese CreditAttribution: lolandese at Cognizant Technology Solutions commentedFor clarification adding a screenshot from /admin/config/search/search-api/index/default_index/fields: