nitc :: CmdCatalogSearch :: _kind_sorter
nitc :: CmdCatalogSearch :: _name_sorter
nitc :: CmdCatalogSearch :: _vis_sorter
nitc :: CmdCatalogSearch :: defaultinit
nitc :: CmdCatalogSearch :: fname_sorter
nitc :: CmdCatalogSearch :: kind_sorter
nitc :: CmdCatalogSearch :: kind_sorter=
nitc :: CmdCatalogSearch :: lname_sorter
nitc :: CmdCatalogSearch :: name_sorter
nitc :: CmdCatalogSearch :: name_sorter=
nitc :: CmdCatalogSearch :: score_sorter
nitc :: CmdCatalogSearch :: vis_sorter
nitc :: CmdCatalogSearch :: vis_sorter=
nitc $ CmdCatalogSearch :: SELF
Type of this instance, automatically specialized in every classnitc $ CmdCatalogSearch :: init_results
Initialize theresults
list
nitc :: CmdCatalogSearch :: _kind_sorter
nitc :: CmdCatalogSearch :: _name_sorter
nitc :: CmdEntities :: _sorter
nitc :: CmdCatalogSearch :: _vis_sorter
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: DocCommand :: cmd_filter
Return a new filter for that command execution.nitc :: CmdList :: defaultinit
nitc :: CmdCatalog :: defaultinit
nitc :: CmdEntities :: defaultinit
core :: Object :: defaultinit
nitc :: CmdCatalogSearch :: defaultinit
nitc :: CmdSearch :: defaultinit
nitc :: DocCommand :: defaultinit
nitc :: DocCommand :: execute
nitc :: DocCommand :: filter=
ModelFilter to apply if anynitc :: CmdCatalogSearch :: fname_sorter
nitc :: DocCommand :: http_init
Init the command from an HTTPRequestcore :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: CmdCatalogSearch :: kind_sorter
nitc :: CmdCatalogSearch :: kind_sorter=
nitc :: CmdCatalogSearch :: lname_sorter
nitc :: CmdCatalogSearch :: name_sorter
nitc :: CmdCatalogSearch :: name_sorter=
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: DocCommand :: parser_init
Initialize the command from the CommandParser datanitc :: CmdList :: print_list
nitc :: CmdCatalogSearch :: score_sorter
nitc :: DocCommand :: to_json
Return a JSON Serializable representation ofself
results
nitc :: CmdCatalogSearch :: vis_sorter
nitc :: CmdCatalogSearch :: vis_sorter=
# A CmdSearch command using a Catalog
class CmdCatalogSearch
super CmdCatalog
super CmdSearch
autoinit(model, catalog, filter, query, limit, page, count, max)
redef fun init_results do
if results != null then return new CmdSuccess
var res = super
if not res isa CmdSuccess then return res
var query = self.query
if query == null then return new ErrorNoQuery
sorter = null
var filter = self.filter
var index = model.index
# lookup by name prefix
var matches = index.find_by_name_prefix(query, filter).uniq.
sort(lname_sorter, name_sorter, kind_sorter)
matches = matches.rerank.sort(vis_sorter, score_sorter)
# lookup by tags
var malus = matches.length
if catalog.tag2proj.has_key(query) then
for mpackage in catalog.tag2proj[query] do
if filter != null and not filter.accept_mentity(mpackage) then continue
matches.add new IndexMatch(mpackage, malus)
malus += 1
end
matches = matches.uniq.rerank.sort(vis_sorter, score_sorter)
end
# lookup by full_name prefix
malus = matches.length
var full_matches = new IndexMatches
for match in index.find_by_full_name_prefix(query, filter).
sort(lfname_sorter, fname_sorter) do
match.score += 1
full_matches.add match
end
matches = matches.uniq
# lookup by similarity
malus = matches.length
var sim_matches = new IndexMatches
for match in index.find_by_similarity(query, filter).sort(score_sorter, kind_sorter, lname_sorter, name_sorter) do
if match.score > query.length then break
match.score += 1
sim_matches.add match
end
matches.add_all sim_matches
matches = matches.uniq
results = matches.rerank.sort(vis_sorter, score_sorter).mentities
return res
end
private var score_sorter = new ScoreComparator
private var vis_sorter = new VisibilityComparator
private var name_sorter = new NameComparator
private var lname_sorter = new NameLengthComparator
private var fname_sorter = new FullNameComparator
private var lfname_sorter = new FullNameLengthComparator
private var kind_sorter = new MEntityComparator
end
src/doc/commands/commands_catalog.nit:31,1--98,3