Skip to main content

OArepo module that adds support for communities

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oarepo-search-1.0.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oarepo_search-1.0.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file oarepo-search-1.0.1.tar.gz.

File metadata

  • Download URL: oarepo-search-1.0.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for oarepo-search-1.0.1.tar.gz
Algorithm Hash digest
SHA256 17355627e2ef3cf34c3d15a7126fba7bf78a9894d7cb9267316128dd97633435
MD5 a9dd53f78a126af9b9ed04de963715b9
BLAKE2b-256 839ca81e9c5092f418caf183f1e51ab32548ff64ded5236d23455a775aa34257

See more details on using hashes here.

File details

Details for the file oarepo_search-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: oarepo_search-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for oarepo_search-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 440a0af344b44bdbb5a1e783762a33f253a5623599d48c9afcd5aac8f01f2c7f
MD5 063baa95ebea54e2db3ec7592a1fde63
BLAKE2b-256 74037ef5bc948598ad550c7d20938d9484c3990106de713c6b324dce7f51a3e5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page