* This is the root term that all documents get when the indexed path exists. * We pick a term that points to a path that is illegal ('') * and give it to all terms. This allows us to answer questions * on complement sets (e.g. NOT operators) from the index. */
| 2191 | * on complement sets (e.g. NOT operators) from the index. |
| 2192 | */ |
| 2193 | Datum |
| 2194 | GenerateRootTerm(const IndexTermCreateMetadata *termData) |
| 2195 | { |
| 2196 | pgbsonelement element = { 0 }; |
| 2197 | element.path = ""; |
| 2198 | element.pathLength = 0; |
| 2199 | element.bsonValue.value_type = BSON_TYPE_MINKEY; |
| 2200 | |
| 2201 | /* Can't mark this as metadata due to back-compat. This is okay coz this is legacy. */ |
| 2202 | IndexTermMetadata termMetadata = IndexTermNoMetadata; |
| 2203 | return PointerGetDatum(SerializeBsonIndexTermCore(&element, termData, |
| 2204 | termMetadata).indexTermVal); |
| 2205 | } |
| 2206 | |
| 2207 | |
| 2208 | Datum |
no test coverage detected