OArepo module that adds support for communities
Project description
OARepo-Search
OArepo module that added auxiliary search features.
Installation
OARepo-Search is on PyPI so all you need is:
$ pip install oarepo-search
Configuration
Supported languages
If you use multilingual fields (oarepo-multilingual) and want use simple query for searching in the fields, you have to specify supported languages.
OAREPO_SEARCH_SUPPORTED_LANGUAGES = ["cs", "en"]
Search fields
Field settings for simple search (https://host.com/path/?q=). Configuration is a dictionary, where key is the name of the endpoint and value is a list of supported fields. If you want to use a multilingual field, you can use an asterisk instead of the language, which is automatically replaced by OAREPO_SEARCH_SUPPORTED_FIELDS.
:warning: Simple query does not support nested fields: If you want search in nested fields you must use Lucene query with field specification (e.g.: "creator.role.title.cs:Karel Čapek")
OAREPO_SEARCH_FIELDS = {
"entrypoint_name": ["title.*", "creator"]
}
Usage
Query parser
The library provides an extension to the default parser provided by Invenio. The use of the query parser is described in the module [invenio-records-rest](https://invenio-records-rest.readthedocs.io/en/latest/usage. html#query-parser).
The library can use a simple query as in invenio when you enter a search query in the form: q = , but this simple expression cannot search in nested fields. Therefore, the library supports queries in Lucene syntax with support for nested field search (eg "title: robot AND creator.name:Capek")
Provide query parser from this library into your search_factory.
from invenio_records_rest.query import default_search_factory
from oarepo_search.query_parsers import query_parser
def my_search_factory(*args, **kwargs):
return default_search_factory(*args,
query_parser=query_parser, **kwargs)
RECORDS_REST_ENDPOINTS = {
'recid': {
# ...
'search_factory_imp': my_search_factory,
}
}
Copyright (C) 2021 CESNET.
OARepo-Search is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
Added
- Better explanation of the difference between the file ("CHANGELOG") and its function "the change log".
Changed
- Refer to a "change log" instead of a "CHANGELOG" throughout the site to differentiate between the file and the purpose of the file — the logging of changes.
Removed
- Remove empty sections from CHANGELOG, they occupy too much space and create too much noise in the file. People will have to assume that the missing sections were intentionally left out because they contained no notable changes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for oarepo_search-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 440a0af344b44bdbb5a1e783762a33f253a5623599d48c9afcd5aac8f01f2c7f |
|
MD5 | 063baa95ebea54e2db3ec7592a1fde63 |
|
BLAKE2b-256 | 74037ef5bc948598ad550c7d20938d9484c3990106de713c6b324dce7f51a3e5 |