Islandora / documentation

Contains islandora's documentation and main issue queue.
MIT License
103 stars 71 forks source link

Release Advanced Search as stand alone Drupal module #1851

Open Natkeeran opened 3 years ago

Natkeeran commented 3 years ago

Islandora Advanced Search supports Boolean search for Solr indexed fields. Currently, it does require facets and Apache Solr; however, there are tickets (https://github.com/Islandora/documentation/issues/1819, https://github.com/Islandora/documentation/issues/1822) to explore if it can be setup without facets and possibly Solr.

One can assume that even with Solr, there would be many other Drupal users who would like to have this functionality. Thus, releasing this as stand alone Drupal module may provide additional visibility and use outside of Islandora as well.

It does use node_has_term from Islandora in the islandora_advanced_search_form_block_form_alter. If that can be moved to configuration or documentation, this module can be made into a separate Drupal module.

Current installation should be able to uninstall the submodule and install this module, then setup the block again!

kylehuynh205 commented 3 years ago

Just note which I mentioned during our Tech call today, the two things which I found Advanced Search sub-module requires components from Islandora Core module are:

kylehuynh205 commented 2 years ago

We split the submodule from Islandora module to have it work as a stand-alone Drupal module https://github.com/digitalutsc/advanced_search

We also developed a couple of new features (in islandora_lite branch) when we implemented Advanced Search for our Islandora Lite stack:

kylehuynh205 commented 2 years ago

@nigelgbanks, please kindly review. Thanks.

nigelgbanks commented 2 years ago

@kylehuynh205 cheers for pinging me, I've been on a long break from work and haven't been following along with developments for some time. I'll do a review on Monday.

nigelgbanks commented 2 years ago

Sorry took me a while to get around to this.

For references the differences from what's currently in the main branch of islandora https://github.com/digitalutsc/advanced_search/compare/8.x-1.x...islandora_lite

To test the islandora_lite branch I just removed the existing module from the isle-dc demo setup and did a git clone and switched branches before installing the module.

N.B Had some super weird glitch with the default search view that I don't think is related to this at all (in that it wouldn't display results). When building a new search page manually though everything was fine so I suspect there is something odd in the yaml configuration that is used to setup the isle-dc demo. So for those looking to replicate my steps be aware.

I tested with search_api_solr version 4.2.0 which should use Lucene as the default query processor but I didn't see the All option in the advanced search form when testing as was mentioned in the README. Maybe additional steps are required? Ah seems there is some additional settings for the module configuration which controls this feature. Enabling that feature did get it to show up, but then using that as a search field didn't seem to give any results at all maybe more configuration is required?

For the Simple search block I also had the same issue in that it didn't seem to filter the results. Not sure what is going on there yet.

As a side note I've used the built-in form for the view to do similar behaviour to simple search block using the filter criteria Fulltext search and exposing the view form as a block. Though that doesn't integrate with the advance search block as this one does by populating the All option on submission. Though it does work with Ajax.

I guess it depends on if the intention is to have something similar to how the view filter criteria form block works, for example the search for calico would generate a Solr search query like:

(tm_X3b_en_field_description:("calico")^1 tm_X3b_und_field_description:("calico")^1 tm_X3b_en_field_edited_text:("calico")^1 tm_X3b_und_field_edited_text:("calico")^1 tm_X3b_en_rendered_item:("calico")^1 tm_X3b_und_rendered_item:("calico")^1 tm_X3b_en_title:("calico")^8 tm_X3b_und_title:("calico")^8)

The above depends on your sites configuration.

Where as with the All field I get a query like:

{!boost b=boost_document} "calico"

In reviewing the standard query processor aka lucene query processor in this case calico should be searched across the default field which is typically id by default hence why I get no results.

This check seems to remove the ability to limit the block to display only on particular content models which I've and potentially others have used for collection only searches. I'm not sure the intention for adding it?

I very much like the idea of having a field in the advanced search block that allows one to "search all fields", though I think we need to define those fields in a way that is similar to the existing functionality in Solr Search API module. We could use the same existing configuration most likely.

nigelgbanks commented 2 years ago

As for releasing the module completely separate from islandora, I'm not sure its worth the burden to support for the wider Drupal community. I don't have the bandwidth to fix non-islandora related issues from others use cases and it would expand the scope of the module in some ways, making maintenance harder. I wouldn't appose the decision though, but I'm also unlikely to do much work to support non-islandora use cases.

kylehuynh205 commented 2 years ago

My apology for the super late response, @nigelgbanks. Thank you for you feedbacks. I'll take a closer look on your feedback and get back to you soon. Thanks.

kylehuynh205 commented 2 years ago

Sorry, @nigelgbanks about taking long time to get back to this issue. I found that {!boost b=boost_document} is the reason which cause the no search results. I comment it out in this commit and Lucene seach is working as expect.

I am wondering if this line is needed for a specific use case ? I comment it out in the original branch 8.x-1.x and everything still works. Thanks.

nigelgbanks commented 2 years ago

@kylehuynh205 there is a solr field boost_document that is used to change the order of results this document has a pretty good overview. This particular field is used by search_api_solr to what extent is this important to users I do not know. Though what I can glean from the solr documentation is that it's only valid for eDismax queries, so it makes sense that it messes with the lucence query.