Skip to content

Commit

Permalink
Return decls in cases where there is no definition representative
Browse files Browse the repository at this point in the history
Summary:
For e.g. thrift service definitions, there's only a declaration token. These are still really useful to search for
We've been filtering them out, but it was a bit too strict. Return the decl entity in the case the definition isn't there.

An idea discussed with Michael Park to improve perf would be to select a representiative of the decl family (in the index) as the search result. We can't do that sort of selection yet.

Reviewed By: phlalx

Differential Revision: D48143928

fbshipit-source-id: 82325b676e1b63509a26c77ef2987ccc1e01b286
  • Loading branch information
donsbot authored and facebook-github-bot committed Aug 9, 2023
1 parent 5c0a5ec commit 628c42c
Show file tree
Hide file tree
Showing 250 changed files with 34,074 additions and 2,231 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,29 @@
"exactness": 2
},
"symbol": "test/cpp//foo/S"
},
{
"kind": 15,
"language": 1,
"location": {
"filepath": "test.cpp",
"range": {
"columnBegin": 3,
"columnEnd": 11,
"lineBegin": 56,
"lineEnd": 56
},
"repository": "test"
},
"name": "s",
"qname": {
"container": "h",
"localName": "s"
},
"score": {
"exactness": 2
},
"symbol": "test/cpp//h/s/.decl"
}
]
}
Expand Down
23 changes: 23 additions & 0 deletions glean/glass/test/regression/tests/cpp/searchScope_scope.out
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@
"exactness": 2
},
"symbol": "test/cpp//foo/foo/.f/"
},
{
"kind": 14,
"language": 1,
"location": {
"filepath": "test.cpp",
"range": {
"columnBegin": 1,
"columnEnd": 11,
"lineBegin": 31,
"lineEnd": 31
},
"repository": "test"
},
"name": "foo",
"qname": {
"container": "foo",
"localName": "foo"
},
"score": {
"exactness": 2
},
"symbol": "test/cpp//foo/foo/.f//.decl"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,29 @@
},
"symbol": "test/cpp//foo/foo/.f/"
},
{
"kind": 14,
"language": 1,
"location": {
"filepath": "test.cpp",
"range": {
"columnBegin": 1,
"columnEnd": 11,
"lineBegin": 31,
"lineEnd": 31
},
"repository": "test"
},
"name": "foo",
"qname": {
"container": "foo",
"localName": "foo"
},
"score": {
"exactness": 2
},
"symbol": "test/cpp//foo/foo/.f//.decl"
},
{
"kind": 30,
"language": 8,
Expand Down
23 changes: 23 additions & 0 deletions glean/glass/test/regression/tests/cpp/searchSymbol.out
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@
"exactness": 0
},
"symbol": "test/cpp//foo/foo/.f/"
},
{
"kind": 14,
"language": 1,
"location": {
"filepath": "test.cpp",
"range": {
"columnBegin": 1,
"columnEnd": 11,
"lineBegin": 31,
"lineEnd": 31
},
"repository": "test"
},
"name": "foo",
"qname": {
"container": "foo",
"localName": "foo"
},
"score": {
"exactness": 0
},
"symbol": "test/cpp//foo/foo/.f//.decl"
}
]
}
Expand Down
74 changes: 74 additions & 0 deletions glean/glass/test/regression/tests/cpp/searchSymbol_describe.out
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,57 @@
},
"sym_other_locations": [],
"type_xrefs": []
},
{
"annotations": [],
"comments": [],
"contains_relation": {
"firstChild": "nondeterministic",
"firstParent": "nondeterministic",
"hasMoreChildren": false,
"hasMoreParents": false
},
"extends_relation": {
"firstChild": "nondeterministic",
"firstParent": "nondeterministic",
"hasMoreChildren": false,
"hasMoreParents": false
},
"kind": 14,
"language": 1,
"location": {
"filepath": "test.cpp",
"range": {
"columnBegin": 1,
"columnEnd": 11,
"lineBegin": 31,
"lineEnd": 31
},
"repository": "test"
},
"modifiers": [],
"name": {
"container": "foo",
"localName": "foo"
},
"native_sym": {
"sym": "679BA3377BCEEEAA"
},
"pretty_comments": [],
"repo_hash": "testhash",
"sym": "test/cpp//foo/foo/.f//.decl",
"sym_location": {
"filepath": "test.cpp",
"range": {
"columnBegin": 1,
"columnEnd": 11,
"lineBegin": 31,
"lineEnd": 31
},
"repository": "test"
},
"sym_other_locations": [],
"type_xrefs": []
}
],
"symbols": [
Expand Down Expand Up @@ -146,6 +197,29 @@
"exactness": 0
},
"symbol": "test/cpp//foo/foo/.f/"
},
{
"kind": 14,
"language": 1,
"location": {
"filepath": "test.cpp",
"range": {
"columnBegin": 1,
"columnEnd": 11,
"lineBegin": 31,
"lineEnd": 31
},
"repository": "test"
},
"name": "foo",
"qname": {
"container": "foo",
"localName": "foo"
},
"score": {
"exactness": 0
},
"symbol": "test/cpp//foo/foo/.f//.decl"
}
]
}
Expand Down
76 changes: 74 additions & 2 deletions glean/glass/test/regression/tests/cpp/searchSymbol_enum.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,79 @@
[
"@generated",
{
"symbolDetails": [],
"symbols": []
"symbolDetails": [
{
"comments": [],
"contains_relation": {
"firstChild": "nondeterministic",
"firstParent": "nondeterministic",
"hasMoreChildren": false,
"hasMoreParents": false
},
"extends_relation": {
"firstChild": "nondeterministic",
"firstParent": "nondeterministic",
"hasMoreChildren": false,
"hasMoreParents": false
},
"kind": 15,
"language": 1,
"location": {
"filepath": "test.cpp",
"range": {
"columnBegin": 3,
"columnEnd": 11,
"lineBegin": 56,
"lineEnd": 56
},
"repository": "test"
},
"modifiers": [],
"name": {
"container": "h",
"localName": "s"
},
"pretty_comments": [],
"repo_hash": "testhash",
"sym": "test/cpp//h/s/.decl",
"sym_location": {
"filepath": "test.cpp",
"range": {
"columnBegin": 3,
"columnEnd": 11,
"lineBegin": 56,
"lineEnd": 56
},
"repository": "test"
},
"sym_other_locations": [],
"type_xrefs": []
}
],
"symbols": [
{
"kind": 15,
"language": 1,
"location": {
"filepath": "test.cpp",
"range": {
"columnBegin": 3,
"columnEnd": 11,
"lineBegin": 56,
"lineEnd": 56
},
"repository": "test"
},
"name": "s",
"qname": {
"container": "h",
"localName": "s"
},
"score": {
"exactness": 0
},
"symbol": "test/cpp//h/s/.decl"
}
]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,29 @@
"exactness": 0
},
"symbol": "test/cpp//foo/foo/.f/"
},
{
"kind": 14,
"language": 1,
"location": {
"filepath": "test.cpp",
"range": {
"columnBegin": 1,
"columnEnd": 11,
"lineBegin": 31,
"lineEnd": 31
},
"repository": "test"
},
"name": "foo",
"qname": {
"container": "foo",
"localName": "foo"
},
"score": {
"exactness": 0
},
"symbol": "test/cpp//foo/foo/.f//.decl"
}
]
}
Expand Down
Loading

0 comments on commit 628c42c

Please sign in to comment.