Search Reference¶
bear.search
¶
SearchEngine
¶
Search engine for vector-based similarity search across resources.
Source code in bear/search.py
search_resource(resource_name, query, top_k=3, min_distance=None, since_year=None, author_ids=None, output_fields=None)
¶
Search and filter for resource using a query.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource_name | str | Name of the resource collection to search | required |
query | str | Search query string | required |
top_k | int | Maximum number of results to return | 3 |
min_distance | float | None | Minimum distance threshold for results | None |
since_year | int | None | Filter results from this year onwards | None |
author_ids | list[str] | None | Filter results by specific author IDs | None |
output_fields | list[str] | None | Fields to include in output. If None, all fields except embedding | None |
Returns:
Type | Description |
---|---|
list[dict[str, Any]] | List of search results sorted by distance (descending) |
Raises:
Type | Description |
---|---|
ValueError | If resource class is not found in model |
Source code in bear/search.py
search_author(query, top_k=3, aggregate_function=sum, institutions=None, **kwargs)
¶
Search for authors based on a query string.
Source code in bear/search.py
rerank_by_author(results, aggregate_function=sum)
¶
Rerank the search results by author ID.
Source code in bear/search.py
load_institution_author_ids(institution)
cached
¶
Load author IDs associated with a specific institution.
Source code in bear/search.py
filter_institution_authors(institutions, results)
¶
Filter authors by institution.
Source code in bear/search.py
Search Engine¶
The search module provides vector search capabilities for academic resources.
Features¶
- Vector similarity search
- Metadata filtering
- Result ranking
- Multi-modal search (authors and works)
Search Types¶
Resource Search¶
Search for academic works, papers, and publications.
Author Search¶
Search for authors based on research interests and expertise.
Filtering Options¶
- Publication year filtering
- Institution filtering
- Citation count filtering
- Distance threshold filtering
Performance¶
The search engine is optimized for:
- Sub-second query response times
- Accurate semantic matching
- Scalable to millions of documents