UsageΒΆ

To use django-gcse in a project:

import gcse

django-gcse dynamically generates the files used by Google Custom Search Engines (CSE) to implement a Linked Custom Search Engine.

Custom Search Engines must first be created within the Google administration screen add link here and then they are imported into django-gcse via the import_cse management command.

Due to the vast number of configuration options available django-gcse maintains a hybrid representation of the CSE. Fields likely to change are stored in the django-gcse database and less frequently changed values are stored in the XML supplied by Google. When a search is performed the database and XML data is merged and supplied to Google. Of course caching of that rarely changing view is useful.

The Linked Annotation file(s) add link here for a CSE are generated by collecting all the Annotations with the background Labels for that CSE and including them in the CSE XML. Each Linked Annotation file is served and is also cached.

There are three ways to add Annotations:

# Directly via the Django admin.

# From an OPML file.

# From an existing Annotation XML file or URL.

Annotations can be shared across multiple CSEs by adding the background Label with the FILTER mode of the CSE to tthe Annotation.

Use the Django admin screens to enter the URLs to be searched (Annotations) and their search refinement Labels. Then you configure your Google CSE to retrieve the Annotations from your django-gcse URL(s).

django-gcse makes it easy to maintain your Annotations.

You can import an existing CSE along with it`s Annotations or create a new one and populate it all from within the django-gcse admin screens.

  1. First create a Google Custom Search Engine and configure the settings as you desire.
  2. Download the CSE context from the Advanced tab.