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
Issue 1788 #1793
Issue 1788 #1793
Conversation
items. This uses the items property of the Site entity, not the legacy item pool.
User can get all properties installed (default), just those used by any site (compliments the existing cross site searchh) or only those used by items attached to this site through the item_site table.
Gets the vocabulary scope from the site settings and adds the scope and the site id as an array to the propertySelect element's options. Method used to get site id is clunky--get site slug fromRoute and get site id from api search using slug. A less verbose way would be better.
if the options to limit the scope of the properties offered in the property select element is set. This will also filter the class, so class can be filtered even if the user is using the more strict 'restrict to template' filter to limit properties. Properties, however, get their value options from PropertySelect if the user has selected 'restrict to template'
Note that there was already a pull request that had the same aim three years ago (#1423), still alive. |
Apologies to all on the sluggish (in some cases extremely sluggish) response to these... it's definitely a good feature. This version of the change with its support for both "any site" and "current site" filtering is probably preferable to the prior one, so I think we'll consolidate to this one. We'll probably have to tweak some of the language... for one I think the "any/all sites" option is actually "used by any resource," whether or not it's on a site. Also, for consistency with other usages we'd prefer the new key used here for the query to be Finally, I think it's going to end up cleaner to just pass the proper |
Awesome, thanks @zerocrates. I can start making the changes you describe this week. |
'All sites' option is actually pull from all resources, regardless if they are used in any site or not.
Instead of setting the 'used' and 'site_id' parameters as their own element options and then adding them to the query in the AbstractVocabularyMemberSelect, pass them directly as a 'query' option.
I think I got the first two parts addressed, but let me know if they still need work or if I misunderstood. For the third part, I think I understand what you mean, but I don't have the implementation correct in b4bba8f because it is messing up the return when neither I'll keep working at it but let me know if my diagnosis is incorrect or if there is convenient example you can point me to that implements this pattern correctly. |
When you say it's "messing up," what's happening? Passing an empty-array query option should be the same as passing no query at all. |
Ah--that must have been it. I was adding the It was populating the select with only the properties/classes of a single Vocabulary instead of all installed vocabularies/classes. I'm still not exactly sure why passing the existing |
Okay--the behavior I was seeing now makes sense to me. The parameters I was accidentally passing by re-using the existing
So, the select elements were getting populated with only one "page" worth of properties and classes from the most recent vocabulary I imported. These erroneously sent parameters weren't affecting the results when I was limited to just the properties/classes used by the site or those used by any resource because my test items used less than one page worth of properties/classes. Adding this comment to document the bug. |
Yeah, you definitely don't want to use the whole search query and pass it as the query to the select element: that would cause problems like what you saw. |
Okay, just ran |
We can have Github Actions run all the tests for you, it's no problem. The test credentials aren't anything complex if you'd like to set them up for yourself: just make a new database just for testing (it will be wiped between runs) and fill in its credentials in application/test/config/database.ini. |
So just one minor thing: since this has kind of walked back to leaving the previous "used" queries alone, can you restore the code for them as they were? As it is, there's some non-significant changes like changing Oh: and when you want to look up the site, you don't need to go and get the slug and then call into the API and all that: we set it to the top-level view object, so you should be able to just do |
Thanks, John! |
Thanks for working on this with us, Alex. I've committed a squash of this to Additionally, I have an immediately following commit that converts your queries for site_id to use subqueries: for some reason the MySQL query optimizer works better with that structure here, so there's very substantially improved performance with the modified queries vs. the ones in the PR. |
This fixes #1788 by adding a site setting to limit the properties and classes that populate the advanced item search property select and resource-class select elements. Users can limit the options to properties/classes used by any Omeka S site, or to only those properties used in this site, or keep the default behavior to show all properties and classes for all installed vocabularies.