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
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
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:
instead of the blank page from the current "main fields" search:
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.
> 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.
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.
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:
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:
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.
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.