Page MenuHomePhabricator

Special:Drilldown in Cargo should display a text input, not a message, for a large number of filters
Closed, ResolvedPublic

Description

Right now, if the Special:Drilldown page in Cargo sees a filter with 300 or more values, it just prints "Too many values; not displaying.", i.e. the message "cargo-drilldown-toomanyvalues". I think this was a bad UI decision on my part; instead, the page should print a simple text input, letting the user just enter a string for that filter.

Hints for anyone wanting to implement this:

  • The resulting code should sort of look like CargoDrilldown::printComboBoxInput(), but less complex
  • If you want to test it out, you don't need to have 300 values for some filter; you can just reduce that number to something low like 1 or 2.

Event Timeline

Yaron_Koren raised the priority of this task from to Needs Triage.
Yaron_Koren updated the task description. (Show Details)
Yaron_Koren subscribed.

Change 193426 had a related patch set uploaded (by AYUSH GARG):
Cargo: drilldown should display a text input,not a message

https://gerrit.wikimedia.org/r/193426

What's the reason behind using a text box instead of a combobox?

Just a guess here, but if the issue is that the combobox prints out all the (300+) values, possibly an edit could be made to the combobox to allow for selectively showing only the top N results?

There could be an argument made for only showing the first 300 or so results - but my concern there is that it could lead users to think that the value they're looking for is not there, if it's not in that group. A better solution, I think, would be to have a combobox input that used Ajax to remotely get the set of values that match whatever the user has already typed in - that way, you wouldn't need to retrieve or display the whole set of values. That's exactly what the Semantic Forms extension (if you know that one - I'm the main author) does, for inputs that have too many possible values. It would take more work, though; certainly a lot more than just putting in a text input. But that's probably ultimately the right solution.

@Yaron_Koren: While I was testing this out, I began to get a consistent database error ("A database query error has occurred.") no matter what I did (including deleting all the cargo tables, templates, pages, running deleteArchivedRevisions.php, etc.).

After further investigation, I found the SQL error: Column '_value' in field list is ambiguous and the stack trace pointed me to the call on line 198 of CargoFilter.php.

The full query was of the form:

SELECT _value, COUNT(*)
FROM `cargo__Person`
LEFT OUTER JOIN `cargo__Person__Text` ON ((cargo__Person._ID = cargo__Person__Text._rowID))
LEFT OUTER JOIN `cargo__Person__Extras` ON ((cargo__Person._ID = cargo__Person__Extras._rowID))
WHERE ((cargo__Person__Text._value = 'XYZ'))
GROUP BY _value

Could you please tell me what I need to change in order for this error to not show up?

@polybuildr - it looks like you've discovered a bug in Cargo - Special:Drilldown breaks when a table/template has more than field that can hold a list of values. Sorry about that, and about the extra work you did; I hope to fix that soon. In any case, I think I already have a sense of your programming abilities from your patch from the other micro-task, so I don't think it would be necessary to work on another one. (Unless you were planning to add a combobox with remote autocompletion, which would be amazing.) If you're still interested in this project, please email me.

Change 193426 abandoned by Yaron Koren:
Cargo: drilldown should display a text input,not a message

https://gerrit.wikimedia.org/r/193426

I fixed this myself, in version 0.7.

Yaron_Koren set Security to None.