Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Doctrine Lexer Use Case
Olivier Dolbeau
June 24, 2014
Programming
2
970
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
210
Translating a monolingual application
odolbeau
2
320
DX: Developer eXperience
odolbeau
0
43
DX: Developer eXperience
odolbeau
0
310
EasyAdminBundle introduction
odolbeau
0
89
REX API Platform
odolbeau
0
760
Features flags at BlaBlaCar
odolbeau
4
720
25+ million members in 22 countries, how to scale with Symfony2
odolbeau
1
310
Be gentle with your prod!
odolbeau
1
440
Other Decks in Programming
See All in Programming
段階的な技術的負債の解消方法.pdf
ko2ic
2
850
Untangling Coroutine Testing (Droidcon Berlin 2022)
zsmb
1
470
kintone × LINE Bot で餃子検定Botを作った話
naberina
0
300
実践 SpiceDB - クライドネイティブ時代をサバイブできるパーミッション管理の実装を目指して / Practical SpiceDB
lmt_swallow
0
100
「混ぜるな危険」を推進する設計
minodriven
8
2.5k
10歳の minne から、これから長く続くプロダクトを作るすべての人へ
tsumichan
9
3.6k
SRE NEXT 2022に学ぶこれからのSREキャリア
fukubaka0825
2
390
Recap CDN, Edge, WebAssembly | ワインと鍋.js#1
sadnessojisan
2
1.2k
Edge Side Frontend という新領域
mizchi
21
10k
Reactは何を提供するLibraryなのか?
taro28
6
910
Scaling Productivity- How we have improved our dev experience
sockeqwe
1
120
企業内スモールデータでのデータ解析
hamage9
0
850
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
506
37k
Music & Morning Musume
bryan
35
4.3k
Build your cross-platform service in a week with App Engine
jlugia
219
17k
Thoughts on Productivity
jonyablonski
44
2.4k
The Illustrated Children's Guide to Kubernetes
chrisshort
18
40k
Building Better People: How to give real-time feedback that sticks.
wjessup
344
17k
GitHub's CSS Performance
jonrohan
1020
420k
Fireside Chat
paigeccino
13
1.4k
Agile that works and the tools we love
rasmusluckow
319
19k
Embracing the Ebb and Flow
colly
73
3.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
119
28k
Happy Clients
brianwarren
89
5.6k
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