=Added /exact switch to @find
This commit is contained in:
parent
f35b5e2038
commit
c6580ae953
1 changed files with 7 additions and 4 deletions
|
|
@ -1848,6 +1848,7 @@ class CmdFind(MuxCommand):
|
||||||
room - only look for rooms (location=None)
|
room - only look for rooms (location=None)
|
||||||
exit - only look for exits (destination!=None)
|
exit - only look for exits (destination!=None)
|
||||||
char - only look for characters (BASE_CHARACTER_TYPECLASS)
|
char - only look for characters (BASE_CHARACTER_TYPECLASS)
|
||||||
|
exact- only exact matches are returned.
|
||||||
|
|
||||||
Searches the database for an object of a particular name or exact #dbref.
|
Searches the database for an object of a particular name or exact #dbref.
|
||||||
Use *playername to search for a player. The switches allows for
|
Use *playername to search for a player. The switches allows for
|
||||||
|
|
@ -1922,10 +1923,12 @@ class CmdFind(MuxCommand):
|
||||||
else:
|
else:
|
||||||
# Not a player/dbref search but a wider search; build a queryset.
|
# Not a player/dbref search but a wider search; build a queryset.
|
||||||
# Searchs for key and aliases
|
# Searchs for key and aliases
|
||||||
|
if "exact" in switches:
|
||||||
keyquery = Q(db_key__istartswith=searchstring, id__gte=low, id__lte=high)
|
keyquery = Q(db_key__iexact=searchstring, id__gte=low, id__lte=high)
|
||||||
aliasquery = Q(db_tags__db_key__istartswith=searchstring, db_tags__db_tagtype__iexact="alias",
|
aliasquery = Q(db_tags__db_key__iexact=searchstring, db_tags__db_tagtype__iexact="alias",id__gte=low, id__lte=high)
|
||||||
id__gte=low, id__lte=high)
|
else:
|
||||||
|
keyquery = Q(db_key__istartswith=searchstring, id__gte=low, id__lte=high)
|
||||||
|
aliasquery = Q(db_tags__db_key__istartswith=searchstring, db_tags__db_tagtype__iexact="alias", id__gte=low, id__lte=high)
|
||||||
results = ObjectDB.objects.filter(keyquery | aliasquery)
|
results = ObjectDB.objects.filter(keyquery | aliasquery)
|
||||||
nresults = results.count()
|
nresults = results.count()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue