Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

score/boost with nested items/portable text #74

Open
struct78 opened this issue Jan 18, 2022 · 0 comments
Open

score/boost with nested items/portable text #74

struct78 opened this issue Jan 18, 2022 · 0 comments

Comments

@struct78
Copy link

I'm trying to use score/boost on nested documents, however I get the message:

score() function received unexpected expression

This is the query that fails:

*[_type in ["pageFaq", "pageContact", "pageFlexible", "pageGeneric", "article"] && ([
          title,
          description,
          pt::text(sections[].list[].answer[])
        ] match $terms)] {
          _score, 
          _createdAt, 
          _id, 
          _type, 
          title, 
          slug { 
            current 
          }
        } | score(
          boost(title match $terms, 5),
          boost(pt::text(description) match $terms, 3),
          boost(pt::text(sections[].list[].answer[]) match $terms, 1), // <-- This line throws the error
        ) 

I've also tried using:

boost(pt::text(sections[].list[].answer[]) match $terms, 1)
boost(pt::text(sections[].list[].answer) match $terms, 1)
boost(pt::text(sections.list.answer) match $terms, 1)

The latter doesn't throw an error, but at the same time it doesn't return a score so I assume it's not working either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant