Skip to content

Commit dc51c3d

Browse files
authored
Merge pull request #3117 from irgolic/keyword-search
[ENH] Match Keywords in Widget Search
2 parents b54398c + 157c6f8 commit dc51c3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+86
-13
lines changed

Orange/canvas/document/quickmenu.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,20 @@ def filterFunc(self):
323323
return self.__filterFunc
324324

325325
def filterAcceptsRow(self, row, parent=QModelIndex()):
326-
accepted = QSortFilterProxyModel.filterAcceptsRow(self, row, parent)
326+
flat_model = self.sourceModel()
327+
index = flat_model.index(row, self.filterKeyColumn(), parent)
328+
description = flat_model.data(index, role=QtWidgetRegistry.WIDGET_DESC_ROLE)
329+
name = description.name
330+
keywords = description.keywords
331+
332+
# match name and keywords
333+
accepted = False
334+
for keyword in [name] + keywords:
335+
if self.filterRegExp().indexIn(keyword) > -1:
336+
accepted = True
337+
break
338+
339+
# if matches query, apply filter function (compatibility with paired widget)
327340
if accepted and self.__filterFunc is not None:
328341
model = self.sourceModel()
329342
index = model.index(row, self.filterKeyColumn(), parent)

Orange/widgets/data/owconcatenate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class OWConcatenate(widget.OWWidget):
2727
description = "Concatenate (append) two or more datasets."
2828
priority = 1111
2929
icon = "icons/Concatenate.svg"
30+
keywords = ["append", "join", "extend"]
3031

3132
class Inputs:
3233
primary_data = Input("Primary Data", Orange.data.Table)

Orange/widgets/data/owcontinuize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class OWContinuize(widget.OWWidget):
2424
"optionally, normalize numeric values.")
2525
icon = "icons/Continuize.svg"
2626
category = "Data"
27-
keywords = ["data", "continuize"]
27+
keywords = []
2828

2929
class Inputs:
3030
data = Input("Data", Orange.data.Table)

Orange/widgets/data/owcreateclass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class OWCreateClass(widget.OWWidget):
127127
description = "Create class attribute from a string attribute"
128128
icon = "icons/CreateClass.svg"
129129
category = "Data"
130-
keywords = ["data"]
130+
keywords = []
131131

132132
class Inputs:
133133
data = Input("Data", Table)

Orange/widgets/data/owdatainfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class OWDataInfo(widget.OWWidget):
2323
icon = "icons/DataInfo.svg"
2424
priority = 80
2525
category = "Data"
26-
keywords = ["data", "info"]
26+
keywords = ["information", "inspect"]
2727

2828
class Inputs:
2929
data = Input("Data", Table)

Orange/widgets/data/owdatasampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class OWDataSampler(OWWidget):
2222
icon = "icons/DataSampler.svg"
2323
priority = 100
2424
category = "Data"
25-
keywords = ["data", "sample"]
25+
keywords = ["random"]
2626

2727
_MAX_SAMPLE_SIZE = 2 ** 31 - 1
2828

Orange/widgets/data/owdatasets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ class OWDataSets(widget.OWWidget):
130130
icon = "icons/DataSets.svg"
131131
priority = 20
132132
replaces = ["orangecontrib.prototypes.widgets.owdatasets.OWDataSets"]
133+
keywords = ["online"]
133134

134135
# The following constants can be overridden in a subclass
135136
# to reuse this widget for a different repository

Orange/widgets/data/owdiscretize.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class OWDiscretize(widget.OWWidget):
127127
name = "Discretize"
128128
description = "Discretize the numeric data features."
129129
icon = "icons/Discretize.svg"
130+
keywords = []
130131

131132
class Inputs:
132133
data = Input("Data", Orange.data.Table, doc="Input data table")

Orange/widgets/data/oweditdomain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ class OWEditDomain(widget.OWWidget):
461461
description = "Rename features and their values."
462462
icon = "icons/EditDomain.svg"
463463
priority = 3125
464+
keywords = []
464465

465466
class Inputs:
466467
data = Input("Data", Orange.data.Table)

Orange/widgets/data/owfeatureconstructor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ class OWFeatureConstructor(OWWidget):
333333
description = "Construct new features (data columns) from a set of " \
334334
"existing features in the input dataset."
335335
icon = "icons/FeatureConstructor.svg"
336+
keywords = []
336337

337338
class Inputs:
338339
data = Input("Data", Orange.data.Table)

0 commit comments

Comments
 (0)