Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Doctrine Lexer Use Case
Search
Olivier Dolbeau
June 24, 2014
Programming
2
1.1k
Doctrine Lexer Use Case
PHPTour Lyon 2014 - 24/06/2014
Olivier Dolbeau
June 24, 2014
Tweet
Share
More Decks by Olivier Dolbeau
See All by Olivier Dolbeau
Jane & Webby
odolbeau
0
290
Translating a monolingual application
odolbeau
2
390
DX: Developer eXperience
odolbeau
0
50
DX: Developer eXperience
odolbeau
0
390
EasyAdminBundle introduction
odolbeau
0
130
REX API Platform
odolbeau
0
1k
Features flags at BlaBlaCar
odolbeau
4
820
25+ million members in 22 countries, how to scale with Symfony2
odolbeau
1
380
Be gentle with your prod!
odolbeau
1
590
Other Decks in Programming
See All in Programming
Netty Chicago Java User Group 2024-04-17
sullis
0
170
PHPはいつから死んでいるかの調査
chiroruxx
1
400
GitHub Copilotのススメ
marcy731
1
200
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
43
19k
Ruby Pattern Matching
bkuhlmann
0
920
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
310
[技育CAMPアカデミア]アイディアを形に!【超入門】スマホアプリ開発〜リリースまでの流れをご紹介
teamlab
PRO
0
360
"config" ってなんだ? / What is "config"?
okashoi
0
240
Anthropic Cookbook のおすすめレシピ
schroneko
7
910
Fragment Composition of GraphQL
quramy
4
780
GitHub Actionsで泣かないためにやっておきたい設定 / Recommended GHA settings to avoid crying
pinkumohikan
3
530
try!Swift Tokyo 2024 参加報告 LT
akidon0000
1
220
Featured
See All Featured
Building Applications with DynamoDB
mza
88
5.6k
Happy Clients
brianwarren
92
6.4k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Raft: Consensus for Rubyists
vanstee
132
6.3k
Imperfection Machines: The Place of Print at Facebook
scottboms
260
12k
From Idea to $5000 a Month in 5 Months
shpigford
377
45k
Bash Introduction
62gerente
604
210k
A designer walks into a library…
pauljervisheath
200
23k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
116
18k
How GitHub Uses GitHub to Build GitHub
holman
468
290k
Documentation Writing (for coders)
carmenintech
60
3.9k
Transcript
Doctrine Lexer use case
None
Olivier Dolbeau @odolbeau Web Architect About me
RIDESHARING Cost of motoring 100€ 25€ 25€ 25€ 25€ @BlaBlaCar_FR
ALONE
A fast growing community
A European phenomenon
None
I want to be able to search tweets using a
human language.
None
None
None
None
Where are my tweets ?
None
None
None
None
None
None
Other solutions Logstash Home made external river
distributed restful search and analytics elasticsearch
None
None
None
None
None
We know what we want. We know where our data
is.
Now let’s see HOW we are doing to retrieve it.
How... … to translate a human language into a technical
one.
“ A retweet FROM @CameronNash23 ”
None
What’s a Lexer ? In computer science, lexical analysis is
the process of converting a sequence of characters into a sequence of tokens, i. e. meaningful character strings.
Tokens ! Now !
None
None
None
None
“ A retweet FROM @CameronNash23 ” T_SELECTOR T_RETWEET T_FROM T_USERNAME
How... … to use these tokens to generate an ElasticSearch
query.
None
None
None
None
It works!
None
None
None
And what about Doctrine ORM ? Let’s take a look
at : Doctrine\ORM\Query\Lexer
From DQL to SQL SELECT t0.id AS id1, t0.name AS
name3, t0. username AS username4, t0.email AS email5 FROM mos_users t0 WHERE t0.username = “foobar” SELECT u FROM MyProject\Model\User u WHERE u.username = ‘foobar’
77 tokens !!
Some patterns...
And a switch (true) !
Forget the Parser !
None
None
None
Example A trip OR A search FROM "Paris, France" OR
TO "Paris, France" BETWEEN 12/01/2013 AND 26/05/2014 A trip OR A search FROM "Paris, France" OR TO "Paris, France" BETWEEN 12/01/2013 AND 26/05/2014
Lexer to GET tokens. Parser to USE tokens.
@odolbeau On recrute ! :) MERCI !
@odolbeau https://joind.in/ 11246 https://github.com/odolbeau/elasticsearch-sandbox https://speakerdeck.com/odolbeau/doctrine-lexer-use-case