Skip to content

Commit 0d41438

Browse files
committed
don't return sorted keywords
1 parent 886a0e5 commit 0d41438

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

  • backend/src/kitconcept/keywordmanager

backend/src/kitconcept/keywordmanager/tool.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,16 @@ def updateObject(self, obj, indexName: str, value) -> None:
134134
def getKeywords(
135135
self, indexName: str = "Subject", withLengths: bool = False
136136
) -> list[str] | list[tuple[str, int]]:
137-
"""Return all unique keyword values from the specified catalog index,
138-
sorted alphabetically.
137+
"""Return all unique keyword values from the specified catalog index.
139138
140139
Args:
141140
indexName: The name of the keyword index to query. Defaults to "Subject".
142141
withLengths: If True, returns tuples of (keyword, count) instead of
143142
just keywords. Defaults to False.
144143
145144
Returns:
146-
A sorted list of keyword strings, or a sorted list of (keyword, count)
147-
tuples if withLengths is True.
145+
A list of keyword strings, or a list of (keyword, count) tuples if
146+
withLengths is True.
148147
149148
Raises:
150149
ValueError: If indexName is not a valid keyword index.
@@ -154,9 +153,8 @@ def getKeywords(
154153
raise ValueError(f"'{indexName}' is not a valid index")
155154

156155
catalog = api.portal.get_tool("portal_catalog")
157-
keywords = sorted(
158-
catalog.Indexes[indexName].uniqueValues(withLengths=withLengths),
159-
key=lambda x: x.lower() if isinstance(x, str) else x[0].lower(),
156+
keywords = list(
157+
catalog.Indexes[indexName].uniqueValues(withLengths=withLengths)
160158
)
161159

162160
# can we turn this into a yield?

0 commit comments

Comments
 (0)