Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As discussed:
1. Move 7.x module to repository in a new branch
2. Merge integration into the main module, do minimal 8.x port (PSR-4 and so on)
3. Possibly postpone further work on having a working server.
Comment | File | Size | Author |
---|---|---|---|
#7 | search-api-views-2252171-7-interdiff.txt | 7.83 KB | Berdir |
#7 | search-api-views-2252171-7.patch | 148.06 KB | Berdir |
#4 | search-api-views-2252171-4.patch | 152.67 KB | Berdir |
#3 | search-api-views-2252171-3.patch | 128.88 KB | Berdir |
Comments
Comment #1
BerdirPushed the code to the views branch. Doesn't work as hook_views_data() has not been ported yet, but it has been renamed, so it will fatal error.
Maybe we can start with a very simple definition that only comes with a fulltext argument and rendered entities? Postponed until we have a working backend....
Comment #2
BerdirMade some more progress, made a simplistic hook_views_data() work and the query is now executed, I can display some entities with the test backend, looking forward to see the db backend working :)
Everything very minimalistic of course, there's a *lot* to do, but this is a good start I think :)
Comment #3
BerdirOk, here is a patch for review, at least the changes outside of views related code. Not sure how useful it is to review the views specific code, maybe the query implementation and the plugins that work: SearchApiRow, SearchApiMoreLikeThis, SearchApiFulltext.
What's working:
- Creating entities with display "Rendered Search API items"
- Multiple data sources
- Exposed fulltext argument
- More like this contextual filter (not supported by the database server I think?)
Comment #4
BerdirUpdated patch with a few fixes and a working test.
Added a trait to share code with the Db backend test for creating example content and stuff.
Comment #5
drunken monkeyWow, our first trait, great!
Also, great work otherwise, looks very good! And since I already saw it work, even better!
Just a few remarks:
Superfluous newline.
Is there a reason why you use the function directly, instead of the method, in the latter case?
Is this correct? Wouldn't it allow the user to create a new view for a deleted index after an index has been deleted (or with fields not available anymore)? Or is the Views cache automatically cleared when creating a new view (or enabling a disabled one)?
Needs to be namespaced, and name is not up to date.
Also, why does this need a module prefix? Is there some special rule, or only because "Argument" alone would sound stupid? Maybe "SearchArgument" then?
This shouldn't be documented in every single instance where IDs are used. We should probably give some thought to where to best explain this, but for now just use "internal item IDs", or an additional "(with datasource ID)" if you want to clarify.
But in general, we use these combined IDs nearly everywhere now, except in the datasource itself (and some index code dealing with datasources, of course), so even that clarification shouldn't be necessary.
Missing "@file" and correct name.
Trailing space.
This is also used in
libraries.yml
, and I already wondered. Is it correct there?Comment #6
drunken monkeyComment #7
BerdirThanks for the review.
1. Fixed.
2. I tried to port the logic from the 7.x hooks, but after thinking more about it, it was quite flawed (almost all changes can affect the views data, doesn't really matter if we have views on it or not and disabling affects it just as much as enabling an index...). So, I simplified it to always clear the views cache on postSave() and preDelete().
3. See above.
4. As discussed, @amateescu and me both preferred to have some sort of prefix (not as a module name but as a concept) to separate the search api plugins from the standard ones.
5. Yeah, I did initially rely on it and it was different between the test and database backend (both were incomplete), that's why I added some documentation. Simplified it a bit and just mention it's a unique identifier including the datasource, to make sure that you can't just use it as the item ID anymore, like the old views query implementation used to do.
6. Fixed.
7. Yeah, I'm not sure about libraries.yml, that's an interesting point, probably doesn't matter much if it's internal, but it's wrong in both, only core is allowed to use that constant I think.
Also fixed the broken tests, will merge when it passes...
Comment #8
BerdirCommitted!