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
Recoilを剥がしている話
kirik
5
6.7k
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
260
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
190
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
テストコード書いてみませんか?
onopon
2
110
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
100
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
nekko cloudにおけるProxmox VE利用事例
irumaru
3
430
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
330
return文におけるstd::moveについて
onihusube
1
1.1k
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
40
2.4k
How GitHub (no longer) Works
holman
311
140k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Become a Pro
speakerdeck
PRO
26
5k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
What's in a price? How to price your products and services
michaelherold
243
12k
Automating Front-end Workflow
addyosmani
1366
200k
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ͰݕࡧͱྉۚܭࢉΛཱ྆ͤ͞ ͍ͯΔ