Integrate database backend with Search API Location

Created on 10 May 2017, over 7 years ago
Updated 20 March 2023, almost 2 years ago

Currently, only the Solr backend supports Search API Location β†’ . If possible, we should add support to the DB backend, too.

✨ Feature request
Status

Fixed

Version

1.0

Component

Database backend

Created by

πŸ‡«πŸ‡·France gvigroux

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

    Thanks a lot for your continued work on this! This is now looking pretty good already.
    I went through the whole code and corrected some nit-picks, but nothing major.

    That we cannot (easily) use the proper MySQL data type is, of course, rather unfortunate, but I can’t really think of a good solution here, either. Just a wild selection of pretty bad ones:

    • It would, in theory, be possible to use an INSERT … SELECT … query, where it’s simple to add expressions.
    • Doesn’t seem like anything is stopping us from just using $db->query('INSERT INTO …') directly.
    • We could probably also override the database class to provide a custom workaround.

    As said, all pretty bad. So, probably fine to stick with the β€œclean” way for the first version and think about improving performance later, if there is demand. (And maybe someone comes up with a better solution.)

    Anyways, please give my attached patch revision a try and thorough review, and if everything looks good to you, I can finally commit this.
    And, in any case, thanks a lot for your work, once again!

  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

    Of course, everyone else is very welcome to test/review, too, to make sure this is a good solution.

  • πŸ‡¬πŸ‡§United Kingdom progga

    I have thoroughly tested #44 and it works okay. Even stumbled upon a new issue β†’ with search_ap_location in the process but that's unrelated. So I am okay with #44.

  • Status changed to Fixed almost 2 years ago
  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

    Good to hear, thanks for testing and reporting back.
    Committed.
    Thanks again, everyone – especially thanks a lot to ndf and progga!

  • πŸ‡¬πŸ‡§United Kingdom progga

    Thank you :)

  • πŸ‡³πŸ‡±Netherlands ekes

    I'm going to pop this here - for the next time I think about this - I decided to take a look if it was possible for here, and for storing the geofield itself in a native geometry type.

    We could probably also override the database class to provide a custom workaround.

    Ooof! Drupal doesn't really have a single location with schema of all tables in the db any more. There's no way of registering that placeholders, or replacement values are to be handled differently for different types of field. The INSERT, UPDATE, SELECT queries are written deep in the conversion of their implementation of Drupal\Core\Database\Query\Query to a string. After some head scratching best I could come up with would be to extend each one of these classes, and alter that point such that it would allow changes based on the table field that is being included. But I dare not think how much work that would be, or how careful you'd have to be not to break something!

  • Status changed to Fixed almost 2 years ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024