API Reference¶
The IndicoSearchProvider
interface allows an external service to integrate with Indico’s search module.
- class indico.modules.search.base.IndicoSearchProvider¶
- RESULTS_PER_PAGE = 10¶
The number of results to show per page.
- active = True¶
- get_placeholders()¶
Retrieve the list of search shortcuts that will be shown to users when typing a search query.
- Returns
a list of
SearchOption
instances
- get_sort_options()¶
Retrieve the list of search sortable options.
- Returns
a list of
SearchOption
instances
- search(query, user=None, page=None, object_types=(), *, admin_override_enabled=False, **params)¶
Search using a custom service across multiple targets.
- Parameters
query – Keyword based query string
user – The user performing the search (for access checks)
page – The result page to show
object_types – A filter for a specific SearchTarget
admin_override_enabled – Whether to ignore access restrictions
params – Any additional search params such as filters
- Returns
a dict with the ResultSchema structure
- class indico.modules.search.base.SearchOptions(placeholders: list, sort_options: list)¶
- dump()¶
- placeholders: list[indico.modules.search.base.SearchOption]¶
- sort_options: list[indico.modules.search.base.SearchOption]¶
- class indico.modules.search.base.SearchTarget(value)¶
An enumeration.
- attachment = 6¶
- category = 1¶
- contribution = 3¶
- event = 2¶
- event_note = 5¶
- subcontribution = 4¶
- indico.modules.search.base.get_search_provider(only_active=True)¶
Get the search provider to use for a search.
- Parameters
only_active – Whether to check that the provider is active; in case it isn’t, the default InternalSearch provider will be used.
Models¶
- class indico.modules.search.result_schemas.ResultSchemaBase¶
- category_path: CategoryPathSchema¶
The parent category chain
- class indico.modules.search.result_schemas.EventResultSchema¶
Bases:
ResultSchemaBase
- description¶
The event description
- end_dt¶
The event end date time
- event_id¶
The event id
- event_type¶
The event type
- highlight¶
The event content to highlight
- location: LocationResultSchema¶
The event location
- persons: PersonSchema¶
The event associated persons
- start_dt¶
The event start date time
- title¶
The event title
- type: SearchTarget¶
The record type
- class indico.modules.search.result_schemas.ContributionResultSchema¶
Bases:
ResultSchemaBase
- contribution_id¶
The contribution id
- description¶
The contribution description
- duration¶
The contribution duration
- end_dt¶
The contribution end date time
- event_id¶
The contribution event id
- highlight¶
The contribution content to highlight
- location: LocationResultSchema¶
The contribution location
- persons: PersonSchema¶
The contribution associated persons
- start_dt¶
The contribution start date time
- title¶
The contribution title
- type: SearchTarget¶
The record type
- class indico.modules.search.result_schemas.SubContributionResultSchema¶
Bases:
ContributionResultSchema
- subcontribution_id¶
The sub-contribution id
- type: SearchTarget¶
The record type
- class indico.modules.search.result_schemas.AttachmentResultSchema¶
Bases:
ResultSchemaBase
- attachment_id¶
The attachment id
- attachment_type: AttachmentType¶
The attachment type
- contribution_id¶
The attachment contribution id
- event_id¶
The attachment event id
- filename¶
The attachment filename
- folder_id¶
The attachment folder id
- modified_dt¶
The attachment last modified date time
- subcontribution_id¶
The attachment sub-contribution id
- title¶
The attachment title
- type: SearchTarget¶
The record type
- user: PersonSchema¶
The attachment author
- class indico.modules.search.result_schemas.EventNoteResultSchema¶
Bases:
ResultSchemaBase
- content¶
The note content
- contribution_id¶
The note contribution id
- event_id¶
The note event id
- highlight: HighlightSchema¶
The note content to highlight
- modified_dt¶
The note last modification date time
- note_id¶
The note id
- subcontribution_id¶
The note sub-contribution id
- title¶
The note title
- type: SearchTarget¶
The record type
- user: PersonSchema¶
The note author
- class indico.modules.search.result_schemas.PersonSchema¶
Bases:
_ResultSchemaBase
- affiliation¶
The person’s affiliation
- name¶
The person’s name