Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Suggestion: List lens should include the queried metadata column #230

Open
alexdryden opened this issue Feb 15, 2024 · 4 comments
Open

Comments

@alexdryden
Copy link
Contributor

This is based on some feedback I received from a group on the UIUC campus who uses Scalar and was echoed by an author who is publishing a book using Scalar with the Illinois Open Publishing Network. I noticed some recent work on column display handling for lenses, so I thought this might be a ripe time to suggest this feature.

Issue:

When users build a lens with metadata facets for a list view, they would like the to see the metadata they are querying as a results column.

Example:

A user wants to see all pages that are within 50 miles of the center of Berlin that do not contain the word "Berlin" in the iptc:city field. They are interested in the query primarily to see which cities are represented, however, that data isn't returned and displayed in the list.

Roadblocks/Risks:

Managing how many columns are represented in the results

Implementation ideas:

There could be a checkbox as part of the configuration interface that would indicate if this field should be included in the results, something like this:

Screenshot 2024-02-15 at 1 31 52 PM

Alternatively, a more complete solution might add an additional drop down when the list is selected that allows users to select which columns to display for this lens:
Screenshot 2024-02-15 at 1 49 51 PM

@eloyer
Copy link
Collaborator

eloyer commented Feb 16, 2024

Makes sense to me — the existing list vis already adds columns conditionally based on the sorting that's applied to the lens, and once the refactoring in this pr has been merged, it will be even easier to add behavior like this (I think it could be done by default, without any additional UI, as long as there are some sizing checks, which are also already partially in place). I don't have the bandwidth to tackle this myself, but if you're interested in working on it I can give some pointers once we merge the pr above.

@alexdryden
Copy link
Contributor Author

alexdryden commented Feb 16, 2024 via email

@eloyer
Copy link
Collaborator

eloyer commented Feb 26, 2024

OK, now that the PR has been merged, here are some thoughts — this will be a little sketchy but hopefully helpful. You'll be working in scalarvisualizations.jquery.js. There's a method called getColumns that helps figure out what columns to display. Specifically, lines 4799-4804 add additional columns depending on whether the source lens includes sorts or not. Basically, you'll want to do something similar based on what metadata fields the lens references.

The difference is that while there are a finite number of conditional columns which a sort can cause to appear, there are an arbitrary number of metadata properties that can be added based on whatever the lens is referencing. You'll want to do some logging of the lens and node objects (the content returned by the lens) to understand how they're structured, but for any given node, node.current.properties will get you its complete list of properties. The addColumnToRowForNode method handles the actual adding of content to the results table, it will need to be modified to handle the arbitrary metadata.

Hopefully this is enough to get you started; let me know if you have questions.

@alexdryden
Copy link
Contributor Author

Great! Thanks for the tips!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants