0

I am using search API on my website (Version 1.8), I have a problem with indexing custom fields. In the Configuration -> Search and metadata -> Search API I have added the custom fields to be indexed, in the view in the "Fulltext search" the custom fields appeared. In the database I can see that the fields got indexed. But when I test, there is no result. Has anyone had similar troubles with Search API?

Edited: The problem occurs only with the fields of "Entity reference" type

  • The problem occurs only with the fields of "Entity reference" type well that's because entity reference fields are saved as id's (numbers and not text) in the database. So if you were to search by id it should work. – No Sssweat Nov 1 '18 at 7:11
  • Thanks, but most obviously the users will search other users by names, not by ids. I am searching for some additional module, which could map ids with the names. – user89638 Nov 5 '18 at 8:04
0

You probably need to index the referenced entity Name* (assuming you want to search on name) as a field instead of just simply the entity ID (which is what entity reference fields actually store). The pattern should look something like the following on the 'fields' page:

field_yourfield:entity:name

  • I am doing that, but not working. Have indexed field_contact:entity:name , made "Fulltext" type, but no result. – user89638 Nov 5 '18 at 8:05
  • Down on the page there is a note: The following fields cannot be indexed since there is no type mapping for them: – user89638 Nov 5 '18 at 9:21
  • Hm I would say forget the fulltext and just try as a string (no need for fulltext with an entity name). What exactly is the entity reference to? Sounds like maybe it’s users? – twill Nov 6 '18 at 11:06
  • yes, exactly. I have a custom field_contact field. And I need to implement search by contact. So in the interface i picked field_contact:entity:name but getting abovementioned message – user89638 Nov 7 '18 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy