Using fulltext for searching for a field within a slice

Hey all, I'm currently trying to implement fulltext search for our app that uses prismic. I'm trying to be able to use this code here:

this.$prismic.Predicates.fulltext('my.article.body_content', keyWords)

body_content is within a slice within my custom type, article. What's weird though is with the code above, I get a 400 from Prismic and I'm not sure why.

This is the format of my custom type, article.

{ "Main": { "title": { "type": "StructuredText", "config": { "single": "heading1", "allowTargetBlank": true, "label": "Title" } }, "category": { "type": "Link", "config": { "select": "document", "customtypes": ["category"], "label": "Category" } }, "subcategory": { "type": "Link", "config": { "select": "document", "customtypes": ["subcategory"], "label": "Subcategory" } }, "user_type": { "type": "Select", "config": { "options": ["fiserv,", "worldpay"], "label": "User Type" } }, "uid": { "type": "UID", "config": { "label": "article", "placeholder": "article" } }, "body": { "type": "Slices", "fieldset": "Slice zone", "config": { "labels": { "quote": [{ "name": "section", "display": "section" }], "quote1": [{ "name": "quote", "display": "quote" }], "tip": [{ "name": "tip", "display": "tip" }] }, "choices": { "section": { "type": "Slice", "fieldset": "Section", "description": "A logical section for the article", "icon": "add_alert", "non-repeat": { "top_image": { "type": "Image", "config": { "constraint": {}, "thumbnails": [], "label": "top image" } }, "section_headline": { "type": "StructuredText", "config": { "single": "heading1, heading2, heading3, heading4, heading5, heading6", "label": "Section Headline" } }, "body_content": { "type": "StructuredText", "config": { "multi": "paragraph, preformatted, strong, em, hyperlink, image, embed, list-item, o-list-item, rtl", "allowTargetBlank": true, "label": "Body Content", "placeholder": "Fill This In" } }, "quote_title": { "type": "StructuredText", "config": { "single": "paragraph, preformatted, heading1, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, rtl", "label": "quote title" } }, "quote_author": { "type": "StructuredText", "config": { "single": "paragraph, preformatted, heading1, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, rtl", "label": "quote author" } } }, "repeat": { "image": { "type": "Image", "config": { "constraint": { "width": 300, "height": 200 }, "thumbnails": [], "label": "Image" } }, "tip_title": { "type": "StructuredText", "config": { "single": "paragraph, preformatted, heading1, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, rtl", "label": "tip title" } }, "tip_description": { "type": "StructuredText", "config": { "single": "paragraph, preformatted, heading1, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, rtl", "label": "tip description" } } } }, "quote": { "type": "Slice", "fieldset": "Quote", "description": "A short quote", "icon": "add_alert", "non-repeat": { "quote_title": { "type": "StructuredText", "config": { "single": "heading1, heading2, heading3, heading4, heading5, heading6", "label": "Quote Title" } }, "quote_author": { "type": "StructuredText", "config": { "single": "heading1, heading2, heading3, heading4, heading5, heading6", "label": "Quote Author" } } }, "repeat": {}, "display": "list" }, "tip": { "type": "Slice", "fieldset": "Tip", "description": "Support tips and tricks", "icon": "settings", "display": "list", "non-repeat": {}, "repeat": { "tip_title": { "type": "StructuredText", "config": { "single": "heading1, heading2, heading3, heading4, heading5, heading6", "label": "Tip Title" } }, "tip_description": { "type": "StructuredText", "config": { "single": "heading1, heading2, heading3, heading4, heading5, heading6", "label": "Tip Description" } } } } } } } } }

Hello Jay,

Welcome to the Prismic forum.

I assume you need to query the whole document with the word "keyWords". For example:

Prismic.Predicates.fulltext('document','keyWords')

Give this a try and let me know.

Thanks,

Priyanka

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.