Verified Commit adf2ad02 authored by Camil Staps's avatar Camil Staps 🙂

Handle exactName queries

parent 956cbd5d
......@@ -37,9 +37,10 @@ import Cloogle.Search.Rank
:: SearchStrategy
= SSIdentity
| SSName String
| SSExactName String
| SSTypes
| SSClasses
| SSUnify Type
| SSTypeName String
| SSClassName String
| SSUsing (*CloogleDB -> *CloogleDB) [String]
| SSAnd SearchStrategy SearchStrategy
......@@ -50,9 +51,10 @@ addStrategy (Just s) strat = SSAnd strat s
searchStrategy :: !SearchStrategy !*CloogleDB -> *CloogleDB
searchStrategy SSIdentity db = db
searchStrategy (SSName n) db = filterName n db
searchStrategy (SSExactName n) db = filterExactName n db
searchStrategy SSTypes db = filterDB (\ce->ce=:(TypeDefEntry _)) db
searchStrategy SSClasses db = filterDB (\ce->ce=:(ClassEntry _)) db
searchStrategy (SSUnify t) db = filterUnifying t db
searchStrategy (SSTypeName n) db = filterDB (\ce->ce=:(TypeDefEntry _)) $ filterExactName n db
searchStrategy (SSClassName n) db = filterDB (\ce->ce=:(ClassEntry _)) $ filterExactName n db
searchStrategy (SSUsing f ns) db = filterUsages f ns db
searchStrategy (SSAnd a b) db = searchStrategy b $ searchStrategy a db
......@@ -69,7 +71,7 @@ search` :: !Request !*CloogleDB ->
, ![!(!CloogleEntry, ![Annotation])!]
, !*CloogleDB
)
search` {unify,name,className,typeName,using,modules,libraries,page,include_builtins,include_core,include_apps} cdb
search` {unify,name,exactName,className,typeName,using,modules,libraries,page,include_builtins,include_core,include_apps} cdb
# include_builtins = fromMaybe DEFAULT_INCLUDE_BUILTINS include_builtins
# include_core = fromMaybe DEFAULT_INCLUDE_CORE include_core
# include_apps = fromMaybe DEFAULT_INCLUDE_APPS include_apps
......@@ -85,8 +87,9 @@ search` {unify,name,className,typeName,using,modules,libraries,page,include_buil
# strat = SSIdentity
// Name search
# strat = addStrategy (SSName <$> name) strat
# strat = addStrategy (SSTypeName <$> typeName) strat
# strat = addStrategy (SSClassName <$> className) strat
# strat = addStrategy (SSExactName <$> exactName) strat
# strat = addStrategy (flip SSAnd SSTypes <$> SSExactName <$> typeName) strat
# strat = addStrategy (flip SSAnd SSClasses <$> SSExactName <$> className) strat
// Unification search
# (allsyns,cdb) = allTypeSynonyms cdb
# (alwaysUnique,cdb) = alwaysUniquePredicate cdb
......
Subproject commit 9b3230c26b83eb59d2d6e26930803b5aa198e79b
Subproject commit 5b9c4f06ec9b4d37cf61622b55282bb2b8e81549
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment