Skip to content

Commit 2265dea

Browse files
committed
Fix hash queries
1 parent 31e45ba commit 2265dea

File tree

3 files changed

+77
-1
lines changed

3 files changed

+77
-1
lines changed

src/Share/Web/Share/Impl.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ searchDefinitionsEndpoint callerUserId (Query query) mayLimit userFilter project
443443
[":"] -> pure $ []
444444
-- If the query is a single word, and it doesn't contain "->", we treat it as a name search
445445
[name]
446-
| not (Text.isInfixOf "->" name) ->
446+
| not (Text.isInfixOf "->" name) && not (Text.isInfixOf "#" name) ->
447447
PG.runTransactionMode PG.ReadCommitted PG.Read $
448448
DDQ.definitionNameSearch callerUserId filter limit (Query name)
449449
_ -> do
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"body": {
3+
"results": [
4+
{
5+
"branchRef": "releases/1.2.3",
6+
"definition": {
7+
"displayName": "function.const",
8+
"hash": "#20991ok5ht19nlsedaet8das0lq77c0hjjthlbmicvued7s733uhj7jmeao4is1mu380u98qlf1iosf15b8atsfl1mo4bv3kl3i7hdo",
9+
"summary": {
10+
"contents": [
11+
{
12+
"annotation": {
13+
"tag": "Var"
14+
},
15+
"segment": "a"
16+
},
17+
{
18+
"annotation": null,
19+
"segment": " "
20+
},
21+
{
22+
"annotation": {
23+
"tag": "TypeOperator"
24+
},
25+
"segment": "->"
26+
},
27+
{
28+
"annotation": null,
29+
"segment": " "
30+
},
31+
{
32+
"annotation": {
33+
"tag": "Var"
34+
},
35+
"segment": "b"
36+
},
37+
{
38+
"annotation": null,
39+
"segment": " "
40+
},
41+
{
42+
"annotation": {
43+
"tag": "TypeOperator"
44+
},
45+
"segment": "->"
46+
},
47+
{
48+
"annotation": null,
49+
"segment": " "
50+
},
51+
{
52+
"annotation": {
53+
"tag": "Var"
54+
},
55+
"segment": "a"
56+
}
57+
],
58+
"tag": "UserObject"
59+
},
60+
"tag": "Plain"
61+
},
62+
"fqn": "function.const",
63+
"kind": "term",
64+
"projectRef": "@transcripts/search"
65+
}
66+
]
67+
},
68+
"status": [
69+
{
70+
"status_code": 200
71+
}
72+
]
73+
}

transcripts/share-apis/search/run.zsh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ fetch "$transcript_user" GET 'type-var-search' '/search-definitions?query=b%20-%
5858
# Fuzzy search, should find 'Text' and 'Nat.toText' and 'Nat.fromText'
5959
fetch "$transcript_user" GET 'defn-search-fuzzy' '/search-definitions?query=Text'
6060

61+
# Hash search
62+
fetch "$transcript_user" GET 'defn-search-hash' '/search-definitions?query=%2320991ok5ht'
63+
6164
# (a -> b) -> List a -> List b
6265
fetch "$transcript_user" GET 'complex-type-mention-search' '/search-definitions?query=(a%20-%3E%20b)%20-%3E%20List%20a%20-%3E%20List%20b'
6366

0 commit comments

Comments
 (0)