GeoSpatial data and FAST searches RRS feed

  • Question

  • I have crawled a SQL Table using FAST that contains the longitude and latitude data for office locations.

    Now I want to be able to run a query which is something like:

    All offices which are near a City. For example: Get all offices which are near Chicago?

    How can I configure FAST queries to get near a given location?

    Would please appreciate your ideas.


    -- Mohan | My Blog
    Friday, February 18, 2011 4:01 AM

All replies

  • There is some information on technet ( Basically you sort your results based on a formula, and you have to pass this in yourself.

    There is an example using Euclidian distance, but you might not need the height part of the formula and could omit it.

    Seems this sorting is available only if you use the Query Web Service or the FASTSearchRuntime object.

    Mikael Svenson

    Search Enthusiast - MCTS SharePoint/WCF4/ASP.Net4 -
    Friday, February 18, 2011 9:06 PM
  • Hi Mikael,

        I have read this blog and we will have to do something like Geo-Sorting and/or Geo-Searching.  We will have the Latitude and Longitude but the example in the link is pretty unclear to me.

    Problem that I am unclear about and maybe someone can shed the light is what these values are like 50-latitude,2)... no sign of what 2 is or 50.  :)  We will need to do something like within 50 miles of zipcode 444444.  Is there any decent documentation out there on how to accomplish this goal?

    <SortByProperties> <SortByProperty name="[formula:pow(50-latitude,2)+pow(100-longitude,2)+pow(200-height,2)]" direction="Ascending" /> </SortByProperties>

    Wednesday, March 21, 2012 9:47 PM
  • Hi,

    The latitude and longitude are names of managed properties which contain those coordinates. If you have a zip code you have to use a service of some kind (for example google/bing maps) which can give you the coordinates of that zip code, which can be used in the formula.

    Mikael Svenson

    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4

    Thursday, March 22, 2012 7:38 PM
  • Hi Mikael,

       I knew what the Latitude and longitude are managed properties :).  What was unclear is the 50-latitude and/or 100-longitute.  I believe I found the answer by looking at the 13280 port that has GeoSearch as an option.  Seems kind of crazy that we would have to extend the pipeline to get this to work as explained in the blog above. 

    Hopefully this will not be too bad.



    Thursday, March 22, 2012 7:44 PM
  • Ah,

    Well, the geosearch on QR server is something they forgot to remove. The formula itself is just the formula for eucledian distance in 2D. I agree they could have kept the function in there, but I guess the current API didn't have a good fit for it.


    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4

    Thursday, March 22, 2012 7:55 PM
  • Hmmmm,

       So what I am hearing is the forumala that is in the QR Server will not work though the QueryService? 

    Thursday, March 22, 2012 8:04 PM
  • Hi,

    Correct, but then again, you can use whatever distance formula you want. Radius, square, 2D, 3D. Passing in the properties to be used in geo search compared to passing in a formula is not that big.


    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4

    Thursday, March 22, 2012 8:21 PM
  • I find this very interesting and concerning at the same time :). 

      <SortByProperty name="[formula:pow(50-latitude,2)+pow(100-longitude,2)+pow(200-height,2)]"
                      direction="Ascending" />

    So in the example above I have the Latitude and Longitude, and also have the radius lets say 50 miles.  Where I guess I am struggeling with here is if they do a search on Muffins (bad example but WTH) and we have the latitude and longitude lets say:

    Lat: -34.00000

    Long: 132.3424242

    Radius: 50 miles

     the query we send in has something like:


    What I am struggeling here is how would I tell them to use plug in the 50 miles from either direction.  Yes we have the latitude and long.  Any thoughts to this?  Can we use SortFormula or FQL?  I believe we can.

    Thursday, March 22, 2012 8:38 PM
  • Hi,

    When using a query packet, you can set the formula, you cannot do this in URL query mode. Formula sort can only be used in FQL enabled API's.

    Mikael Svenson

    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4

    Thursday, March 22, 2012 9:16 PM