C
C
Constantin Tsukanov2016-06-13 16:32:30
MongoDB
Constantin Tsukanov, 2016-06-13 16:32:30

How to get "terms" for each document, after a full text search in MongoDB?

Good afternoon. Such a question, is it possible to somehow get for the documents found, which form was applied? Example:

db.collection.find({
    $text: {
        $search: "булочка"
    }
})

Monga is smart enough to cut off the endings and find all the documents with булочкаand булочки. But, can I get for each document these very "truncated" terms, according to which the search was made, similar to { score: { $meta: "textScore" }}? Especially - this applies to cases where more than one term is used, but several separated by a space.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2016-06-13
@authoris

db.getCollection('example').find({
    $text: {
        $search: "розовые булочки",
        $language: 'russian'
    }
}).explain()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question