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.
A apachesorl spatial plugin (submodule) that integrates with solr search and the locations module would be awesome.
Indexing locations and searching by distance is something that is so logical.
This might come in handy:
http://derickrethans.nl/spatial-indexes-solr.html
Comment | File | Size | Author |
---|---|---|---|
#24 | 1187888-24.patch | 143.26 KB | pwolanin |
#23 | schema-solr3x.xml_.txt | 27.45 KB | pwolanin |
#14 | solr.tar_.gz | 49.17 KB | wouters_f |
#13 | apache-solr-3.3-ACQUIA-PATCHED.zip | 7.11 MB | pwolanin |
#3 | SOLR-2462.patch | 14.05 KB | pwolanin |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedWell, yes that would be nice, but need some solid and tested configuration stanzas to support geo fields in the context of the rest of our configuration.
Comment #2
pwolanin CreditAttribution: pwolanin commentedAny work around this will require use of Solr 3.2+ on the server side.
Comment #3
pwolanin CreditAttribution: pwolanin commentedHere is a Solr 3.2 war file (rename it from .zip to solr.war) built from the ASF lucene svn 3.2 tag with patches using javac 1.6.0_24. For issues/patches see https://issues.apache.org/jira/browse/SOLR
Note the patch for SOLR-2462 I generated from the commit, since it seems the final patch was never posted to the issue.
Comment #4
wouters_f CreditAttribution: wouters_f commentedthanx pwolanin I'll give this a try asap.
Comment #5
wonder95 CreditAttribution: wonder95 commentedI've been planning on adding the geospatial capability to Solr starting in a couple weeks (when I finish a current project), so please keep me in the loop if you start anything.
Comment #6
orbiteleven CreditAttribution: orbiteleven commentedFWIW I was only able to get this running with the following: http://drupal.org/node/1197212
Comment #7
mcabalaji CreditAttribution: mcabalaji commentedHi
SOLR 3.3 has been released which has the fixes to the bug mentioned in #3 and as well some performance optimization and new features
It also has new features like
"automaton-based, implementation of suggest (autocomplete) component, offering an order of magnitude smaller memory consumption compared to ternary trees and jaspell and very fast lookups at runtime "
The Complete release notes is in the link : http://svn.apache.org/repos/asf/lucene/dev/tags/lucene_solr_3_3/solr/CHA...
So I think we should start integrating SOLR 3.3 with Drupal
Comment #8
pwolanin CreditAttribution: pwolanin commentedUnfortunately, https://issues.apache.org/jira/browse/SOLR-2535 was not committed for 3.3
Comment #9
pwolanin CreditAttribution: pwolanin commentedSince Solr 3.3 was released we can skip at least the spellcheck patch. The file handler patch is nice to have, but won't prevent Solr from otherwise working with Drupal.
Comment #10
mcabalaji CreditAttribution: mcabalaji commentedHi
I tried to implement the GEO spatial with Drupal using the PATCH #3 and with SOLR 3.2 and I was able to see GEO spatial working . Following are the Schema Changes and the Process I followed to make it work
SCHEMA Changes
STEP 1:
Next, I added a hook_apachesolr_update_index() function to a custom module to index Location CCK data into the Solr Document.
STEP 2 :
I then add a hook_apachesolr_modify_query() function to my custom module to override the Solr query params.
// The spatial query syntax has an augmented "fq" value, but the apachesolr Drupal module sets the fq parameter automatically (via: $query->get_fq()) , So for this I need to make a change to the apachesolr contrib module
IF STEP 2 isn't working For Testing you can change in the apachesolr views query.inc
And then I was able to see the Results show up based on Distance and I was able to do a SORTING based on Distance . The new spatial query syntax (documented here: http://wiki.apache.org/solr/SpatialSearch)
Hope this Helps
Thanks
Balaji
Comment #11
pwolanin CreditAttribution: pwolanin commentedRight, so we cannot do:
because our other dynamic fields use prefixes. So we need to flip this around, maybe:
Comment #12
vishun CreditAttribution: vishun commentedHey there,
I was indeed able to get this to work. Thank you very much pwolanin and mcabalaji, this is beautiful. I changed some small things that allows apachesolr_modify_query() in apachesolr.module to remain as it was, however, a small unobtrusive change elsewhere in apachesolr.module AND apachesolr_search.module is needed.
MYMODULE.module
Changed against 6.x-2.x-dev
apachesolr.module - line 1693
apachesolr_search.module - line 261
Comment #13
pwolanin CreditAttribution: pwolanin commentedhttp://svn.apache.org/repos/asf/lucene/dev/tags/lucene_solr_3_3/solr/CHA...
is out now. Let's target that as our next baseline from 1.4.x
Attached is a 3.3 war (rename as above) which includes patches SOLR-2535 and SOLR-232. The other bug is fixed in 3.3.
Comment #14
wouters_f CreditAttribution: wouters_f commentedCompletely off topic, I love the business here, thanks you guys, this sh!t is great!
Now, as I want to put the workable solution in the issue, is this all correct?
I installed a plain vanilla ubuntu server (selected tomcat in installer)
-I added the zip file (from post #13, thanks pwolanin) to the webapps folder (after renaming it to solr.war)
http://drupal.org/files/issues/apache-solr-3.3-ACQUIA-PATCHED.zip
-I created the solr working foders and config files for a multiple solr cores. (extract attachement into /var/lib/tomcat6/solr)
-I added the following schema changes (from post #10, thanks mcabalaji) (starting from schema name="drupal-1.4" version="1.2">)
changes added from post #11
All this seems to produce no errors on the solr side, I will test the suggested hooks asap.
**wild thought**, maybe this stuff could be in the apachesolr_geo module?
Comment #15
vishun CreditAttribution: vishun commentedI personally think it would be awesome if Spatial Search became part of apachesolr itself, perhaps as a separate submodule but perhaps otherwise orchestrated via module settings. One thing I did not include in my post was a module that I've yet to release called Locator which will automatically try to determine the user's location and store it to their session. It gracefully degrades through HTML5 GeoLocation, Maxmind's GeoIP, and simple user input.
/me needs to finish and release that module one of these days.
Comment #16
pwolanin CreditAttribution: pwolanin commented@drupal_sensei - I'm not sure that schema snippet is correct.
Look in more detail at the Solr 3.3 example.
The _d suffix appears to refer to:
Comment #17
wouters_f CreditAttribution: wouters_f commentedOops, it seems I still cant get it right.
again from the start:
1. downloaded apachesolr module, using included schema.xml (drupal-3.0-beta7)
Then altered the schema.xml with following lines:
2. Installed solr with the default solrconfig and altered schema file.
3. succesfully connected the apachesolr server.
Indexed all the content (which has a location cck field).
4. The code suggested in postr #12 should look like this (I Guess) for Drupal 7
4. Without the query alter the search works, with the params added it fails.
I see the field types Geohash and location in my solr, but not the fields.
Thats probably why i get the following error while doing the query:
Feels like I am close to get it to work.
Comment #18
pwolanin CreditAttribution: pwolanin commentedwe should not use a suffixed field like *_d. This will certainly conflict at some point with a prefixed field, though in theory all our existing prefixes are more specific.
Look at the example schema, instead of specifying a suffix, apparently you can specify a field type like:
Though this will create a suffixed synamix field, it will be even more specific.
Also, I got some feedback about this from Yonick on the solr-user list, so you might read that exchange.
Comment #19
wouters_f CreditAttribution: wouters_f commentedShort summary of the BoF @ drupalcon
Problem :
Different versions of the schema are being used.
Drupal site builders are afraid of/dont understand the schema file.
The apachesolr multilingual module uses a mechanism where it extends a default schema file with field types depending on user languages. The geo functionality has the same need.
What I remembered from the Bof:
Comments should be added in the schema file so admins can edit it to their wishes.
http://wiki.apache.org/solr/SpatialSearch says that will be built in in Solr 4.0.
Comment #20
pwolanin CreditAttribution: pwolanin commentedI must not have been at the same BoF - none of those summary points match what I remember discussing or suggesting.
I said we will not build any kind of schema builder, but rather add some markers to the schema to facilitate the multilingual module.
Comment #21
wouters_f CreditAttribution: wouters_f commentedIt appears I misunderstood.
I am sorry for that.
I updated the summary to represent what you said.
Comment #22
jimijamesi CreditAttribution: jimijamesi commentedSolr 3.4 returns results but wont return a mix of location nodes and non-location nodes
Update: using 6.2.x and the modifications above Solr is now returning location and non-location nodes in its search result.
Still cant get proximity results only results based on relevancy
following #12 gave some errors and field_location latlong is not being indexed.
Update2: I got this working with 6.2.x.dev I documented my effort here
http://drupal.org/node/1334960
Comment #23
pwolanin CreditAttribution: pwolanin commentedHere's a possible schema.xml that at at least allows me to index lat/lon.
The dynamic field prefixes aren't great, but not sure if I can come up w/ better.
Comment #24
pwolanin CreditAttribution: pwolanin commentedComment #25
egrotke CreditAttribution: egrotke commentedHow is this patch applied? Doesn't seem to match up with Drupal instructions for applying a patch.
Any help would be greatly appreciated
Thanks!
Comment #26
egrotke CreditAttribution: egrotke commentedOh okay, found it here: http://drupal.org/node/620014
Comment #27
pwolanin CreditAttribution: pwolanin commented3.4 is out...
Comment #28
pwolanin CreditAttribution: pwolanin commentedCommitting this patch as the basis for further refinement.
Comment #29
wouters_f CreditAttribution: wouters_f commentedygerasimov has implemented geospatial searching with solr in drupal.
http://drupal.org/project/search_api_location
Comment #30
pwolanin CreditAttribution: pwolanin commented@drupal_sensei - that's for Solr 1.4 using an external geo library, not directly relevant to this issue.
Comment #31
Nick_vhMaking this generic for the solr 3.x branch.
Comment #32
Nick_vh#1334960: SOLR 3.4 & D6.x indexing location nodes more info can also be found in this (closed) issue
Comment #33
Nick_vhAdding this to Contrib Component. Good for someone to pick up to develop a contributed module and marking postponed until someone picks it up
Comment #34
Nick_vhWon't fix here. See apachesolr_geo or apachesolr_location for more information on geo searching