Fulltext search in custom fields

Hey @aubergine - try leaving out the *'s, e.g.

query.data.myCustomField.$regex="searchText"

E.g. you can query all of our docs that have the text “Builder” in them with this

https://cdn.builder.io/api/v2/content/docs-content?apiKey=YJIGb4i01jvw0SRdL5Bt&query.data.title.$regex="Builder"&fields=name

You can make this a little nicer too by making the search case insensitive by also adding query.data.myCustomField.$options=i

https://cdn.builder.io/api/v2/content/docs-content?apiKey=YJIGb4i01jvw0SRdL5Bt&query.data.title.$regex="Builder"&fields=name&query.data.title.$options=i

You can find more info about mongodb’s regex operator here

Steve

1 Like