Skip to content

[Data Connect] Full-text search relevance not working as expected #9848

@Amaimaya

Description

@Amaimaya

[REQUIRED] Environment info

firebase-tools: I used the console

Platform: macOS

[REQUIRED] Test case

Create the following table:


type Book @table(key: ["id"]) {
  id: String!
  title: String! @searchable
}

Mock Data:

id: "1", title: "Large book"

id: "2", title: "large_book_3"

id: "3", title: "large-book-4"

id: "4", title: "small-book"

Then query the titles this way:

query getBooks($search: String) {
  books_search(
    query: $search
  ) {
    id
    title
    _metadata {
      relevance
    }
  }
}

[REQUIRED] Steps to reproduce

  1. Deploy the schema above to a Firebase Data Connect instance.
  2. Insert the four "book" records listed in the test case.
  3. Execute the getBooks query using the search string: "Large book".
  4. Observe the _metadata.relevance field for all returned records.

[REQUIRED] Expected behavior

The record with the title "Large book" should have a higher relevance score than "large_book_3" or "large-book-4" because it is an exact case-insensitive match.

[REQUIRED] Actual behavior

All matching records return the exact same relevance value, making it impossible to rank results by quality.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions