Skip to content

Cannot use or operator with textCriteria #3622

@ovu

Description

@ovu

Hello, I have the following query that works in mongo using a client, it uses an or operator which combines the result of a text index and a normal attribute.

db.getCollection('person')
.find(
{$or: [ { "hrNumber": "123"} , { $text: { $search: "123" } }] } )

However, I cannot create a query using the opOperator, because it only accepts Criteria and not TextCriteria. Why is that restriction? It is a feature that is not supported or there is another way create the query as described below?

   val query= org.springframework.data.mongodb.core.query.Query()
   query.addCriteria(Criteria().orOperator( textCriteria, hrNumberCriteria))

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions