* GinBsonExtractQueryEqual generates the index term needed to match * equality on a dotted path and value. * In this case, we can simply return the term as the value stored * in the index will be exactly the value being queried. * The query is expected to be of the format {path}{typeCode}{value} * i.e. a BsonElement. */
| 1881 | * i.e. a BsonElement. |
| 1882 | */ |
| 1883 | static Datum * |
| 1884 | GinBsonExtractQueryEqual(BsonExtractQueryArgs *args) |
| 1885 | { |
| 1886 | int32 *nentries = args->nentries; |
| 1887 | bool **partialmatch = args->partialmatch; |
| 1888 | Datum *entries; |
| 1889 | pgbsonelement filterElement = args->filterElement; |
| 1890 | |
| 1891 | if (filterElement.bsonValue.value_type == BSON_TYPE_NULL) |
| 1892 | { |
| 1893 | /* special case for $eq on null. */ |
| 1894 | entries = GenerateNullEqualityIndexTerms(nentries, partialmatch, |
| 1895 | &filterElement, &args->termMetadata); |
| 1896 | } |
| 1897 | else |
| 1898 | { |
| 1899 | *nentries = 1; |
| 1900 | entries = (Datum *) palloc(sizeof(Datum)); |
| 1901 | entries[0] = PointerGetDatum(SerializeBsonIndexTerm(&filterElement, |
| 1902 | &args->termMetadata). |
| 1903 | indexTermVal); |
| 1904 | } |
| 1905 | |
| 1906 | return entries; |
| 1907 | } |
| 1908 | |
| 1909 | |
| 1910 | /* |
no test coverage detected