#Search plugin - media and relationships

7 messages · Page 1 of 1 (latest)

deep sun
#

Hi, first time using PayloadCMS and the search plugin.

I have 2 tables with a name, a media and a tags relationship field. I'm using name as title.

I want to be able to enable search on those collections, so that in a search page I'm able to preview the title with an image and tags on top.

I setup the search plugin. I added those fields to searchOverrides.fields and merged the searchDoc with the originalDoc in the beforeSync.

3 doubts:

  • is it ok and correct to put all the fields used in the search page in the search collection or should I only put searchable fields and then retrieve the original doc somehow?
  • is it ok to put media and relationship in the search collection in general?
  • can the default title be removed to keep consistency with the original tables and use name instead or should I keep it?

Thanks!

hexed shoalBOT
heavy lava
#

Put the least amount of data that you need to build your search logic around, and then use Payloads API's to fetch the rest as needed.

#

Example: Ecommerce T-shirt store

Search collection will hold only the slug, thumbnail image, title, and price. Everything else you fetch directly from your products.

#

is it ok to put media and relationship in the search collection in general?
Yep, that's fine.

#

can the default title be removed to keep consistency with the original tables and use name instead or should I keep it?
This is up to record keeping and preference. What will make it easier for your admins?

#

Most business admins I work with are not technically savvy, so keeping it minimal and simple is a must.