0.x
  • User Guide
  • Developer Guide
  • Cookbooks
  • Best Practices
  • Reference
    • Modules
    • Actions
    • Controllers
    • All dispatch rules
    • Filters
    • Models
    • Services
      • everything
      • export
      • info
      • language_list
      • media_upload
      • menuexport
      • meta
      • persistent_get
      • persistent_set
      • recompile
      • search
        • Parameters
      • submit
      • techempower_json
    • Builtin Tags
    • Custom Tags
    • Validators
    • Directory structure
    • Icons
    • Notifications
    • Installation requirements
    • Global configuration
    • Site configuration
    • The Status site
    • Command-line
    • Transport
    • Troubleshooting
    • EDoc reference
  • Glossary
Zotonic
  • Docs »
  • Reference »
  • Services »
  • search
  • Edit on GitHub

search¶

  • Module: mod_search

Search Zotonic’s resources using the Search.

For instance, the API call:

http://localhost:8000/api/search?cat=text&text=test

Returns a JSON list of all resource ids of the category text that contain the string test:

[320]

Adding &format=simple to the API call gives us a list of JSON objects:

[
  {
      "category": [
          "text"
      ],
      "id": 338,
      "preview_url": "http://example.test:8000/image/2014/10/8/image_2014_09_09_19_19_41.png%28800x800%29%28upscale%29%28CF8AD1D93AC1B8457F9AD6B9BA64C74F%29.jpg",
      "summary": {
          "trans": {
              "en": "English summary",
              "es": "Spanish summary"
          }
      },
      "title": {
          "trans": {
              "en": "English",
              "es": "Hola hola Espanol"
          }
      }
  }
]

Parameters¶

You can enter all parameters that are in the standard Search.

Besides, the following parameters exist:

limit

The number of results to return. Defaults to 20; maximum number to return per call is 1000. To return more, do multiple requests with the offset parameter.

offset

Start offset for the result set.

format

Either ids to return a plain array of rsc ids; or simple to return a list of JSON objects with the resource’s title, summary, category, and preview_url (the first image).

See also

Search

Next Previous

© Copyright 2009–2017, The Zotonic Project (zotonic.com). Revision 8880bacb.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: 0.x
Versions
latest
stable
0.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.