Home App Docs Github

Fulltext search in custom fields

It would be great to have possibility to search in custom fields and page content, eg. to provide website’s content search.
I looked into content panel, and tried similar query - sth like:


but with no luck. (results empty)

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


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


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


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


Right this case is resolved, but what if I’d like to search in multiple fields?

Based on builder admin query:
query.$or[0].data.title.$regex: .*hubbahubba.*, query.$or[0].data.title.$options: i, query.$or[1].data.description.short.$regex: .*hubbahubba.*, query.$or[1].data.description.short.$options: i,

gives me nothing :frowning: ; while:

query.data.title.$regex: .*hubbahubba.*,
query.data.title.$options: i,

query.data.description.short.$regex: .*hubbahubba.*, query.data.description.short.$options: i,

used separately - work.

At the moment I use $or, query stops working

Similarly - if I’d like to search eg. events that have date from and to specified:
query.data.date.from.$gte: 1597425047724 AND query.data.date.to.$lte: 1597425047724

it works with one condition used, but I don’t know how to do logical AND. $and[0]? Doesn’t work :slight_smile:

Last thing: If I’d like to search within page contents I have to query: query.data.blocks.$regex etc?

Hey @aubergine - for complex queries like with $or try using full objects as values (we parse all values with JSON5). E.g.:


The above should work for $and as well. If it doesn’t - can you send a full example URL you are using so we can help you more specifically debug?

For a search of all content, you can use our (beta) search API that searches the full contents with elasticsearch. Note that elasticsearch doesn’t support partial word matching, so you must search full words. For example, you can search all of our docs that mention “Shopify” with this


Thank you! I’ll try that and let you know! :slight_smile:

Thank you again. It works as needed :slight_smile: