BingSearchProvider and multiple results

3 posts, 1 answers
  1. Civelle
    Civelle avatar
    29 posts
    Member since:
    Dec 2009

    Posted 23 Jul 2010 Link to this post

    Hi.

    In our application, we are using the RadMap telerik control, to display a map for the location of a customer. The first time the map is built, the location is provided in the form of a regular address. It may happen that the address provided is incomplete (country missing, province/region missing, door number missing or invalid, etc...). In this situation, we would like the BingSearchProvider to return a list of 'possible matches' for the user to pick the right one.

    So far, I have tried to accomplish this task using the BingSearchProvider found in 'Telerik.Windows.Controls.Map', but it always return at best one result, eventhough the criteria I am providing is 'vague' (100 Main Street). It looks like if the BingSearchProvider is deciding for me what is the best fit, based on I don't know what exactly.

    I did some testing on Bing Site and it seams to be difficult to predict the results of a Search action if the address is incomplete: the first time, if I enter '100 main street', sometimes the result will be 'We didn't find results for your search. Try other search terms, or click a type of listing above', sometimes, it will bring back an address in Toronto (the closest match to my current location?). If I modify the search criteria to be '100 Main Street Alberta', it returns a list of possible values in Alberta Canada (which is what I am looking for in this case) from which I can pick to display the map. The next time I do a search with '100 Main Street Alberta', it will bring back only one item (possibly the one that I selected previously), even after clearing my internet cache and closing and re-opening the browser). I looked into the 'preferences', to see if there were some setting that were used for managing the search result and I could not find any, other than  'Current Location'. At one point, I redid the search for '100 Main Street Alberta' and I got back an address in United States (100 Main St, Alberta, Va 23821). Maybe I did something to get this result instead of the previous result in Alberta Canada, but I can't remember...). Finally, I redid the original search '100 Main Street' that previously returned an address in Toronto, and I got three addresses in the States! I really don't like this behavior of deciding for me. I would like it to return all of the possible values in a targeted region that I could specify myself...


    That being said, Is there a way to have BingSearchProvider only return a list of all possible matches, in a targeted region like 'North America' or in a targeted country, when providing an incomplete address?

    Civelle
  2. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 27 Jul 2010 Link to this post

    Hello Civelle,

    The BingSearchProvider returns list of the possible matches in the AlternativeSearchRegions property of the result set. For example:

    private void Provider_SearchCompleted(object sender, SearchCompletedEventArgs args)
    {
        SearchResponse response = args.Response;
        if (response.ResultSets.Count > 0)
        {
            SearchResultSet resultSet = response.ResultSets[0];
            foreach (SearchRegion region in resultSet.AlternateSearchRegions)
            {
                foreach (Location location in region.GeocodeLocation.Locations)
                {
                    Rectangle rect = new Rectangle()
                    {
                        Width = 40,
                        Height = 40,
                        Fill = new SolidColorBrush(Colors.Green)
                    };
      
                    ToolTip tooltip = new ToolTip()
                    {
                        Content = region.GeocodeLocation.Address.FormattedAddress
                    };
      
                    ToolTipService.SetToolTip(rect, tooltip);
      
                    MapLayer.SetLocation(rect, location);
      
                    this.informationLayer.Items.Add(rect);
                }
            }
        }
    }

    We will extend our provider with new Bing Search features (search by query, location and radius, for example) in the future releases. You can check availability of these features using our PITS:

    http://www.telerik.com/support/pits.aspx#/public/silverlight/2837

    Best wishes,
    Andrey Murzov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Civelle
    Civelle avatar
    29 posts
    Member since:
    Dec 2009

    Posted 24 Aug 2010 Link to this post

    Thanks Andrey!

    Ginette.
Back to Top