diff --git a/src/Share/Web/Share/Impl.hs b/src/Share/Web/Share/Impl.hs index fdd9854..4dd3c74 100644 --- a/src/Share/Web/Share/Impl.hs +++ b/src/Share/Web/Share/Impl.hs @@ -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 diff --git a/transcripts/share-apis/search/defn-search-hash.json b/transcripts/share-apis/search/defn-search-hash.json new file mode 100644 index 0000000..ccb7f16 --- /dev/null +++ b/transcripts/share-apis/search/defn-search-hash.json @@ -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 + } + ] +} diff --git a/transcripts/share-apis/search/run.zsh b/transcripts/share-apis/search/run.zsh index c7260a3..0e267b4 100755 --- a/transcripts/share-apis/search/run.zsh +++ b/transcripts/share-apis/search/run.zsh @@ -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'