Questions concerning SearchableText

My goal is to have only the first name and the last name of a contenttype person in SearchableText. All other contenttype's SearchableText need to stay like they are.

collective.dexteritytextindexer.behavior.IDexterityTextIndexer is active on contact.

That's how SearchableText looked before i started (fieldname == field value):
['lastname', 'firstname', 'title', 'description', 'description', 'title', 'richtext1', 'richtext2', 'id', u'1']
Note that title and description are in the list 2 times.

Since we use the IDublinCore-Behavior I tried to remove title and description with the following code.

from collective.dexteritytextindexer.utils import no_longer_searchable
no_longer_searchable(IBasic, 'title')
no_longer_searchable(IBasic, 'description')

So i got:
['lastname', 'firstname', 'description', 'title', 'richtext1', 'richtext2', 'id', u'1']
Now title and description are in the list only 1 time. Does anyone know why?

As far as I unterstand this is a "global" solution, which influences all contenttypes. Right?! If so, how do I change only SearchableText of contenttype contact?

Easiest is not to use collective.dexteritytextindexer but registering an own indexer specific to the type, reading and returning just the two fields content.

Documentation how to do it can be found here
If there are any questions left just ask here.

1 Like

Thanks for your answer. It worked for me.

Actually I already tried your approach before but forgot to turn off the IDexterityTextIndexer-behavior. So my custom indexer was overwritten by the behavior.