brilliancenw / craft-algolia-sync

Easily Sync Data from Craft CMS Into Algolia
Other
1 stars 3 forks source link

FR: matrix fields #26

Open bartrylant opened 1 year ago

bartrylant commented 1 year ago

Any idea when support for Matrix fields would come? Most of my sites have a matrix field per entry, where content editors can add block for subtitles, quotes, body text,… I'd love to send it all to Algolia, but I don't like manual configuration with php files :-)

markmiddleton commented 1 year ago

Any idea when support for Matrix fields would come? Most of my sites have a matrix field per entry, where content editors can add block for subtitles, quotes, body text,… I'd love to send it all to Algolia, but I don't like manual configuration with php files :-)

I'd love to discuss your specific use case, so we make the update in a way that is useful.

For a matrix, it'll be a multidimensional array with the keys as the name(s) of the field(s). This shouldn't be too crazy to implement, I just want to make sure it's what you're looking for.

markmiddleton commented 1 year ago

I'm using this as a sample set of data:

[
{
  "objectID": "sample-record-1",
  "slug": "sample-record-one",
  "postDate": 1667339760,
  "MatrixField": [
    {"TextFieldName": "Sample Text YYY"},
    {"ArrayOfNumbers": [0,1,2]},
    {"ArrayOfWords": ["one-a","two-a","three-a"]}
  ]
},
{
  "objectID": "sample-record-2",
  "slug": "sample-record-two",
  "postDate": 1667858580,
  "MatrixField": [
    {"TextFieldName": "Sample Text ZZZ"},
    {"ArrayOfNumbers": [0,1,2]},
    {"ArrayOfWords": ["one-b","two-b","three-b"]}
  ]
}
]

It looks like you can then target the Algolia configuration on MatrixField.TextFieldName or MatrixField.ArrayOfWords or whatever. I'll work on it this week and give you an update when I have something ready to test.

bartrylant commented 1 year ago

My use case is this:

section 1

section 2

section 3

It would be nice if there would be a control panel page, where I can just select which fields to sync to Algolia. E.g. I could select (with a checkbox) section 1: title, intro, body with blocks of type subtitle, text, table Or something similar

markmiddleton commented 1 year ago

perfect. Ya, the control panel page for field selection is on the short roadmap... it's near the top of the list

fgd007 commented 1 year ago

Is there any update on this feature? I would love to include matrix fields as well to search index since it contains the majority of the content of a entry in my setup

robinbeatty commented 1 year ago

+1 for matrix support