@@ -130,7 +130,7 @@ func (i *pythonIndexer) IndexDir(ctx context.Context, dir string) (*schema.Index
130
130
// Function definitions
131
131
{
132
132
moduleFuncDefQuery := fmt .Sprintf ("(module %s)" , funcDefQuery )
133
- modFunctions , err := getFunctions (n , content , moduleFuncDefQuery )
133
+ modFunctions , err := getFunctions (n , content , moduleFuncDefQuery , [] string { modName } )
134
134
if err != nil {
135
135
return nil , err
136
136
}
@@ -179,7 +179,10 @@ func (i *pythonIndexer) IndexDir(ctx context.Context, dir string) (*schema.Index
179
179
var classMethods []schema.Section
180
180
classBodyNodes := captures ["class_body" ]
181
181
if len (classBodyNodes ) > 0 {
182
- classMethods , err = getFunctions (classBodyNodes [0 ], content , funcDefQuery )
182
+ classMethods , err = getFunctions (
183
+ classBodyNodes [0 ], content , funcDefQuery ,
184
+ []string {modName , "." , className },
185
+ )
183
186
if err != nil {
184
187
return nil , err
185
188
}
@@ -245,7 +248,7 @@ func (i *pythonIndexer) IndexDir(ctx context.Context, dir string) (*schema.Index
245
248
}, nil
246
249
}
247
250
248
- func getFunctions (node * sitter.Node , content []byte , q string ) ([]schema.Section , error ) {
251
+ func getFunctions (node * sitter.Node , content []byte , q string , searchKeyPrefix [] string ) ([]schema.Section , error ) {
249
252
var functions []schema.Section
250
253
query , err := sitter .NewQuery ([]byte (q ), python .GetLanguage ())
251
254
@@ -283,7 +286,7 @@ func getFunctions(node *sitter.Node, content []byte, q string) ([]schema.Section
283
286
ShortLabel : funcName ,
284
287
Label : funcLabel ,
285
288
Detail : schema .Markdown (funcDocs ),
286
- SearchKey : [] string { funcName , "." , funcName } ,
289
+ SearchKey : append ( searchKeyPrefix , "." , funcName ) ,
287
290
})
288
291
}
289
292
0 commit comments