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.7k
宿泊予約サイトにおける検索と料金計算の両立
一休×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
200
Perl Quiz
skaji
0
130
cpm at PerlCon 2019
skaji
0
110
Perl5 Package Manager
skaji
0
670
Internal of cpm
skaji
0
580
How to execute external programs in Perl
skaji
3
590
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
PHPカンファレンス 2024|共創を加速するための若手の技術挑戦
weddingpark
0
140
AHC041解説
terryu16
0
370
QA環境で誰でも自由自在に現在時刻を操って検証できるようにした話
kalibora
1
140
php-conference-japan-2024
tasuku43
0
430
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
300
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
8
1.9k
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
1.4k
PicoRubyと暮らす、シェアハウスハック
ryosk7
0
210
Внедряем бюджетирование, или Как сделать хорошо?
lamodatech
0
940
Androidアプリの One Experience リリース
nein37
0
1.2k
ゼロからの、レトロゲームエンジンの作り方
tokujiros
3
1k
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
1k
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.6k
Done Done
chrislema
182
16k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Code Review Best Practice
trishagee
65
17k
Documentation Writing (for coders)
carmenintech
67
4.5k
Designing for humans not robots
tammielis
250
25k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
Navigating Team Friction
lara
183
15k
GraphQLとの向き合い方2022年版
quramy
44
13k
Building an army of robots
kneath
302
45k
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ͰݕࡧͱྉۚܭࢉΛཱ྆ͤ͞ ͍ͯΔ