How to using own fields in Live Search?

Hello All :-),

Im a bit new with Plone 5 and atm I'm in delevoping some AddOns. so far its going good, I did first a littel "Blog" AddOn with just one extra textfield, I inculded that Field (withouth index) as described in catalog.xml - what worked fine as I can see in the ZMI. For Testing I did activated an index for the field - the results were the same.

But - if I try to search something in the Livesearch what was entered in the Textfield - I dont get any results.

So my question - Waht do I have to do so that Live Search can find it ?

Thanks a lot for help :slight_smile:



Live search only uses the SearchableText index...if you want something custom to be findable using live search: you need to implement your own indexer (plone.indexer) for SearchableText and provide your own additional content to be indexed to this index.


the addon/helper makes this super easy.

Out of curiosity: If Content Types are made TTW, is it possible to use dexterityindexer ?
... or is there no way to define which fields that are 'searchable' ?

@espenmn Yes, you can edit TTW the XML field model and add indexer:searchable directives.
Here is an example from README file.

  <field name="specialfield" type="zope.schema.TextLine"
    <title>Special field</title>
1 Like

seems like there is a UX bug here that its not clear to users the difference between an SearchableText index and other indexes. This is probably caused by a few things

  • The word index is used for search engines like google to index a whole document, not an individual field. We should perhaps be using a more specific term. ie, "yes I want to index my new content type, thats obviously how I get it searchable".
  • field index is probably an advanced usecase but including all of the fields in the searchabletext is likely a more common usecase. We don't offer a UI for this so users are going to assume Index is the thing they want.
  • anyone used to an SQL system would think of accessing items by field values as something to do with a query. indexes are just an optimisation to make that faster so an advanced concept. Plone is abnormal that it requires an index to make that query possible.

Not sure the right way to fix it but perhaps we could have an UI where you can enable a field to be query-able, searchable or query-able and searchable?

I added if anyone wants to add any other ides/options to it

1 Like