MCPcopy Create free account
hub / github.com/documentdb/documentdb / GenerateTermsCore

Function GenerateTermsCore

pg_documentdb/src/opclass/bson_gin_core.c:1670–1692  ·  view source on GitHub ↗

* GenerateTerms walks the bson document and for each path creates the term that will be * stored in the index for that term. Each term is of the form '{path}{typeCode}{value}' * i.e. a BsonElement. * Paths are represented as dot notation paths to facilitate faster query match behavior. * For objects, it recurses and generates nested terms as well. * For arrays, it recurses and generates both

Source from the content-addressed store, hash-verified

1668 * e.g, a: [[10,{"b":1}]] . we will be generating term a.0.b : 1 but not a.0 : 10 beacuse first value in array is an integer and second one is document.
1669 */
1670static void
1671GenerateTermsCore(bson_iter_t *bsonIter, const char *basePath,
1672 uint32_t basePathLength, bool inArrayContext,
1673 bool isArrayTerm, GenerateTermsContext *context,
1674 bool isCheckForArrayTermsWithNestedDocument)
1675{
1676 StringInfoData pathBuilderBuffer = { 0 };
1677 initStringInfo(&pathBuilderBuffer);
1678 check_stack_depth();
1679 CHECK_FOR_INTERRUPTS();
1680 while (bson_iter_next(bsonIter))
1681 {
1682 GenerateTermPath(bsonIter, basePath, basePathLength,
1683 inArrayContext, isArrayTerm, context,
1684 isCheckForArrayTermsWithNestedDocument,
1685 &pathBuilderBuffer);
1686 }
1687
1688 if (pathBuilderBuffer.data != NULL)
1689 {
1690 pfree(pathBuilderBuffer.data);
1691 }
1692}
1693
1694
1695/*

Callers 2

GenerateTermsForPathFunction · 0.85
GenerateTermPathFunction · 0.85

Calls 1

GenerateTermPathFunction · 0.85

Tested by

no test coverage detected