×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    3

    Headless searches with the mh5 framework

    Hi,

    The API docs at http://api.maps.nokia.com/en/mobile/...ts.Search.html mentions doing headless search by invoking a searchAdapter's search function directly, but I've not been able to figure out how exactly I would do that as I need to provide callbacks to that function and would really like it to use the default ones.

    What I want is basically this:
    When my app loads I want it to immediately fire off a search using my custom searchAdapter. I don't want to even display an input field for search parameters, as I'm handling searches from a serverside component. I am searching in an API that returns tons and tons of XML and I *really* do not want a mobile device to have to deal with all that data so I'm basically routing the search through a server that will parse the API's XML results and return JSON to my client. The server does not care about any sort of user input, which is why I do not need an input field in the first place. While I certainly *could* hide the input field with CSS and use some javascript to trigger a search in the window.onload this feels like a giant hack to me.

    Even better would be if I could just somehow override the default search URL to my own. I had a look at the docs but I couldn't see any option for doing this. The serverside search component is under my control so I really do not need to map the results at all, it can easily return JSON that looks just like the mh5 API expects.

    Any hints/links/help would be appreciated

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2012
    Posts
    65

    Re: Headless searches with the mh5 framework

    Hi ivarni,

    sorry for this late answer. From this point on we'll do our best to answer questions ASAP.

    Back to your question.

    You can't now overwrite the default search URL in MH5 searchAdapter. That means you have to write your own adapter. It should be pretty easy to fire a jsonp request by using nokia.mh5.jsonp.

    Do you use the predefined app flow or you just use components on them own?

    Here the solution for the first case:

    Code:
    nokia.mh5.app.embed({
       //here your props
    });
    var searchPage = nokia.mh5.app.controller.current.page;
    yourAdapter.search(null, yourParams, function callback(data) {
              searchPage.model.data = data.results;
              //at this point our MH5 binding to "data" property will update the list and the map.
    }, function errorback() {
              searchPage.showNotification("My error message", myTimeoutInMilliseconds);
    });
    Please note that you have to deliver the result structure in the expected manner. For more details look at "Table 1. Mapping requirements" at http://api.maps.nokia.com/en/mobile/documentation.html

    If you just use standalone components without the "embed" function or you define your own pages write us what it is and we'll help you to solve the search adapter problem for your specific use case.
    Last edited by ZieL; 2012-06-27 at 18:25.

Similar Threads

  1. Searches are not restricted to an area
    By arrowpointe in forum [Archived] Places API
    Replies: 7
    Last Post: 2012-04-25, 18:44
  2. RWsSession in a console/headless application
    By atleta in forum Symbian C++
    Replies: 12
    Last Post: 2009-01-07, 02:46
  3. map framework
    By pablocarcaba in forum Symbian C++
    Replies: 1
    Last Post: 2008-06-28, 00:29
  4. Maxartists searches for IT professionals
    By maxartists in forum News, Announcements and Job Listings
    Replies: 0
    Last Post: 2007-11-02, 14:17
  5. Bluetooth: constantly searches devices
    By antonio5982 in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2007-06-11, 15:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •