Improve track search performance
Searching for a track was wrapping the search string in % signs (wildcards). The leading % meant the database didn't use the index. Dropped leading % (user can add it manually if needed).
This commit is contained in:
parent
69bfd3cff9
commit
16a9880583
@ -731,7 +731,7 @@ class Tracks(Base):
|
|||||||
return (
|
return (
|
||||||
session.execute(
|
session.execute(
|
||||||
select(cls)
|
select(cls)
|
||||||
.where(cls.title.ilike(f"%{text}%"))
|
.where(cls.title.like(f"{text}%"))
|
||||||
.order_by(cls.title)
|
.order_by(cls.title)
|
||||||
)
|
)
|
||||||
.scalars()
|
.scalars()
|
||||||
|
|||||||
@ -1837,7 +1837,7 @@ class DbDialog(QDialog):
|
|||||||
"""Handle text typed in search box"""
|
"""Handle text typed in search box"""
|
||||||
|
|
||||||
self.ui.matchList.clear()
|
self.ui.matchList.clear()
|
||||||
if len(s) > 1:
|
if len(s) > 0:
|
||||||
if self.ui.radioTitle.isChecked():
|
if self.ui.radioTitle.isChecked():
|
||||||
matches = Tracks.search_titles(self.session, s)
|
matches = Tracks.search_titles(self.session, s)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user