Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE-361: ADO to ADO entity reference derived/nested property views filter #362

Merged
merged 19 commits into from
Oct 22, 2023

Conversation

DiegoPino
Copy link
Member

@DiegoPino DiegoPino commented Sep 24, 2023

See #361

Not ready for review yet, lot's of code to be written. It is basically a skeleton yet but with the relevant code/methods. I tried to be faster, but this is hard. Sorry

Ok, ready for a spin.

  • This new Filter is named Similar ADO Filter and can be found for any Search API driven View in the "Search" section
    image

  • It provides a general setting + extended (optional) setting.

  • The extended/optional setting allows you to select a View from a list that can drive, when exposed, the selection of ADOs available. Also, a choice for passing any contextual values into this view too. Very useful to make that list act on existing filters (e.g when using this filter on a block that acts on the current ADO it is displayed).
    image

  • On the main settings, It can take a list of Nodes/ADOs if not exposed. If exposed it can expose a an autocomplete or a select.
    image

  • If autocomplete is selected and no View was setup on the extended (optional) settings, it will provide a generic (basically anything accessible to the user) ADO autocomplete.

  • If autocomplete is selected and a View was setup on the extended (optional) setting, it will provide an autocomplete driven by the view

  • If select was chosen, then a View is needed. If not it will just show " - ANY ". The view will be called, rendered and used as a selection

  • The main setting allows any field that is not full text used to compare against. The Passed (query input) Node will be resolved dynamically against the property paths, but will make it shallow. Means if the Searched against field is a nested property path consisting of one or more entity references, only the last/direct path to an entity will be resolved against the query input

  • The main setting also allows to set how the values are (operator) queries against each field and also between fields.

Use cases:

  • Limit Search inside a collection using multiple fields to check against.
  • Find all Objects that share Subject with the queried against.
  • Find similar Objects using OR, One Of operators.
  • Find all objects ingested by the same AMI set as the currently checked out
  • Exposed all this options as a simple select for end users. (obscuring the actual operation)
  • Find Values that are deep nested in Solr fields but do not exist directly attached to an ADO as a field. Because the Property paths are resolved dynamically mimic-ing how a field is generated by the Search API, the ADO used for searching does not need to have the Solr field.

Todo:

  • Add an option to exclude the searched (input) Node from the results. Might do that tonight as an option. Will merge tomorrow AM bc this was a journey.

I tried to be faster, but this is hard. Sorry
@DiegoPino DiegoPino self-assigned this Sep 24, 2023
@DiegoPino DiegoPino added this to the 1.2.0 milestone Sep 24, 2023
@DiegoPino DiegoPino added enhancement New feature or request Search and Discovery Mess around and find out Drupal Views Ask and you should receive Search API Sub Modules When you need more .info.yml files to keep life organized labels Sep 24, 2023
…load multiple

I end with duplicated ID and UUID in the value array. Diego ...
Now to what gathers us here today. On exposed fill up with Entities coming from the extra Options settings listing + actually make the Query(z) ...
Basically i got the property solving for ::calculateEntityRelationsForField wrong.
The right approach (which is not here yet is)..
Iterate from root to leaves all property paths. IF i find an entity relationship, reset the accumulated property paths from there (basically tread the foreign relationship as one that needs to be resolved afterwards locally (new root) agains the filter value. Keep doing that. Everytime that happens, we reset again. Don't accumulate $data... only keep one around and it needs to be filled up AT the end. Once we run out of paths.
- IN effect this will
  - Preserve directly resolvable paths (e.g field_descriptive_metadata:label or title directly -> good for comparing ADOS against each other
 - Provide a clean Property path in case of a complex one. e.g 0 = field_descriptive_metadata:sbf_entity_reference_ismemberof:field_descriptive_metadata:digital_object_type would be just field_descriptive_metadata:digital_object_type
(this is me explaining this to myself bc it is hard... gosh... why do i code this stuff?)
path_to_resolve from data is what we want. That is all i care for.
Next steps are:
- Validations
- Caching for calculated paths from a entity relationship one
- Actual query
- Exposed Form using a Views
As requested/asked for by @alliomeria
Still, i need to optimize the Original field v/s resulting properties path mix, so i don't over evaluate the same property path against the query ADO
In webform_strawberryfield. Don't forget @DiegoPino @alliomeria (remind me?). Maybe the solution there to avoid "select referencing" webform elements (the Collection autocomplete that shows itself in the list?) would be to pass as an extra option/argument to the Autocomplete itself via webform ? the current NODE id so we can exclude it?
But i get results, comparison is working, etc. Kinda neat
Bc probably nobody other than myself will test this. We need docs too!
your form and apis together drupal ... damn.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Drupal Views Ask and you should receive enhancement New feature or request Search and Discovery Mess around and find out Search API Sub Modules When you need more .info.yml files to keep life organized
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant