简体   繁体   中英

How to do a geospatial search with Lucene on a document that has multiple locations in Sitecore?

I have a scenario where a single document in a Lucene index could have multiple locations. The document is a representation of a Sitecore item and N location items that are assigned to it. A point and radius would be used to search for all documents that have at least one location in that radius. Other search criteria such as name and tagging would also be considered. The documents would need to be sorted by distance, using the closest matching location assigned to that document. I have used lucene.net.contrib.spatial for single points, but I can't quite piece together how multipoint would, or could, work.

I suggest you to use this module or to modify it for your requirements . https://marketplace.sitecore.net/en/Modules/L/Lucene_Spatial_Search_Support.aspx

I don't know what version of Sitecore are you using. From comments looks like it doesn't work on Sitecore 8. You find source code here:
https://github.com/aokour/Sitecore.ContentSearch.Spatial

After trying a bunch of different solutions, I've created created a reverse tagging system.

The short of it is, I use Sitecore's links database to create a computed index field on each location which stores the ID of each item which is tagged with that location. I then search locations first, then use the IDs on the location results as search parameters for a query of the content that I am actually looking for.

I've outlined the full implementation here:

http://alextselevich.com/2016/08/performing-a-geospatial-search-with-lucene-on-a-document-that-has-multiple-locations/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM