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

You cannot safely search for a Collection #1524

Closed
webpatser opened this issue Jan 31, 2024 · 3 comments
Closed

You cannot safely search for a Collection #1524

webpatser opened this issue Jan 31, 2024 · 3 comments
Labels
1.x feature Adds new functionality to GetCandy

Comments

@webpatser
Copy link
Contributor

  • Lunar version: 1.0-dev
  • Laravel Version: 10.0.43
  • PHP Version: 8.3.2
  • Database Driver & Version: MariaDB

Expected Behaviour:

When I am building up a Collection Structure via an import script. I want to search on exact names and filter on parent_id to get the exact first hit so I can build up the collection tree.

Actual Behaviour:

Since the names are hidden in the attributes field and no handle or some identifiable name is stored directly in the table, you can only search for the name via Scout. But in the database index you cannot filter on parent_id. Also it not always gives the correct result; if you Collection name has spaces in it, the search results are based on a word level. You cannot set it to match the whole string.

I also now have to cache the Parent CollectionIDs in the import script. I rather lookup it fresh so I know I have the correct one, but that's not possible.

Steps To Reproduce:

https://docs-v1.lunarphp.io/core/reference/collections.html#collections-1

I would love to see a name and handle in the Collection table. Just like in all other models. And use attributes for translations and other metadata.

@webpatser webpatser added bug Something isn't working unconfirmed labels Jan 31, 2024
@alecritson
Copy link
Collaborator

Could you not use a where clause on the json column? https://laravel.com/docs/10.x/queries#json-where-clauses

Or if you have the parent_id you could just get the collection by it's ID, unless I'm missing something there.

@glennjacobs glennjacobs added enhancement Improvement to existing functionality and removed bug Something isn't working labels Jan 31, 2024
@glennjacobs
Copy link
Contributor

We have discussed this previously, so this is a good reminder. We wanted to pull out the name attributes (and maybe handle, if required) into dedicated fields.

@glennjacobs glennjacobs removed enhancement Improvement to existing functionality unconfirmed labels May 20, 2024
@glennjacobs glennjacobs added feature Adds new functionality to GetCandy 1.x labels May 20, 2024 — with Linear
@glennjacobs
Copy link
Contributor

Closing as we already have this planned for the 1.0.0 beta release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x feature Adds new functionality to GetCandy
Projects
None yet
Development

No branches or pull requests

3 participants