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

Add setting to allow deep searching within collections. #3182

Merged
merged 6 commits into from Oct 26, 2023

Conversation

demiankatz
Copy link
Member

@demiankatz demiankatz commented Oct 25, 2023

This PR is needed to support some improved functionality for Villanova's Digital Library. I'm not sure how likely it is to be useful in other situations, but it at least improves code readability by eliminating a switch statement, so maybe it's worth merging for that alone -- and the extra flexibility it adds is easily ignored.

The situation is this: when "link_type" is set to All in HierarchyDefault.ini and you have a deeply-nested set of collections, you can only see one level of the hierarchy at a time (which is desired -- we want a "drill down" navigation). However, if you use the "search within collection" feature, you also only search within the current level you are looking at, which can be confusing. It would be better to search the current level and also all deeper levels.

This PR adds a setting which allows a different collection filter field to be used when the user inputs a search than when they are viewing the collection without a search.

Note that the desired functionality is not possible with the minimum Solr schema defined in the documentation. It requires a new hierarchy_all_parents_str_mv field which contains the entire chain of parent IDs, not just the top parent/immediate parent. We already have this field as part of our custom indexing process at Villanova.

You can get a general idea of the functionality I'm proposing (though it will only work at the top level of any given collection tree), you can set up a test like this (using the standard test environment created by Phing):

1.) In HierarchyDefault.ini, set link_type to "All".
2.) In config.ini, set collections = true in the [Collections] section.
3.) Navigate to http://localhost/vufind_test/Collection/topcollection1 -- you will see two items and two subcollections.
4.) Search for "item" in the "Search within collection" box. You will see only two matches -- the items directly within this collection. Even though there are also matching items within the subcollections, they will not be seen.
5.) Now change search_container_field to hierarchy_top_id in HierarchyDefault.ini and repeat the search from step 4. You will see more matches, because the grandchildren are now accessible to the search.

TODO

  • Note BC break (changed method signature) when merging
  • Note optional _str_mv field in wiki (schema page and hierarchy page)

@demiankatz demiankatz added this to the 10.0 milestone Oct 25, 2023
Copy link
Contributor

@EreMaijala EreMaijala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good to me, just some minor details.. :)

config/vufind/HierarchyDefault.ini Outdated Show resolved Hide resolved
module/VuFind/src/VuFind/RecordTab/CollectionList.php Outdated Show resolved Hide resolved
@demiankatz
Copy link
Member Author

Thanks, @EreMaijala -- all good suggestions; I've applied them.

Copy link
Contributor

@EreMaijala EreMaijala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me now!

@demiankatz demiankatz merged commit ae00377 into vufind-org:dev Oct 26, 2023
7 checks passed
@demiankatz demiankatz deleted the collection-search-config branch October 26, 2023 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants