Skip to main content

image image image image

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.

Metadata

Release files for oarepo-search 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oarepo-search 1.0.1
File Size Uploaded
oarepo-search-1.0.1.tar.gz 10.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oarepo-search 1.0.1
File Interpreter ABI Platform
oarepo_search-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.8 kB

Release files / oarepo-search-1.0.1.tar.gz

Download URL oarepo-search-1.0.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
17355627e2ef3cf34c3d15a7126fba7bf78a9894d7cb9267316128dd97633435
BLAKE2b-256 checksum
How to use checksums
839ca81e9c5092f418caf183f1e51ab32548ff64ded5236d23455a775aa34257
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / oarepo_search-1.0.1-py3-none-any.whl

Download URL oarepo_search-1.0.1-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
440a0af344b44bdbb5a1e783762a33f253a5623599d48c9afcd5aac8f01f2c7f
BLAKE2b-256 checksum
How to use checksums
74037ef5bc948598ad550c7d20938d9484c3990106de713c6b324dce7f51a3e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page