Skip to content

Commit

Permalink
Fix hash queries
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Jul 30, 2024
1 parent 31e45ba commit 2265dea
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Share/Web/Share/Impl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ searchDefinitionsEndpoint callerUserId (Query query) mayLimit userFilter project
[":"] -> pure $ []
-- If the query is a single word, and it doesn't contain "->", we treat it as a name search
[name]
| not (Text.isInfixOf "->" name) ->
| not (Text.isInfixOf "->" name) && not (Text.isInfixOf "#" name) ->
PG.runTransactionMode PG.ReadCommitted PG.Read $
DDQ.definitionNameSearch callerUserId filter limit (Query name)
_ -> do
Expand Down
73 changes: 73 additions & 0 deletions transcripts/share-apis/search/defn-search-hash.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"body": {
"results": [
{
"branchRef": "releases/1.2.3",
"definition": {
"displayName": "function.const",
"hash": "#20991ok5ht19nlsedaet8das0lq77c0hjjthlbmicvued7s733uhj7jmeao4is1mu380u98qlf1iosf15b8atsfl1mo4bv3kl3i7hdo",
"summary": {
"contents": [
{
"annotation": {
"tag": "Var"
},
"segment": "a"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
"tag": "TypeOperator"
},
"segment": "->"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
"tag": "Var"
},
"segment": "b"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
"tag": "TypeOperator"
},
"segment": "->"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
"tag": "Var"
},
"segment": "a"
}
],
"tag": "UserObject"
},
"tag": "Plain"
},
"fqn": "function.const",
"kind": "term",
"projectRef": "@transcripts/search"
}
]
},
"status": [
{
"status_code": 200
}
]
}
3 changes: 3 additions & 0 deletions transcripts/share-apis/search/run.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ fetch "$transcript_user" GET 'type-var-search' '/search-definitions?query=b%20-%
# Fuzzy search, should find 'Text' and 'Nat.toText' and 'Nat.fromText'
fetch "$transcript_user" GET 'defn-search-fuzzy' '/search-definitions?query=Text'

# Hash search
fetch "$transcript_user" GET 'defn-search-hash' '/search-definitions?query=%2320991ok5ht'

# (a -> b) -> List a -> List b
fetch "$transcript_user" GET 'complex-type-mention-search' '/search-definitions?query=(a%20-%3E%20b)%20-%3E%20List%20a%20-%3E%20List%20b'

Expand Down

0 comments on commit 2265dea

Please sign in to comment.