Uploaded image for project: 'Realm Kotlin'
  1. Realm Kotlin
  2. RKOTLIN-867

Newly updated documents are not returned in a FullText Search query

      How frequently does the bug occur?

      Sometimes

      Description

      Hey everyone!

      I have noticed in a project that I am building for Windows, using the Realm Kotlin Multiplatform SDK, that almost every time I update a property of a document, which has the @FullText index annotation in it, directly in the database through the console or using the MongoDB Compass, the results returned in the client application with a query using the TEXT predicate often do not include the most recently updated documents, even if the predicate condition is true.

      I'm not sure if I've missed something in the documentation, or if I'm doing something wrong. But so far in all the tests done I could identify this unexpected behavior. For such tests I'm using the .asFlow() function to track of updates, and even using the synchronous .find() function and restarting the application to track whether the results returned in the query include those which i've updated myself it is possible to identify that they are not always included.

      This is the model of the Product object, which I am using in the database:

      Unable to find source-code formatter for language: kotlin. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      open class Product : Entity, RealmObject {
          @PrimaryKey
          override var _id: ObjectId = ObjectId.invoke()
      
          override var createdAt: RealmInstant? = null
          override var createdBy: String = ""
          override var createdById: ObjectId? = null
      
          @FullText
          var description: String = ""
      
          @FullText
          var brand: String = ""
      
          var unit: String = ""
          var secondaryUnit: String = ""
          var quantityPerUnit: Short = 1
          var unitCost: Float = 0f
          var totalCost: Float = 0f
          var category: String = ""
          var barcode: String? = null
          var sku: String = ""
          var archived: Boolean = false
      }
      

      Another information: I had already created some documents in my database before FullText Search query filter support was released.

      I'll be happy to clarify more about this, apologizing in advance for any spelling errors in my text.

      Thank you all!

      Stacktrace & log output

      No response

      Can you reproduce the bug?

      Sometimes

      Reproduction Steps

      Considering that the database already contains documents with varied descriptions.

      1. Create a query using the TEXT predicate in the client;

      > Find all products that contains the word 'bovina' but not 'paleta' in their description
      > val products = realm.query<Product>("description TEXT 'bovina -paleta'").asFlow()

      1. Update any document description property inserting the word 'bovina' in it through console or MongoDB Compass;
      2. Keep listening for result changes;
      3. See that some recently updated documents are not returned in the query.

      Version

      1.10.1

      What Atlas App Services are you using?

      Both Atlas Device Sync and Atlas App Services

      Are you using encryption?

      No

      Platform OS and version(s)

      Windows 11 amd64

      Build environment

      IntelliJ IDEA version 2023.1.2 (Community Edition)
      Gradle version 7.4

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: