Skip to content

Conversation

adriendupuis
Copy link
Contributor

@adriendupuis adriendupuis commented Nov 12, 2024

Question Answer
JIRA Ticket N/A
Versions 4.6, master
Edition All

⚠️ Wait for ibexa/core#486 being included in a release.

Checklist

  • Text renders correctly
  • Text has been checked with vale
  • Description metadata is up to date
  • Redirects cover removed/moved pages
  • Code samples are working
  • PHP code samples have been fixed with PHP CS fixer
  • Added link to this PR in relevant JIRA ticket or code PR

@adriendupuis adriendupuis marked this pull request as ready for review November 15, 2024 12:55
@adriendupuis adriendupuis requested a review from a team November 19, 2024 10:40
@adriendupuis adriendupuis changed the title Enhance search doc Enhance search doc: TrashService criteria, LocationList::getTotalCount() Nov 22, 2024
@adriendupuis adriendupuis changed the title Enhance search doc: TrashService criteria, LocationList::getTotalCount() Enhance search doc: TrashService references, LocationList::getTotalCount() Nov 22, 2024
Copy link

@barw4 barw4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trash also uses the ContentName search criterion.

php bin/console debug:container --tag=ibexa.search.legacy.trash.gateway.criterion.handler
@adriendupuis
Copy link
Contributor Author

Trash also uses the ContentName search criterion.

@barw4 Thank you for pointing me this one and showing me its handler tag.

Added in bc136a1

I missed it because it wasn't marked a trash criterion. I propose to mark it in ibexa/core#486

@adriendupuis adriendupuis requested a review from barw4 February 21, 2025 13:09
@adriendupuis adriendupuis added the Wait with merge PRs that shouldn't be merged instantly label Feb 21, 2025
Copy link
Contributor

@mnocon mnocon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for covering this!

I think the ContentName criterion is missing here: https://ez-systems-developer-documentation--2540.com.readthedocs.build/en/2540/search/search_in_trash_reference/ , could you please check?

Optional, something we can think about in the future:

I like the addition of the Trash column for criterions and sort clauses, it's much more readable this way - the question for me is if we still need to list them explicitly in the dedicated Trash reference (maybe just linking to the expanded tables would be enough and would make it easier to maintain)

@adriendupuis adriendupuis requested a review from mnocon February 25, 2025 10:29
@github-actions
Copy link

code_samples/ change report

Before (on target branch)After (in current PR)

code_samples/api/public_php_api/src/Command/FilterLocationCommand.php

docs/search/search_api.md@128:``` php hl_lines="17"
docs/search/search_api.md@129:// ...
docs/search/search_api.md@130:[[= include_file('code_samples/api/public_php_api/src/Command/FilterLocationCommand.php', 4, 9) =]]// ...
docs/search/search_api.md@131:[[= include_file('code_samples/api/public_php_api/src/Command/FilterLocationCommand.php', 32, 52) =]]
docs/search/search_api.md@132:```

001⫶// ...
002⫶use Ibexa\Contracts\Core\Repository\LocationService;
003⫶use Ibexa\Contracts\Core\Repository\Values\Content\Query;
004⫶use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
005⫶use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause;
006⫶use Ibexa\Contracts\Core\Repository\Values\Filter\Filter;
007⫶// ...
008⫶ protected function execute(InputInterface $input, OutputInterface $output): int
009⫶ {
010⫶ $parentLocationId = (int)$input->getArgument('parentLocationId');
011⫶
012⫶ $filter = new Filter();
013⫶ $filter
014⫶ ->withCriterion(new Criterion\ParentLocationId($parentLocationId))
015⫶ ->withSortClause(new SortClause\ContentName(Query::SORT_DESC));
016⫶
017❇️ $result = $this->locationService->find($filter, []);
018⫶

code_samples/api/public_php_api/src/Command/FilterLocationCommand.php

docs/search/search_api.md@128:``` php hl_lines="17"
docs/search/search_api.md@129:// ...
docs/search/search_api.md@130:[[= include_file('code_samples/api/public_php_api/src/Command/FilterLocationCommand.php', 4, 9) =]]// ...
docs/search/search_api.md@131:[[= include_file('code_samples/api/public_php_api/src/Command/FilterLocationCommand.php', 32, 52) =]]
docs/search/search_api.md@132:```

001⫶// ...
002⫶use Ibexa\Contracts\Core\Repository\LocationService;
003⫶use Ibexa\Contracts\Core\Repository\Values\Content\Query;
004⫶use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
005⫶use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause;
006⫶use Ibexa\Contracts\Core\Repository\Values\Filter\Filter;
007⫶// ...
008⫶ protected function execute(InputInterface $input, OutputInterface $output): int
009⫶ {
010⫶ $parentLocationId = (int)$input->getArgument('parentLocationId');
011⫶
012⫶ $filter = new Filter();
013⫶ $filter
014⫶ ->withCriterion(new Criterion\ParentLocationId($parentLocationId))
015⫶ ->withSortClause(new SortClause\ContentName(Query::SORT_DESC));
016⫶
017❇️ $result = $this->locationService->find($filter, []);
018⫶
019⫶        $output->writeln('Found ' . $result->totalCount . ' items');
019⫶        $output->writeln('Found ' . $result->getTotalCount() . ' items');
020⫶
021⫶ foreach ($result as $content) {
022⫶ $output->writeln($content->getContent()->getName());
023⫶ }
024⫶
025⫶ return self::SUCCESS;
026⫶ }
027⫶}

020⫶
021⫶ foreach ($result as $content) {
022⫶ $output->writeln($content->getContent()->getName());
023⫶ }
024⫶
025⫶ return self::SUCCESS;
026⫶ }
027⫶}

Download colorized diff

Copy link
Contributor

@mnocon mnocon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@adriendupuis adriendupuis removed the Wait with merge PRs that shouldn't be merged instantly label Mar 5, 2025
@adriendupuis adriendupuis merged commit 13646d5 into master Mar 5, 2025
5 of 7 checks passed
@adriendupuis adriendupuis deleted the enh-search-doc branch March 5, 2025 08:02
adriendupuis added a commit that referenced this pull request Mar 5, 2025
…lCount()` (#2540)

* Use LocationList::getTotalCount() instead of LocationList::$totalCount
* Search criteria and sort references: Add a "Trash" column

(cherry picked from commit 13646d5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants