Ticket #108 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

Package search in the REST API

Reported by: rgrp Owned by: dread
Priority: critical Milestone: v0.10
Component: ckan Keywords:
Cc: Repository:

Description (last modified by dread) (diff)

Add package search facility in the rest api at /api/search

Queries can be provided as for the normal package search either by posting to that url or by performing a get with a query string.

E.g. .../api/search/package?q=xyz

Query parameters:

  • q is keyword string (searches name, title, tags by default)
    • split by words and ANDed
  • additional parameters for specific fields
  • qjson is alternative to q for Searching by specific fields (in addition to keyword string). Payload to json is a JSON-encoded dict which is a dictionary with a q field for free text (keywords) and additional key/value pairs for specific fields
    • if q and qjson specified ignore q and just process qjson value

Additional parameters in addition to query ("q" or "qjson") are:

  • limit
  • offset
  • fullinfo=0/1 - return full record for each result (default=0)
  • order_by=field_name
  • search_notes=0/1 (default 0) do we search notes field in a keyword search

Return value is json encoded dictionary with keys:

  • 'results': list of results
  • 'count': total number of results

Extras (for the future)

  • Prioritisation is not part of this ticket (requires fulltext support in DB or in external app such as Xapian)

Change History

comment:1 Changed 5 years ago by dread

  • Description modified (diff)

comment:2 Changed 5 years ago by dread

  • Description modified (diff)

comment:3 Changed 5 years ago by dread

  • Status changed from new to closed
  • Resolution set to fixed

This has been done in changeset:ec90f59040e0.

comment:4 Changed 5 years ago by dread

  • Description modified (diff)
Note: See TracTickets for help on using tickets.