Skip to content

feat: add wp-scaffold:elasticsearch#17

Merged
YvetteNikolov merged 1 commit into
mainfrom
feat/elasticsearch
Jan 14, 2026
Merged

feat: add wp-scaffold:elasticsearch#17
YvetteNikolov merged 1 commit into
mainfrom
feat/elasticsearch

Conversation

@YvetteNikolov
Copy link
Copy Markdown
Contributor

@YvetteNikolov YvetteNikolov commented Jan 13, 2026

Makkelijk gemaakt om Elasticsearch + Reactive Search te scaffolden 🎉

Na de scaffold moet je de docs/elasticsearch.md nog volgen om het volledig werkend te maken. Je krijgt na de scaffold een mooi linkje naar de docs:

Screenshot 2026-01-13 at 17 13 58

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 13, 2026

Coverage report for commit: e1a3699
File: coverage.xml

Cover ┌─────────────────────────┐ Freq.
   0% │ ███████████████████████ │ 75.0%
  10% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  20% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  30% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  40% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  50% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  60% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  70% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  80% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  90% │ ████░░░░░░░░░░░░░░░░░░░ │ 12.5%
 100% │ ████░░░░░░░░░░░░░░░░░░░ │ 12.5%
      └─────────────────────────┘
 *Legend:* █ = Current Distribution 
Summary - Lines: 79.71% | Methods: 22.22%
FilesLinesMethodsBranches
src/Console
   ChildThemeScaffoldCommand.php87.50%-100.00%
   ElasticsearchScaffoldCommand.php--100.00%
   EventScaffoldCommand.php--100.00%
   KnowledgebaseScaffoldCommand.php--100.00%
   NewsScaffoldCommand.php--100.00%
   PersonScaffoldCommand.php--100.00%
   ProjectScaffoldCommand.php--100.00%
src
   ScaffoldServiceProvider.php100.00%100.00%100.00%

🤖 comment via lucassabreu/comment-coverage-clover

@YvetteNikolov YvetteNikolov force-pushed the feat/elasticsearch branch 2 times, most recently from 0d38271 to 3d641e4 Compare January 13, 2026 16:09
'web/app/themes/' . get_stylesheet() . '/resources/scripts/reactive-search/reactive-search.jsx',
])->toHtml();
} catch (\Exception $e) {
// Fail silently if entrypoint is not found.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Misschien hier nog een visuele error tonen? Want vind @yardinternet/wordpress-backend ?

'--provider' => 'Yard\\Brave\\Scaffold\\ScaffoldServiceProvider',
'--tag' => 'elasticsearch',
]);
$this->info('Please follow the instructions in the documentation to complete the Elasticsearch setup:');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You need to do some additional steps after running this scaffold. Please read the docs here:

(meer forceful :P )

ik lul een beetje maar doe wat je wilt, beetje verschil tussen "Please" en "You need to"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Veel beter, veranderd

Comment thread stubs/app/Hooks/Elasticsearch.php Outdated
#[Action('template_redirect')]
public function redirectDefaultSearch(): void
{
if (! is_search() || is_admin() || ! empty($_GET['q'])) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if (! is_search() || is_admin() || (isset($_GET['q']) && '' !== trim($_GET['q']))){

Maar onderstaande is leesbaarder:

$hasQueryParam = isset($_GET['q']) && '' !== trim($_GET['q']);
if (! is_search() || is_admin() || $hasQueryParam ){

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ik kwam er n.a.v. Lara achter dat een aantal van deze functies al in Brave Hooks staat: https://github.com/yardinternet/brave-hooks/blob/main/src/Elasticsearch.php

Heb ze hier weggehaald en alleen het enqueue'en van Reactive Search toegevoegd + reactive-search-page.blade.php template include hier gelaten.

Comment thread stubs/app/Hooks/Elasticsearch.php Outdated
return;
}

$searchQuery = sanitize_text_field(get_query_var('s'));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wil je niet early returnen als get_query_var('s') een lege string is?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Zie opmerking #17 (comment) :)

use Yard\Hook\Filter;

#[Plugin('yard-elasticsearch/yard-elasticsearch.php')]
class Elasticsearch
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Volgens mij staan heel veel van deze hooks in brave hooks, bij Involv ziet het bestand er zo uit: https://github.com/yardinternet/involv/blob/main/web/app/themes/sage/app/Hooks/Elasticsearch.php

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Dit stond TOTAAL niet op mijn radar. Heb de functies verwijderd!

Comment on lines +7 to +8
primaryColor: '#3a0056',
borderColor: '#3a0056',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Moeten we hier eigenlijk niet een soort TODO bijschrijven, ik merk namelijk dat deze vaak vergeten wordt om aan te passen. Als iemand dan een keer op TODO in het hele project zoekt, dan komt ie het in ieder geval tegen. Niet ideaal maar ik zou ook niks anders weten.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ja goeie. @todo wordt doorgaans gebruikt in docblocks (JS en PHP in ieder geval, zie bijv. https://jsdoc.app/tags-todo). We kunnen dit als conventie gebruiken!

<ReactiveSearchBar
boosts={ window.YS.boosts }
dataFields={ window.YS.dataFields }
fuzziness={ window.YS.fuzziness }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Volgens mij geeft dit nog soms warnings dat het geen int is. Ik heb dit in Involv staan (wat ik ook weer ergens vandaan heb gehaald):

fuzziness={
	window.YS.fuzziness === 'AUTO'
		? window.YS.fuzziness
		: parseInt( window.YS.fuzziness )
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Goeie, toegevoegd

@apply shadow-none;

.yrs-datasearch-autosuggest-input {
@apply ring-primary focus:border-primary h-(--yrs-search-input-height) rounded-none !py-3 !pr-16 !pl-4 shadow-none;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We moeten als frontenders ook gaan bedenken wat we met de ! gaan doen, gaan we het ervoor of erna zetten als nieuwe syntax. Als we de linting blij moeten maken, dan moeten we het erna gaan zetten. Als we het erna gaan doen, dan is het handig als we het gelijk hier ook goed zetten.

Copy link
Copy Markdown
Contributor Author

@YvetteNikolov YvetteNikolov Jan 14, 2026

Choose a reason for hiding this comment

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

Ik heb het er met een paar mensen over gehad, ! erna heeft wel de voorkeur. Linter happy, én het is volgens de conventie dat !important achter de property value komt. Heb het ook aangepast hier. Wat vind jij?

@WybeBosch heeft een slimme regex gemaakt om dit in een project in één keer door te voeren. Dit moet hij nog in Brave doen!

<ReactiveSearchInput
boosts={ window.YS.boosts }
dataFields={ window.YS.dataFields }
fuzziness={ window.YS.fuzziness }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hier ook dezelfde opmerking

boosts={ window.YS.boosts }
dataField={ window.YS.dataFields }
filters={ window.YS.filters }
fuzziness={ window.YS.fuzziness }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hier ook :)

@YvetteNikolov YvetteNikolov force-pushed the feat/elasticsearch branch 4 times, most recently from f659039 to 4ddc2dd Compare January 14, 2026 08:39
@YvetteNikolov YvetteNikolov merged commit 41ff7bd into main Jan 14, 2026
5 checks passed
@YvetteNikolov YvetteNikolov deleted the feat/elasticsearch branch January 14, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants