First mini-patch that adds the Bounding Box Argument to views based on search_api.
TODO: when you set a limit on the view (say, 2 points) it apparently FIRST fetches 2 points from the backend (i tested with solr) and THEN filters them trough the bounding box.
So, out of the 4 points i tested with, i always saw the same 2 (but the whole AJAX and boundingbox thing did work on these 2)
Best way to test tip: add the same data to a map twice, once as geojson and once as a normal openlayers layer. (both with a different style, obviously)
If this needs to go in a separate module, that is also fine, its just ment as a small headstart.
Comments
Comment #1
dasjointeresting. i just tried this and it fails due to some methods that the search_api views query implementation is missing (add_table, add_where, set_where_group)
here's the source
http://drupalcode.org/project/views_geojson.git/blob/refs/heads/7.x-1.x:...
Comment #2
batje commentedI am pretty sure that we will have to implement the bounding box query for search_api & facetapi using a bbox facetapi Filter.
Comment #3
dasjosounds good to me. i'm not an expert in the api's - batje do you think you could provide some code of how this could look like? i'd be happy to test, iterate on it.
edit:
search_api_location has a radius-based filter implementation: http://drupalcode.org/project/search_api_location.git/blob/refs/heads/7....
maybe there was some bbox functionality planned, at least it seems to be removed since #1398862: Cleanup (patch included)
Comment #4
dasjoComment #5
batje commentedsearch_api is too complex for me too to quickly whip out some code :-)
Comment #6
randallknutson commentedI believe I've got this working to a certain extent. Here is what I used:
Modules/Patches
search_api
search_api_views
search_api_solr
search_api_location
Patch #1 from #2061639: Add views argument for geojson bbox
views_geojson
Patch #11 from #1839554: BBox argument handler fixes
leaflet_geojson
Patch #1 from #2061629: Allow other views arguments to provide BBOX
How to set it up:
Comment #7
das-peter commentedThe following patch introduces Search API bbox support - if following related issue is solved: #2368399: Support for "proper" bbox location searches
We use the already available Search API query option
search_api_locationto provide the bbox data to the search service which is then responsible to handle the data according to the backend.I also did some cleanup as the class seemed quite a bit untended.
I actually would prefer to see this functionality in Search API Location itself, however I'm not sure if this will happen as of the feedback here #2061639-3: Add views argument for geojson bbox
Further this implementation will work seamlessly with Leaflet Geojson - even thought it could use some love: #2367459: Search for "feed" displays in hook_leaflet_geojson_source_info
Comment #8
das-peter commentedComment #9
das-peter commentedUpdated the patch according to the ongoing discussion about how to handle bbox in search api.
Comment #10
das-peter commentedOh, I forgot to cleanup some part.
Comment #11
das-peter commentedOverhauled the used approach.
No extra configuration for Search API Views necessary.
Means it should work seamlessly.
Comment #12
polIs it good to go in ?
Comment #13
das-peter commented@Pol I appreciate your pro-active spirit :) But give it another day or two. Maybe we can leave this up to #2061639: Add views argument for geojson bbox
Thomas is aware of it and told me he will do a review. I it goes in I would need to adjust leaflet geojson - but there's a change pending anyway.
And I'm still in early testing phase, I just reviewed the code again and thought I could solve this smoother ;)
Right now I try to add geocluster to the party.
Comment #14
polAny update on this ?
Comment #15
das-peter commentedSeems to work quite well with the latest Search API Location.
However, the patch also contains quite some cleanup - shall I strip the Search API sepcific part and post somewhere else an "cleanup" patch?
Also if we keep this in one could use bbox filtering without having Search API Location installed - you just need a Search API backend that supports the search_api_location handling.
Comment #16
Exploratus commentedWhat's the status of this?
Comment #17
basvredelingThe patch currently doesn't work. It requires search_api_location (which is not included in the .info).
Also once you enable search_api_location (both recommended and latest dev) you run into an error: Call to undefined method SearchApiViewsQuery::ensure_table()
Comment #18
das-peter commentedAs statet in #15. This patch isn't required anymore to make bbox and search api location working:
So if the cleanup makes sense we could adapt it, otherwise I guess we can close this issue.
Comment #19
basvredelingCleanup looks good, but unaware of this patch I've done something similar: #2396781: Clean up the views_geojson module
Comment #20
das-peter commentedSo if there's a already an issue solely for cleaning up let's got with it instead this one.
Closed in favour of #2396781: Clean up the views_geojson module
Comment #21
basvredelingI've merge all cleanup code into #2396781: Clean up the views_geojson module comment #11
Comment #22
basvredelingSorry
Comment #23
monstrfolk commentedConfused on the status of bbox support with search api.
@basvredeling
Patch from https://www.drupal.org/node/2396781 contains
Does not look like bbox support works.
Comment #24
basvredeling@monstrfolk it doesn't work... see: #2747493: Search API bbox support