Allow to search over custom field attributes

Open
#3,835 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
15/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
postgresql, ruby
Domain
databases, search

Research direction

Read the issue's pg_search reference and the multisearchable example to understand the reported JSONB limitation and static attribute list. The issue proposes research and changes in the pg_search gem but names no repository files or tests; start by investigating how that gem builds search queries for dynamic custom fields. Done means custom field attributes can be searched, though the issue does not define expected behavior or tests.

Written by the indexing model from the issue text.

Description

Search over a custom field model attributes has not a direct solution, the main problems I see are:

  • jsonb format is not officially supported by pg_search see this
  • custom fields are dynamic, while the list of attributes searchable is statically provided to the model, i.e:
    multisearchable(
      against: [:name, :charge_es, :charge_en, :charge_ca, :bio_es, :bio_en, :bio_ca],
      ...

Nevertheless I think it could be done with a bit of research and hacking on the pg_search gem (although it requires to deeply understand the queries behind the search).

Dominant language
Ruby
Stars
79
Forks
31
Avg merge
2d 1h
Merged PRs (30d)
23

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PopulateTools/gobierto

All issues in PopulateTools/gobierto

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.