Open Wylbur opened 2 years ago
It's just using core's search functionality. So you could probably test it with dummy content type on a fresh site to see the search API can store partial words and if the the search terms filter for views can then find them.
I tested and sure enough it can't find parts of words.
The easiest might be to either use a regular View text filter or use Search API.
I think switching to a views text "combine fields" filter on title, project name + body would be a good way to go here.
@jenlampton I've got a PR for this: https://github.com/backdrop-ops/backdropcms.org/pull/1024. It can be tested locally by trying text like "uber" in the search field.
The one drawback of this approach is that the search score sorting can't be used because we would be using the combined fields search not the search module's filter.
It changes the Project Listings view to use fields (required for the combine fields filter) and adds the "Rendered Content" field so we can still use the styling on the display mode of the content type. And a couple tweaks to the css.
It seems like a previous iteration of the project listings relied on rendered entity fields and there's a template views-views-fields--modules.tpl.php
that puts those fields into a list with the class result__info
. I don't think it's currently being used on the site, so I bet it can be removed. In my PR I didn't remove it, just overrode some of it.
The one drawback of this approach is that the search score sorting can't be used because we would be using the combined fields search not the search module's filter.
I think we tried making this change once before, and it broke a handful of other things on the site. Let's check the queue to see what that was (and if it has been fixed in core).
LOL, here's my comment from March 2020 in https://github.com/backdrop-ops/backdropcms.org/issues/232
We switched to the combined fields filter for some(?) reason. Did you find/review that issue, and make sure this change doesn't revert the previous fix? (I don't remember what the previous problem was... maybe @klonos remembers? I think combining fields was his suggestion.)
Looks like loosing the search score sorting is a non-starter.
I even responded on that issue - don't remember at all. :) So need a search score and also want partial word matching. I think one of our only options is to use https://backdropcms.org/project/search_api connected to Apache Solr (not the mysql-hosted option) since that allows partial words and includes scores.
Just as I was about to open a new redundant issue I found this issue and the related issue #5344. Keep hitting the problem of Install new modules
doesn't support partial word searches, only whole words.
It looks like there was a PR that will need a rebase to test. Or local testing with a patch.
@izmeez the PR that was linked here isn't a viable approach, as per the last few comments. Did you find another one? (I've closed that one to avoid future confusion). This could be done as an improvement to core (allow partial word searches) - a contrib module (I think there was one called porter stemmer?) or a more complex solution like adding Apache Solr to our production stack.
Edit: PorterStemmer was something else, I think we need FuzzySearch
I just added a PR to issue #1320 to add partial word search to core with a backport of the patch used in Drupal 7. It works for content search but will need more work for partial word search when installing modules.
Fuzzy Search is a good option as it can be done with just the database and no Solr.
Description of the need
While using the project installer today, I searched for "dragg", hoping to find the draggable views module. It came up with an empty list.
When I searched for draggable, it found the module.
Proposed solution
Update the search function for projects use partial matches.
Alternatives that have been considered
I don't know the mechanics behind this, but it could help people find projects even if they do not have the exact match.
Not sure if this has been discussed yet, I looked through the issue queue and did not find anything.
I can help with testing of this, let me know how I could help!
Background
This issue was originally opened in the Backdrop Issue queue #5344. Since this search is executed within the Backdropcms.org website, it was recommended to move this issue here for further action.