Skip to content

Commit b6500b2

Browse files
committed
Add minimum character count filter for usage examples
1 parent f28654e commit b6500b2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

audit/dodec/src/aggregations/GetUniqueCodeExamples.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616
// NOTE: This func does not return data to print in our nicely-formatted tables; instead, it logs directly to console.
1717
func GetUniqueCodeExampleUpdatesForDocsSection(db *mongo.Database, ctx context.Context) {
1818
// ------ CONFIGURATION: Set these values for your docs set and section ----------
19-
collectionName := "cloud-docs" // Replace this with the name of the docs set you want to search within
20-
docsSectionSubstring := "atlas-vector-search" // Replace this with a substring that represents the docs section where you want to focus results
19+
collectionName := "cloud-docs" // Replace this with the name of the docs set you want to search within
20+
docsSectionSubstring := "atlas-search" // Replace this with a substring that represents the docs section where you want to focus results
2121
// ------ END CONFIGURATION --------------------------------------------------
2222

2323
// Define a struct to match the aggregation output
@@ -39,14 +39,21 @@ func GetUniqueCodeExampleUpdatesForDocsSection(db *mongo.Database, ctx context.C
3939
{{"$match", bson.D{
4040
{"$and", bson.A{
4141
bson.D{{"$or", bson.A{
42-
bson.D{{"nodes.date_updated", bson.M{"$gte": oneWeekAgo}}},
42+
//bson.D{{"nodes.date_updated", bson.M{"$gte": oneWeekAgo}}},
4343
bson.D{{"nodes.date_added", bson.M{"$gte": oneWeekAgo}}},
4444
}}},
4545
// Filter out any removed code examples - we only care about net new or updated code examples for this piece
4646
bson.D{{"$or", bson.A{
4747
bson.D{{"nodes.is_removed", bson.M{"$exists": false}}},
4848
bson.D{{"nodes.is_removed", false}},
4949
}}},
50+
// Filter out usage examples with less than 300 characters
51+
bson.D{{"$or", bson.A{
52+
bson.D{{"nodes.category", bson.D{{"$ne", common.UsageExample}}}},
53+
bson.D{{"$expr", bson.D{
54+
{"$gte", bson.A{bson.D{{"$strLenCP", "$nodes.code"}}, 300}},
55+
}}},
56+
}}},
5057
}},
5158
}}},
5259

0 commit comments

Comments
 (0)