warelab / gramene-swagger

Gramene web service interface, powered by swagger
1 stars 0 forks source link

Expand search results to include, for example, all orthologs of all search results. #2

Open mycrobe opened 8 years ago

mycrobe commented 8 years ago

As a user I would like to be able to call a serach API enpoint and be returned all results and all orthologs of those results. The endpoint should have the same query parameter specification as /search but also require a parameter for the name of the field in the SOLR core with which to expand the search.

How the expand parameter would work:

ajo2995 commented 8 years ago

I don't think this is needed within the swagger server. It is possible to expand a search through another field with facet counting.

First, add a facet field to the query params

{
    'facet.field' : '{!facet.limit=-1 facet.mincount=1}' + facetFieldName,
    facet: true
}

When the results come back, convert the values into a new filter facetFieldName + ':(' + values.join(' OR ') + ')' N.B. values has to be populated from the facet_counts.facet_fields[facetFieldName] array which alternates between field values and counts