We've run into an issue with one of our supported sites where two custom fields stop being available in the fields that can be listed. They are of the core text type.

I checked the caches for the fields available to be indexed and found that them problem occurs across all indexes and servers for the entity type in question (in this case Content). Both Solr and DB backed indexes are affected.

If I clear the cache they show up in the interface again.

Both of these fields have a fulltext aggregated field added to them for the purpose of allowing fulltext search and sorting to be perofrmed at the same time.

Our client reports that this causes search views using the fields to stop functioning properly.

Comments

Agileware created an issue. See original summary.

drunken monkey’s picture

Status: Active » Postponed (maintainer needs more info)

So these are normal Field API fields added via the "Manage fields" UI of some content type? Then those should really be stable.
Perhaps the content type itself is added in some custom way, which causes it to shortly "vanish" when rebuilding the caches, or similar?
I'm sorry, but there's little I can do in the way of debugging this. You'd have to debug yourself (probably in SearchApiIndex::getFields(), after clearing the cache) what's going wrong there.

Since we didn't have this complaint before, it seems to work in almost all cases.

Amir Simantov’s picture

Status: Postponed (maintainer needs more info) » Active
Amir Simantov’s picture

Hi, I reopen this issue as it is the closest that I could find to a problem I have.

Situation
Long time ago (3 years) a text_long field was checked to be indexed in the "Fields" tab of the index. Back then it worked well - was being used in views 3.
Recently, a bug report from the client claimed that nodes having a key are nod displayed in the view's result. I have checked in the "Fields" tab and indeed the field was not checked. This seems to be very suspicious because for sure this field was indexed before. Anyway, I have re-checked the field, saved and then re-indexed the site. It came back to work. After a few minutes I have checked the view again and suddenly again - no results! I then looked at the "Fields" tab and the field was not there at all. Disappeared. I cannot find it either in the "Add fields" listbox - it is not there. Cleared caches, nothing. Vanished...

[Project: Bronner]

drunken monkey’s picture

Please see #2 and the steps suggested there. Since I can't reproduce this problem, I can't really help in debugging, either. It's not a common problem, either, so seems to be highly specific to a certain setup.

arpas’s picture

Issue tags: +search index, +field instance, +Feature revert

Found similar issue with a 'Long text' field.

Context:

  • 2 or more bundles (for example, 'event' and 'article') has 'field_body' of type 'Long text'.
  • The same 'field_body' field is reused in both bundles (in 'event' and 'article'). Field instances of 'field_body' field has different settings per bundle. Text processing is set to 'Plain text' in 'article' and 'Filtered text (user selects text format)' in 'event'.
  • Field 'field_body' can be added to search index but it can be impossible to add 'field_body' as related field 'field_body:value' because for 'field_body' field instance in 'article' text processing is set to 'Plain text'. getFields() can't handle field instances with different settings correctly.

I think that possibility to reuse the same field with different settings in multiple bundles can produce unpredictable behavior of search api by design.

For above context field in search_api index can disappear, revert/update of feature with search index can miss such field and more strange difficult to identify bugs can occur.

As a solution for search_api module contributor, I want to suggest starting with at least an informational text on search index creation page to notify about nonsupport of multiple field instances with different settings.

drunken monkey’s picture

Title: Custom text fields disappear from the indexable fields. » Custom text fields disappear from the indexable fields
Version: 7.x-1.21 » 7.x-1.x-dev
Issue tags: -search index, -field instance, -Feature revert

Thanks for the detailed description, I could now indeed reproduce this problem.
I added it to the “Common pitfalls” section of our docs.

As Drupal 7 is nearing its end-of-life, I don’t think this rare, low-impact bug will still be fixed. At a glance, it also seems like the bug might actually be in the Entity API module, which would complicate things further.
Sorry, but still thanks for the additional information! It might still help someone avoid, or more quickly debug, this problem.

PS: It seems you (like many others – it's really easy to misinterpret) are confused by the "Issue tags" field. As the guidelines state, they aren't meant for free text tags related to the issue, but only for specific categorization purposes, usually by module maintainers.
So, if you aren't sure your current usage is correct, please just leave the field empty.