def search_keywords( *, repository: KeywordRepository = Depends(get_keyword_repository), params: SearchParams = Depends(), skip: int = 0, limit: int = 100): return repository.get_all(pattern=params.pattern, collection_name=params.collection_name, use_doc=params.use_doc, skip=skip, limit=limit)
def get_keywords( repository: KeywordRepository = Depends(get_keyword_repository), skip: int = 0, limit: int = 100, pattern: str = None, use_doc: bool = True): keywords: List[DBKeyword] = repository.get_all(skip=skip, limit=limit, pattern=pattern, use_doc=use_doc) return keywords
def get_keywords( repository: KeywordRepository = Depends(get_keyword_repository), skip: int = 0, limit: int = 100, pattern: str = None, use_doc: bool = True, collection_id: Optional[int] = None, ordering: List[OrderingItem] = Depends(get_ordering), ): return repository.get_all( skip=skip, limit=limit, pattern=pattern, collection_id=collection_id, use_doc=use_doc, ordering=ordering, )
def search_keywords( *, repository: KeywordRepository = Depends(get_keyword_repository), params: SearchParams = Depends(), skip: int = 0, limit: int = 100, ordering: List[OrderingItem] = Depends(get_ordering), ): return repository.get_all( pattern=params.pattern, collection_name=params.collection_name, use_doc=params.use_doc, use_tags=params.use_tags, skip=skip, limit=limit, ordering=ordering, )
async def search( request: Request, params: SearchParams = Depends(), repository: KeywordRepository = Depends(get_keyword_repository)): """ Search endpoint accepts query parameter 'pattern' which can optionally indicate that pattern should be searched for only in keyword names with 'name:query'. It can also optionally indicate query used for filtering collections of found keywords. Example pattern values: search?pattern=keyword search?pattern=name: keyword search?pattern=keyword in: some collection """ keywords = repository.get_all(pattern=params.pattern, collection_name=params.collection_name, use_doc=params.use_doc) context = { "request": request, "keywords": keywords, "pattern": params.raw_pattern, "version": version } return templates.TemplateResponse("search.html", context)