simplify token in search
This commit is contained in:
parent
5241c73a98
commit
36cd61c0bd
|
@ -112,18 +112,6 @@ class DeviceSearch(db.Model):
|
||||||
if isinstance(device, Computer):
|
if isinstance(device, Computer):
|
||||||
# Aggregate the values of all the components of pc
|
# Aggregate the values of all the components of pc
|
||||||
Comp = aliased(Component)
|
Comp = aliased(Component)
|
||||||
if device.chassis:
|
|
||||||
tokens.extend((
|
|
||||||
(db.func.string_agg(db.cast(Comp.id, db.TEXT), ' '), search.Weight.D),
|
|
||||||
(db.func.string_agg(Comp.model, ' '), search.Weight.C),
|
|
||||||
(db.func.string_agg(Comp.manufacturer, ' '), search.Weight.D),
|
|
||||||
(db.func.string_agg(Comp.serial_number, ' '), search.Weight.B),
|
|
||||||
(db.func.string_agg(Comp.type, ' '), search.Weight.B),
|
|
||||||
('Computer', search.Weight.C),
|
|
||||||
('PC', search.Weight.C),
|
|
||||||
(inflection.humanize(device.chassis.name), search.Weight.B),
|
|
||||||
))
|
|
||||||
else:
|
|
||||||
tokens.extend((
|
tokens.extend((
|
||||||
(db.func.string_agg(db.cast(Comp.id, db.TEXT), ' '), search.Weight.D),
|
(db.func.string_agg(db.cast(Comp.id, db.TEXT), ' '), search.Weight.D),
|
||||||
(db.func.string_agg(Comp.model, ' '), search.Weight.C),
|
(db.func.string_agg(Comp.model, ' '), search.Weight.C),
|
||||||
|
|
Reference in New Issue