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
宿泊予約サイトにおける検索と料金計算の両立
Search
Shoichi Kaji
September 18, 2024
Programming
2
3.6k
宿泊予約サイトにおける検索と料金計算の両立
一休×AEON 事業会社のサービスを支える基盤開発トーク 2024/09/18
https://ikyu.connpass.com/event/327095/
Shoichi Kaji
September 18, 2024
Tweet
Share
More Decks by Shoichi Kaji
See All by Shoichi Kaji
昔のGo, 今のGo ~比較, ソート編~
skaji
0
180
Perl Quiz
skaji
0
130
cpm at PerlCon 2019
skaji
0
110
Perl5 Package Manager
skaji
0
660
Internal of cpm
skaji
0
580
How to execute external programs in Perl
skaji
3
580
Writing Perl with w0rp/ale
skaji
0
2.2k
nginx unit
skaji
0
44
Perl6 ecosystem
skaji
1
1.4k
Other Decks in Programming
See All in Programming
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
2
460
MCP with Cloudflare Workers
yusukebe
2
220
return文におけるstd::moveについて
onihusube
1
1k
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
4
1.1k
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
340
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
930
Zoneless Testing
rainerhahnekamp
0
120
testcontainers のススメ
sgash708
1
120
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
180
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
2
170
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
Featured
See All Featured
Being A Developer After 40
akosma
87
590k
Code Reviewing Like a Champion
maltzj
520
39k
GitHub's CSS Performance
jonrohan
1030
460k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Fireside Chat
paigeccino
34
3.1k
Documentation Writing (for coders)
carmenintech
66
4.5k
Mobile First: as difficult as doing things right
swwweet
222
9k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Adopting Sorbet at Scale
ufuk
73
9.1k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
The Language of Interfaces
destraynor
154
24k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Transcript
॓ധ༧αΠτʹ͓͚Δ ݕࡧͱྉۚܭࢉͷཱ྆ Shoichi Kaji
॓ധ༧αΠτ Ұٳ.com
͢͜ͱ • ॓ധ༧αΠτҰٳ.comͰͨ͘͞ΜͷॴͰ "ྉۚ"Λܭࢉ͠ද͍ࣔͯ͠Δ • ݕࡧͱྉۚܭࢉີʹؔ࿈͍ͯ͠Δ • Solr + Solr
pluginͰݕࡧͱྉۚܭࢉΛཱ྆ͤ͞ ͍ͯΔ
Ұٳ.comʹ͓͚Δྉۚͷදࣔ ͨ͘͞ΜͷॴͰ"ྉۚ"Λ ද͍ࣔͯ͠Δ "ྉۚ"Ϣʔβ͕ϗςϧΛ બͿ্Ͱॏཁͳࢦඪͷͻͱͭ
"ྉۚ"ʹٻΊΒΕΔͷ • ֤छ݅ɺ֤छׂҾΛՃຯ্ͨ͠Ͱͷྉۚ -> ࣄલʹͯ͢ͷ߹ΛٻΊ͓ͯ͘ͷࠔɺ ΦϯϥΠϯͰܭࢉ͢Δඞཁ͕͋Δ • ࢠڙྉۚ • ׂҾͷ݅:
ରձһϥϯΫɺ༗ޮظݶɺର॓ധɺഉଞ੍ޚ • ຊདྷྉۚ༧ʹରܾͯ͠·Δͷ • τοϓϖʔδʹ֤ϗςϧʹྉ͕ۚදࣔ͞Ε͍ͯΔɻ͜Ε͜ͷϗςϧ͕औΓ͏Δྉۚ ͷதͰͷ࠷খΛද͍ࣔͯ͠Δ (collapse)ɻΑͬͯཪͰԿेഒͷྔͷྉۚܭࢉΛ͠ ͳ͍ͱ͍͚ͳ͍ • ݕࡧϖʔδʹදࣔ͞Ε͍ͯΔྉۚɺ֤छ fi lterΛөͨ͠ͷ • ͨͱ͑ʮே৯͖ʯͱ͍͏ fi lter͕՝͞ΕΕɺே৯͖ϓϥϯͷྉۚͷ࠷҆
ݕࡧͱྉۚܭࢉີʹؔ࿈ • લड़ͷ௨ΓɺྉۚܭࢉͷதͰcollapse, fi lterͳͲ "ݕࡧ"จ຺Ͱग़ͯ͘Δͷͱಉ͡ॲཧΛඞཁͱ͢Δ • ܭࢉ͞ΕͨྉۚΛʮ2ສԁҎԼͷϗςϧʹߜΔʯ ʮྉۚͷ͍҆ॱʹฒΔʯͳͲݕࡧͷ fi
lter, sort ʹ͏͜ͱ͋Δ • ݕࡧͱྉۚܭࢉಉ࣌ʹѻ͑ͳ͍ͱ͍͚ͳ͍
ີʹؔ࿈͠߹ͬͨݕࡧɺ ྉۚܭࢉΛͲ͏࣮ݱ͢Δ͔ʁ
ݕࡧ • ·ͣݕࡧ • ҰൠʹݕࡧΤϯδϯͱͯ͠Elasticsearch, Apache SolrͳͲ͕ީิͱ͕ͯ͋͠Δ • Ұٳ.comͰApache SolrΛ࠾༻͍ͯ͠Δ
ݕࡧ Solr • Apache Solr • "ݕࡧ"ͱݴͬͯࢥ͍ු͔Ϳػೳ͍͍ͩͨἧ͓ͬͯΓɺ ͱͯΑ͍ιϑτΣΞͩͱࢥ͏ https://solr.apache.org/
ྉۚܭࢉ • ࣍ʹྉۚܭࢉɻલड़ͷ௨Γɺྉۚܭࢉݕࡧͱಉ࣌ʹͰ͖Δ ͷ͕·͍͠ɻSolrͰྉۚܭࢉͰ͖Δʁ • SolrͰquery্ͰࣜΛఆٛ͠ɺͦͷ݁ՌΛฦ͢͜ͱͰ͖Δ • ྉۚܭࢉSolr query্ͰࣜΛఆٛ͢Ε͍͍ͷͰʁ //
query.json { "query": "*:*", "fields": [ "product(sum(Price1_i,Price2_i),div(sub(100,Rate_f),100))" ] } // response { "response":{"docs":[{ "product(sum(Price1_i,Price2_i)...)":50487.36 }]} }
ྉۚܭࢉ • ྉۚܭࢉSolr query্ͰࣜΛఆٛ͢Ε͍͍ͷͰʁ • ͑: ݫ͍͠ 🥲 • ෳࡶͳܭࢉΛSolr
query্Ͱදݱ͢Δͷ͔ͳΓݫ͠ ͍ɻͱ͘ʹҰ࣌มΛѻ͍ʹ͍͘ • ܭࢉ͕ෳࡶͩͱͦͷSolr queryͷαΠζ૿͑Δɻ ͦͯ͠parseͷίετ͔ͳΓ͔͔Δ
ྉۚܭࢉ Solr plugin • ͰͲ͏͢Δ͔ʁ • Solrʹpluginػߏ͕͋Δ • JavaͰϓϩάϥϜΛॻ͖ɺSolrͷ֤छॲཧΛ ΧελϚΠζͰ͖Δ
• ಛʹSolr query্Ͱ͑ΔಠࣗؔΛఆٛͰ͖Δ
ྉۚܭࢉ Solr plugin • Solr query্ͰྉۚΛܭࢉͯ͠ฦ͢ my_priceؔΛಋೖ͠ɺͦͷ࣮Λ MyPriceParser.javaͱͯ͠ॻ͚Α͍ // my_priceͷ࣮:
MyPriceParser.java public class MyPriceParser extends ValueSourceParser { @Override public ValueSource parse(FunctionQParser fp) throws SyntaxError { ... } } // query.json { "query": "*:*", "fields": [ "my_price(20240901,2,3)" ] }
ྉۚܭࢉ Solr plugin • Solr pluginʹΑΔಠ࣮ࣗؔଟ͘ͷར͕͋Δ • JavaͰهड़Ͱ͖ΔͷͰɺมɺΫϥεͳͲͳΜͰ͑Δ • indexσʔλͷಡΈऔΓJavaͰهड़Ͱ͖ΔͷͰɺಠࣗʹγϦΞϥΠζͨ͠
σʔλͳͲΛindex͠͏͜ͱͰ͖Δ • σʔλιʔεͱͯ͠indexσʔλҎ֎ͷͷ͑Δ • ͦͯͪ͠ΖΜmy_priceΛ fi lter,sortͯ͑͠Δʂ • { "query": "*:*", "filter": ["{!frange u=20000}my_price(20240901,2,3)"], // 2ສԁҎԼ "sort": "my_price(20240901,2,3) asc", // ྉۚͷ͍҆ॱ "fields": ["my_price(20240901,2,3)"] }
Solr + Solr pluginΛͬͯ ݕࡧɺྉۚܭࢉΛཱ྆Ͱ͖ͨ 😉
·ͱΊ • ॓ധ༧αΠτҰٳ.comͰͨ͘͞ΜͷॴͰ "ྉۚ"Λܭࢉ͠ද͍ࣔͯ͠Δ • ݕࡧͱྉۚܭࢉີʹؔ࿈͍ͯ͠Δ • Solr + Solr
pluginͰݕࡧͱྉۚܭࢉΛཱ྆ͤ͞ ͍ͯΔ