OpenSearch firefox plugin with "main fields"

Help
2009-08-14
2013-05-28
  • Tom Vercauteren

    Tom Vercauteren - 2009-08-14

    Hi all,

    I just realized that since refbase supports OpenSearch and has autodiscovery link for it, I could have a dedicated search box within firefox in a breeze. This would be similar to
    http://features.refbase.org/OpenSearch.html

    Adding the refbase server to the list of search engines of my firefox search box worked like a charm. However I felt a bit disappointed when seeing that by default it only searched the "keywords".

    Is it possible to change that behavior so that by default, it searches through all main fields? The best option would be for me to either modify the refbase code or make my own firefox search plugin. However, I am not sure how to start, the examples in
    http://beta.refbase.net/opensearch.php?
    do not even show how to search the main fields.

    My end goal is to get an easy search box that would work more closely to a regular search engine, e.g. typing "guillemin fluorescence" (without the quotes) in this search box would lead me to:
    http://beta.refbase.net/show.php?record=3591
    instead of the blank page from the current "main fields" search:
    http://beta.refbase.net/search.php?formType=quickSearch&originalDisplayType=&sqlQuery=&showQuery=&showLinks=&showRows=5&client=&citeStyle=&citeOrder=&quickSearchSelector=main_fields&quickSearchName=guillemin+fluorescence

    The opensearch firefox plugin seemed nice to do that that but if it is simpler to modify the refbase search box, this would also be good for me.

    Cheers,
    Tom

     
    • Matthias Steffens

      Hi Tom,

      > I just realized that since refbase supports OpenSearch and has autodiscovery
      > link for it, I could have a dedicated search box within firefox in a breeze.

      Yes, that's correct. One simply needs to add the refbase database via the Firefox search bar menu.

      > However I felt a bit disappointed when seeing that by default it only searched
      > the "keywords".

      Yes, that's more or less correct (more details below). However, the OpenSearch service supports CQL as its search syntax, i.e. one can use a CQL query as the value of the query parameter.

      http://www.refbase.net/index.php/OpenSearch_service#Query_syntax

      In other words, you can prefix your query with almost any refbase field name to perform a search in that particular field. Examples (you could try these examples with http://beta.refbase.net/ ):

      author = Miller
      author all Miller Wolford
      author any Wolford Meier
      title = Baltic
      publication = Ecol
      year = 2006
      year > 2007
      publisher = Springer
      place = Berlin
      area = Antarctic
      abstract = short-term memory

      For a full list of supported fields, please see function 'mapCQLIndexes()' in file 'includes/webservice.inc.php'.

      In most cases, Firefox should present matching search suggestions from the existing records of your refbase database. However, Firefox doesn't present search suggestions if the response of the server is not ultra-fast. :-/ This is why sometimes the search suggestions feature doesn't seem to work (this mostly happens for fields such as 'title', 'abstract' or the special index 'main_fields'). This is also the reason why the 'keywords' field is searched by default, since Firefox rarely presents search suggestions for the 'main_fields' index.

      > Is it possible to change that behavior so that by default, it searches through
      > all main fields?

      While search suggestions are (by default) provided from the user's preferred list of main fields, it is currently not possible to search the 'main_fields' index by default (more below). I understand that this would be desirable, though, and it's already on our TODO list.

      > the examples in http://beta.refbase.net/opensearch.php? do not even show how to
      > search the main fields.

      For OpenSearch search suggestions, you can use the special index 'main_fields' (see below). However, for regular OpenSearch queries, the 'main_fields' index isn't supported yet.

      > My end goal is to get an easy search box that would work more closely to a
      > regular search engine

      Yes, I understand that. Achieving a more Google-like search behaviour was actually one of the reasons why we started to implement OpenSearch. We also had plans to ultimately make the OpenSearch/CQL syntax the default across all refbase search forms, so that whitespace-delimited search terms would be ANDed by default (instead of searching for a literal compound term as it is now). However, there have been no recent efforts to reach that goal.

      Matthias

      --

      Below follows a bit more technical information and some OpenSearch query examples:

      When returning OpenSearch search suggestions ('...&operation=suggest') that were requested from a browser such as Firefox ('...&client=sug-refbase_suggest-1.0'), refbase-0.9.5 uses the special 'main_fields' index by default, i.e. these two queries will return the same results:

      http://beta.refbase.net/opensearch.php?query=Baltic&recordSchema=json&operation=suggest&client=sug-refbase_suggest-1.0

      http://beta.refbase.net/opensearch.php?query=main_fields%3DBaltic&recordSchema=json&operation=suggest&client=sug-refbase_suggest-1.0

      In the above queries, you can use '&recordSchema=html' to get a regular HTML list instead of a JSON aray. If you leave out the '&client=sug-refbase_suggest-1.0' parameter, the JSON search results won't get prefixed with the source field name (i.e. you'll get, say, "Baltic Sea" instead of "keywords = Baltic Sea" as a return value).

      For any other (regular, i.e. non-suggest) OpenSearch queries, refbase-0.9.5 currently uses the 'cql.serverChoice' index by default (since the special index 'main_fields' isn't yet supported for regular OpenSearch queries). I.e., the following three queries will all return the same results:

      http://beta.refbase.net/opensearch.php?query=Baltic&recordSchema=html&maximumRecords=15

      http://beta.refbase.net/opensearch.php?query=main_fields%3DBaltic&recordSchema=html&maximumRecords=15

      http://beta.refbase.net/opensearch.php?query=cql.serverChoice%3DBaltic&recordSchema=html&maximumRecords=15

      The index 'cql.serverChoice' currently maps to the 'keywords' field. Ideally, 'cql.serverChoice' would map to the user's preferred list of "main fields" but this hasn't been implemented yet. In regular OpenSearch queries, the 'main_fields' index will be currently replaced with 'cql.serverChoice'.

      Note that you can assign another field mapping for 'cql.serverChoice' in function 'mapCQLIndexes()' in file 'includes/webservice.inc.php'. It's just that setting 'cql.serverChoice' to "main_fields" won't work yet.

       
    • Tom Vercauteren

      Tom Vercauteren - 2009-08-18

      Thank you for the detailed answer.

      You can count a +1 vote for being able to set  'cql.serverChoice' to "main_fields" and for having an ANDed search in the "quick search" search box.

      Cheers,
      Tom

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks