Menu

#19 Add support for OpenSearch suggestions extension

None
closed
None
2015-01-24
2015-01-09
No

Implement OpenSearch suggestion extension as per spec:

http://www.opensearch.org/Specifications/OpenSearch/Extensions/Suggestions/1.1

This will show suggestions in the search box on firefox browser.

1 Attachments

Discussion

  • James Turner

    James Turner - 2015-01-10

    This feature seems useful and worth adding. Some initial thoughts on the details, following initial analysis of this patch:

    Firefox 34 includes a new (and apparently unpopular!) search user interface in which suggestions no longer seem to work. Suggestions do work as intended in the older search UI, which can be restored by setting the following about:config option:

    browser.search.showOneOffButtons = false
    

    Search suggestions from LDAP Addressbook work as intended in Chromium 39.

    Both Firefox and Chromium ignore fields 2 and 3 of each suggestion (optional description and URL). For Firefox, this limitation is discussed in the following bug report:

    https://bugzilla.mozilla.org/show_bug.cgi?id=386591

    I've revised the final "for" loop as follows in order to correctly populate fields 2 and 3 instead of filling in with the locality (l). I've also set field 1 is to use the cn attribute instead if displayName is empty.

    for($i=0;$i < $ldap_data["count"]; $i++)
    {
        // Search term suggestion
        if(!empty($ldap_data[$i]["displayname"][0]))
            array_push($json[1],$ldap_data[$i]["displayname"][0]);
        else
            array_push($json[1],$ldap_data[$i]["cn"][0]);
    
        // Description of suggestion (not currently used)
        array_push($json[2],"");
    
        // URL for search result(s) for this suggestion
        array_push($json[3],current_page_folder_url() . "?filter="
            . urlencode($_GET["filter"]));
    }
    

    An alternate way of populating $json[3] might be to point to the LDAP record's page directly, although this might be less useful if there's more than one record with an identical name:

        array_push($json[3],current_page_folder_url() . "info.php?dn="
            . urlencode($ldap_data[$i]["dn"]));
    

    A further thought is that perhaps there should be a config option to turn suggestions on/off for people who don't want them (e.g. due to additional load on the LDAP server).

     
    • Murray Fraser

      Murray Fraser - 2015-01-11

      I agree, there should be a config option to turn the suggestions off.

      I was also going to suggest adding a javascript search box to function 'show_search_box', that can be enabled by the same config option. This would enable autocomplete on the ldap-addr-book interface as well.

       
  • James Turner

    James Turner - 2015-01-10
    • status: open --> accepted
    • assigned_to: James Turner
    • Milestone: -->
     
  • James Turner

    James Turner - 2015-01-24

    Search suggestions are included in version 0.17 - both OpenSearch and the application's own built-in search box.

     
  • James Turner

    James Turner - 2015-01-24
    • status: accepted --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB