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.
This issue is part of meta issue #1931088: [META] Fixing tests
When we add Location field to the node and create search index with Search API we can't see location fields there. The reason of this is because location module is not integrated with Entity API.
Here is patch that allows to add Location fields to index (I tried with Apachesolr index).
So now it would be possible to build facets like "Country name".
Comment | File | Size | Author |
---|---|---|---|
#53 | location_entity-1186868-53.patch | 1.43 KB | edxxu |
#50 | location_entity.patch | 2.85 KB | bebop-design |
#45 | location_entity.png | 37.14 KB | esod |
#25 | facets.png | 2.76 KB | javdich |
#10 | location_entity.tar_.gz | 935 bytes | ygerasimov |
Comments
Comment #1
paulgemini CreditAttribution: paulgemini commentedHmmm. I've added this in my location/contrib in a new directory, location_entity, and it's not showing up in my list of modules to activate.
Comment #2
ygerasimov CreditAttribution: ygerasimov commentedVery interesting. Can you check please once again? The name of the module is Location Entity under Location group.
Comment #3
paulgemini CreditAttribution: paulgemini commentedNevermind. Misnamed a file. Knew I'd done something silly but had a mental block!
Will give it a try tomorrow.
Comment #4
paulgemini CreditAttribution: paulgemini commentedActivated Location Entity and got this ctools error:
Maybe related? Or possible unrelated. Not sure...
Comment #5
paulgemini CreditAttribution: paulgemini commentedOk - probably not related...
Comment #6
paulgemini CreditAttribution: paulgemini commentedHey this seems to be working. I'm seeing these in my facet list.
Comment #7
paulgemini CreditAttribution: paulgemini commentedComment #8
bryancasler CreditAttribution: bryancasler commentedActive discussion on the issue happening over here #1209576: problems with ctools on update.php and login pages
Comment #9
deeve CreditAttribution: deeve commented@ygerasimov: I get the following error when I attempt to apply location_entity.patch using cygwin to Location 7.x-3.x-dev (.info file is created correctly then I get the following):
patching file b/contrib/location_entity/location_entity.module
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 83:
anyone else get this?
..also noticed there doesn't appear to be code to create an .install file?
Comment #10
ygerasimov CreditAttribution: ygerasimov commented@daeve, yes module location_entity doesn't have .install file. Very strange patch can't be applied as it plain new files being added. I suspect problems in cygwin.
Here is module itself in archive.
Comment #11
deeve CreditAttribution: deeve commented@ygerasimov: thanks for the file - I'd actually already created my own in between from your original patch file ;)
Have now managed to enable the module but doesn't seem to have had any effect. I thought this would enable Location fields to be indexed & visible for Search API module to use? I have cleared my cache several times & run cron.
Comment #12
ygerasimov CreditAttribution: ygerasimov commented@deeve, you need to add location fields to your Search API index in order them to be indexed.
Comment #13
deeve CreditAttribution: deeve commented@ygerasimov: I've tried but they don't appear as an option to select in Search API index. When I imported my nodes I created a custom Content Type but used the location:city, location:postal code fields etc for the address. Only the other fields I created are now available to select in Search API index.
Any suggestions how I can include location fields?
Comment #14
ygerasimov CreditAttribution: ygerasimov commented@deeve please check "Add related fields" selectbox and confirm that you don't have your location field there.
Comment #15
deeve CreditAttribution: deeve commented@ygerasimov: First thing I did & I don't. Just standard fields available:
Author, Translation Source node, Tags, Image, Forums, Description.
Comment #16
daemonsy CreditAttribution: daemonsy commentedHi, is this supposed to work on user locations as well? Sigh, couldn't get it to show in the search API index as well.
Comment #17
deeve CreditAttribution: deeve commented@daemonsy: I'm now wondering whether it may be because when I imported data into my custom Content Type, I'd used the location module: locations.City & location module: locations.Postal Code fields which were available within my Feeds node processor's mapping UI. I'm going to try deleting all nodes & re-importing but this time manually declaring the Location fields within the Content Type first as only these fields appear as options within the Search API setup.
Comment #18
deeve CreditAttribution: deeve commentedThat worked :)
Comment #19
Shadlington CreditAttribution: Shadlington commentedFollowing this with interest
Comment #20
daemonsy CreditAttribution: daemonsy commented@deeve Hi sorry for the late reply. I got my installation to work.
It's weird. I add a location field to a NODE and then add it into a profile2 type as an EXISTING field.
Then it works. Search API sees it. I don't know why.
Haha on a side note, is there any way to get email notifications for threads you are active in?
Thanks man.
Comment #21
deeve CreditAttribution: deeve commented@daemonsy: I don't believe there currently is a way of being notified by email on here, other than contributing to a thread & then monitor the responses within 'Your Dashboard'. The other way most people seem to manage is to place the word 'subscribe' if they're not contributing. Compared to other similar sites, this practice seems nearly as convoluted as Drupal itself sometimes ..go figure :)
Comment #22
daemonsy CreditAttribution: daemonsy commentedHaha your comment on Drupal is spot on. Thanks mate.
Comment #23
RaulMuroc CreditAttribution: RaulMuroc commentedShould we expect this works on Location CCK locations?
Comment #24
javdich CreditAttribution: javdich commentedI gave this module a quick test tonight. I'm using Search API with the Database search. I'm also using it with the Views Search. The module works perfectly with Location CCK fields. It did not seem to work with Node Locations, although I use Location CCK for my application, so I didn't spend to much time.
Thanks for the work!
Comment #25
javdich CreditAttribution: javdich commentedOne thing I did find was when I used facets for searching, it seems to index city that are two words such as "New York" or "Prince Albert" on two lines.
In my example I added a town in Saskatchewan, Canada called "Prince Albert" and the facet comes up twice. "prince" on the first line "albert" on the second. See attached screenshot for clarification.
Comment #26
javdich CreditAttribution: javdich commentedOops, Fixed it by indexing province and city by "String" instead or "Fulltext" and re-indexed. This solved my problem.
Comment #27
Alconaft43 CreditAttribution: Alconaft43 commentedWhat about to apply patch to dev version?
Comment #28
RaulMuroc CreditAttribution: RaulMuroc commentedCommit this please :-)!
Comment #29
podarokpostponed before tests fix
#1931088: [META] Fixing tests
Comment #30
podarok#1931088-3: [META] Fixing tests mostly fixed for 7.x-3.x branch
this one needs review
Comment #31
podarokthis one needs tests
Comment #32
podarokcommited pushed to 7.x-3.x
+ better title
Comment #33
Desi Raaj CreditAttribution: Desi Raaj commentedWill this allow Distance / Proximity exposed filter to be used with Search_API view? I'm using Database server.
Comment #34
podaroklooks like this is a task after pushing commit
Comment #35
Desi Raaj CreditAttribution: Desi Raaj commentedok nice, sounds good.
Comment #36
fehin CreditAttribution: fehin commentedLooking for the proximity/distance feature with search API too.
Comment #37
xeeshangulzar CreditAttribution: xeeshangulzar commentedlocation_entity.patch queued for re-testing.
Comment #39
xeeshangulzar CreditAttribution: xeeshangulzar commentedlocation_entity.patch queued for re-testing.
Comment #41
podarok#39 - this one already commited - llok at #32
It never pass tests anymore )))
Comment #42
Media Crumb CreditAttribution: Media Crumb commentedSo is this patched an in the current dev version?
Comment #43
RaulMuroc CreditAttribution: RaulMuroc commentedSame question, confused if this is already committed as said in #32 or needs more testing/improving. :S
Comment #43.0
RaulMuroc CreditAttribution: RaulMuroc commentedupdate meta
Comment #44
nasia123 CreditAttribution: nasia123 commentedI would like to user the location module with the search api. This is currently supported for the geofiled in this module , https://drupal.org/project/search_api_location
I also posted a question in the module's page
https://drupal.org/node/1480906
after reading this thread I thought that location module is on the right track on supporting search API, but I am confused since I don't understand if this is now working/commited or not.
Comment #45
esod CreditAttribution: esod commentedIt's not working. I've enabled location_entity module and tried the location module with both 7.x-3.3 and 7.x-3.3+2-dev. And still the fatal error: EntityMetadataWrapperException: Unknown data property field_location.
my code looks like this:
All the other fields working in the ewrapper.
Comment #46
esod CreditAttribution: esod commentedSince I could get latitude and longitude or country to write on node_save(), but not both together, my workaround was to update country in the location table with this query
Run this query after node_save(). I couldn't maintain the $ewrapper for this import because of location entity not working.
Comment #49
ravikiran@gocoop CreditAttribution: ravikiran@gocoop commentedHi Guys,
I have been reading this thread and it shows, the issue still exists.
I have used Default Node Index for Indexing Node data. I couldn't find Location module fields for some reason. I have enabled Location Entity and tried but Didn't help.
When I use Location CCK module and add a field of Location type, Search api starts reading the fields. I would have loved to use this than using Node locations. But all my data is saved Under Node Location fields and I am not able to integrate them with Search API.
What could be the best suggestions or Solutions i can get?
Please help! Im Badly in need. Thanks in Advance.
Comment #50
bebop-design CreditAttribution: bebop-design commentedRemove "new file" lines in patch file
Comment #51
bebop-design CreditAttribution: bebop-design commentedComment #52
edxxu CreditAttribution: edxxu at INsReady commentedI am using Location 7.x-3.7 with Location entity and Location CCK enabled. I add a location field to a content type, but location data can't be indexed. And patch in #50 doesn't work for me.
Comment #53
edxxu CreditAttribution: edxxu at INsReady commentedHere is the patch, please review. Please clear cache, clear all indexed data and re-index to test this patch.
Comment #54
edxxu CreditAttribution: edxxu at INsReady commentedComment #56
lhuria94 CreditAttribution: lhuria94 commentedHi @edxxu,
Last patch still does not work. Tried that patch, cleared cache & Re indexed data. Still Location field not available in field list.
Thanks
Comment #57
lhuria94 CreditAttribution: lhuria94 commentedComment #58
SpadXIII CreditAttribution: SpadXIII at ezCompany commentedIs the patch in #50 and #53 needed at all? I just enabled this module, did not apply any patch, and I could add the Location-fields to my search-index just fine?
Comment #59
AlfTheCat CreditAttribution: AlfTheCat commented#53 works for me, thanks!
Comment #60
gambryI confirm what @SpadXIII says on #58: I use version 3.7 and enabling location_entity works on Search API without any patch.
You probably want to look at supporting search_api_location implementing the field property suggested in here
I can provide a patch if that would speed up the process.
Comment #61
mausolos CreditAttribution: mausolos commentedWhoops! I posted this on this issue, but I think this is actually where I should have posted it, so x-post!
I cannot get this to work, with or without the patch (#53). No matter what I do, the lat/lng field does not come up, either in the field list or the add field drop-down. I do get the Address field, but since my goal is to search via view that has/returns province, state, country and title (with each of these as an independent output field), Address is almost useless.
Location Entity was enabled from the get-go. Not sure what to do next. Any ideas? Did I miss something?
Thanks!
Charles