Add pyquery path setting.

rtd2
Eric Holscher 2012-11-23 15:32:07 -08:00
parent 3cc0fb910a
commit 8f6ad7d6ce
2 changed files with 11 additions and 0 deletions

View File

@ -51,4 +51,14 @@ The password to use when connecting to the Read the Docs API. Used for hitting t
INDEX_ONLY_LATEST
-----------------
Default: `False`
In search, only index the `latest` version of a Project.
DOCUMENT_PYQUERY_PATH
---------------------
Default: `div.document`
The Pyquery path to an HTML element that is the root of your document.
This is used for making sure we are only searching the main content of a document.

View File

@ -72,6 +72,7 @@ class ImportedFileIndex(indexes.SearchIndex, indexes.Indexable):
log.info('Unable to index file: %s, error :%s' % (file_path, e))
return
log.debug('Indexing %s:%s' % (obj.project, obj.path))
DOCUMENT_PYQUERY_PATH = getattr(settings, 'DOCUMENT_PYQUERY_PATH', 'div.document')
try:
to_index = strip_tags(PyQuery(content)("div.document").html()).replace(u'', '')
except ValueError: