typeMovie@table{# The fields you want to search overtitle:String!@searchablegenre:String@searchabledescription:String@searchabletags:[String]# Some other fields that we won't search overrating:FloatimageUrl:String!releaseYear:Int}
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-06。"],[],[],null,["\u003cbr /\u003e\n\nFirebase Data Connect supports full-text search, powered by PostgreSQL.\nFull-text search lets you quickly and efficiently locate information within\nlarge datasets by searching for keywords and phrases across multiple columns\nat once.\n\nYou can add full-text search to your service. First add the `@searchable`\ndirective to the `String` in your schema that you want to search over. For\nexample: \n\n type Movie\n @table {\n\n # The fields you want to search over\n title: String! @searchable\n genre: String @searchable\n description: String @searchable\n tags: [String]\n\n # Some other fields that we won't search over\n rating: Float\n imageUrl: String!\n releaseYear: Int\n }\n\nOnce you add this directive, you can then perform full-text search by adding\nthe `\u003cpluralType\u003e_search` field to a query. In this case, it'll be\n`movies_search`: \n\n query SearchMovies($query: String) @auth(level: PUBLIC) {\n movies_search(query: $query) {\n id\n title\n imageUrl\n releaseYear\n genre\n rating\n tags\n description\n }\n }\n\nFine-tuning full-text search results\n\nYou can fine-tune full-text search results by adding arguments to the\n`@searchable` directive and `_search` field;\n\nShared arguments\n\nYou can control search results with many of the same arguments used for basic\nlist fields `\u003cpluralType\u003e`:\n\n- `order` lets you change the order of results. If omitted, results will be ordered by descending relevance.\n- `where` lets you add extra filters to search (e.g. search for only movies of a specific genre).\n- `limit` makes the query only return the top X results.\n- `offset` makes the query skip the first X results.\n- `distinct` adds the DISTINCT operator to the generated SQL.\n\nLanguage choice\n\nBy default, full-text search parses documents in English. You can change this\nwith the language argument on the `@searchable` directive: \n\n type Movie\n @table {\n title: String! @searchable(language: \"french\")\n ...\n }\n\nSpecifying the right language will let PostgreSQL perform accurate lexical\nstemming and help make sure that your search does not miss relevant results. If\nyou are searching over multiple columns, they must all be set to the same\nlanguage.\n\n| Languages |||\n|------------------------------------------------------------------|-------------------------------------------------------------------|------------------------------------------------------------------|\n| - simple - arabic - armenian - basque - catalan - danish - dutch | - english - finnish - french - german - greek - hindi - hungarian | - indonesian - irish - italian - lithuanian - nepali - norwegian |\n\nUsing `psql`, you can get the full list with the following query. \n\n SELECT cfgname FROM pg_ts_config;\n\nQuery format\n\nBy default, full-text search uses web semantics for queries (similar to Google\nsearch). You can change this behavior with the `queryFormat` argument on the\n`\u003cpluralType\u003e_search` field. \n\n query SearchMovies($query: String) @auth(level: PUBLIC) {\n movies_search(query: $query, queryFormat: PHRASE) {\n ...\n }\n }\n\nThere are four options for query format:\n\n- **QUERY** gives familiar semantics to web search engines (e.g. quoted strings, AND and OR). It is the default.\n- **PLAIN** matches all of the words, but not necessarily together (\"brown dog\" will match \" the brown and white dog\" or \"the white and brown dog\").\n- **PHRASE** matches an exact phrase ( \"brown dog\" will match \"the white and brown dog\", but won't match \"brown and white dog\").\n- **ADVANCED** lets you create complex queries using [the full set of tsquery operators](https://www.cockroachlabs.com/docs/stable/tsquery).\n\nRelevance threshold\n\nSetting a relevance threshold means that your search will only return results\nabove a certain relevance value. In many cases, you won't need to set this - any\nresult that has a relevance greater than 0 will be a relevant result.\n\nHowever, if you find that your search is returning results that don't feel\nrelevant, relevance threshold can filter them out for you.\n\nTo figure out an appropriate value for relevance threshold, you should perform\na few test searches and look at the `_metadata.relevance`: \n\n query SearchMovies($query: String) @auth(level: PUBLIC) {\n movies_search(query: $query) {\n id\n title\n _metadata {\n relevance\n }\n ...\n }\n }\n\nChoose a threshold that omits results that you feel are irrelevant. To do so: \n\n query SearchMovies($query: String) @auth(level: PUBLIC) {\n movies_search(query: $query, relevanceThreshold: 0.05) {\n id\n title\n ...\n }\n }\n\n| **Note:** When you change other search configuration (particularly `rankFunction` or `normalization`), you will likely need to retune this threshold.\n\nChoosing between full-text search, vector similarity search, and string pattern filters\n\nData Connect offers a few different ways to search over your database.\n\nUse this table to help you choose the right one for your use case.\n\n| Full-text search | Vector similarity search | String pattern filters |\n|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|\n| Good for implementing general search functionality | Good for finding semantically similar rows (for example, recommendations or 'More like this') | Good for exact text matches or regular expression searches |\n| Performs lexical stemming, which helps match different forms or tenses of the same word | Requires Vertex AI | Uses the least memory and disk space, since it does not require any indexes or generated columns |\n| Can be performed over multiple columns in a table | Only works for a single column at a time | Can be performed over multiple columns in a table by using OR filters |\n| Performant over larger documents | Performant over large documents | Less performant when searching larger documents |\n| Adds memory and storage overhead to store a generated column and an index for each search | | |"]]