Parents processor for search_api

Created on 3 April 2024, about 1 year ago
Updated 12 April 2024, 12 months ago

Problem/Motivation

I want to filter items in search_api based where I pass a node ID and get the children.

Steps to reproduce

NA

Proposed resolution

Add a search api Processor plugin

Remaining tasks

TBA

User interface changes

When you go to the Search API there is a new "Parents" processor and you confirm the EH field through which the parents will be derived.

API changes

NA

Data model changes

NA

✨ Feature request
Status

Needs work

Version

3.0

Component

Code (module)

Created by

πŸ‡¦πŸ‡ΊAustralia sime Melbourne

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @sime
  • Status changed to Needs work about 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia sime Melbourne

    I'm working on the initial MR.

  • Merge request !37Add processor for EH Parents β†’ (Open) created by sime
  • Pipeline finished with Success
    about 1 year ago
    Total: 364s
    #136824
  • πŸ‡¦πŸ‡ΊAustralia sime Melbourne

    I've added the initial processor. Need to add tests. To use

    1. Create your content type, with EH field, and a couple of nodes etc.
    2. In your index, go to Processors tab, enabled "Parents" processor
    3. In the configuration of the processor, confirm your EH field name, (defaults to `parents` but you might have `field_parents` for example)
    4. In your Fields, in the General area, add Parents property. Give it a weird label because it's easier to find in Views etc.
    5. Index
    6. Make a view, add field, filter Search category, find your weirdly named field from above.
    7. You should see `nid, nid, nid` all parents including self, and empty if it has no children/parents. If the top level node is 9, you should see 9
    8. Add filter, set to a nid, should filter accordingly
  • πŸ‡¦πŸ‡ΊAustralia sime Melbourne

    Since you have to add the property in the Fields screen, could getPropertyDefinitions() find all the EH fields (usually there is only one) and offer them all as properties and thus be zero configuration?

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    or could use a plugin deriver

  • πŸ‡¦πŸ‡ΊAustralia sime Melbourne

    Dealer's choice, I can do that - i assume there's rarely more than one field (but assumptions assumptions...).

  • πŸ‡¦πŸ‡ΊAustralia sime Melbourne

    I believe it should also be abstracted to cover any entity type, which also makes the deriver more practical?

  • Issue was unassigned.
  • πŸ‡¦πŸ‡ΊAustralia sime Melbourne

    I'm not sure if/when i can continue this as the project I was about to use it on has been deferred. Just un-assigning for now.

Production build 0.71.5 2024