Add pyquery path setting.
parent
3cc0fb910a
commit
8f6ad7d6ce
|
@ -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.
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue