scitex_scholar.filters
Pure-function paper filtering for scitex_scholar.
Works on plain dicts only — no Django ORM or model imports required.
- Expected paper dict keys:
title : str authors : list[str] journal : str year : int or str citations : int or str impact_factor : float or str or None is_open_access: bool source : str snippet : str (optional, used for doc_type detection)
- scitex_scholar.filters.apply_filters(papers, filters=None, parsed_operators=None)[source]
Filter a list of paper dicts by various criteria.
- Parameters:
papers (
List[Dict[str,Any]]) – List of paper dicts. Each dict should contain the keys described in the module docstring; missing keys are treated as empty / zero values.filters (
Optional[Dict[str,Any]]) –Dict of filter criteria extracted from a search form or URL parameters. Supported keys:
year_from,year_to– year range (int)min_citations,max_citations– citation range (int)min_impact_factor– minimum IF (float)max_impact_factor– maximum IF (float)authors– list of author name strings (legacy)journal– journal name substring (legacy, str)open_access– booldoc_type–"review"|"preprint"| otherlanguage– language string ("english"passes)
parsed_operators (
Optional[Dict[str,Any]]) –Dict produced by
SearchQueryParser.from_shell_syntax()or the equivalentparse_query_operators()function from scitex-cloud. Supported keys:title_includes,title_excludes– list[str]author_includes,author_excludes– list[str]journal_includes,journal_excludes– list[str]year_min,year_max– intcitations_min,citations_max– intimpact_factor_min,impact_factor_max– float
- Returns:
Filtered list of paper dicts (same objects, not copies).
- Return type: