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

Cannot query with where after moreLikeThis #409

Closed
ayende opened this issue Feb 2, 2024 · 0 comments
Closed

Cannot query with where after moreLikeThis #409

ayende opened this issue Feb 2, 2024 · 0 comments
Assignees

Comments

@ayende
Copy link
Member

ayende commented Feb 2, 2024

A query such as:

async function getDuplicates(question: Question): Promise<Question[]> {
  const session = ravenStore.openSession();
  const query = session
    .query<Question>({ indexName: "Questions/Search" })
    .whereEquals("isArchived", false)
    .whereNotEquals("id", question.id)
    .whereEquals("level", question.level)
    .moreLikeThis(q =>
      q.usingDocument(
        JSON.stringify({
          question: question.question,
        })
      )
    )
    .take(5);

  if(question.language)   query.whereEquals("level", question.level)
  

  const similarQuestions = await query.all();

  return similarQuestions;
}

This fails:

  if(question.language)   query.whereEquals("level", question.level)

Because the previous operation in not a where, which is what this expects

ml054 added a commit to ml054/ravendb-nodejs-client that referenced this issue Mar 22, 2024
ml054 added a commit that referenced this issue Mar 22, 2024
Cannot query with where after moreLikeThis #409
@ml054 ml054 closed this as completed Mar 22, 2024
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

2 participants