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
2.5k
宿泊予約サイトにおける検索と料金計算の両立
一休×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
170
Perl Quiz
skaji
0
130
cpm at PerlCon 2019
skaji
0
110
Perl5 Package Manager
skaji
0
660
Internal of cpm
skaji
0
570
How to execute external programs in Perl
skaji
3
570
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
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
290
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
CSC509 Lecture 11
javiergs
PRO
0
180
最新TCAキャッチアップ
0si43
0
140
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
みんなでプロポーザルを書いてみた
yuriko1211
0
260
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
190
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
as(型アサーション)を書く前にできること
marokanatani
10
2.7k
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
Contemporary Test Cases
maaretp
0
140
役立つログに取り組もう
irof
28
9.6k
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
What's new in Ruby 2.0
geeforr
343
31k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
A better future with KSS
kneath
238
17k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
GraphQLとの向き合い方2022年版
quramy
43
13k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Building Applications with DynamoDB
mza
90
6.1k
We Have a Design System, Now What?
morganepeng
50
7.2k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
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ͰݕࡧͱྉۚܭࢉΛཱ྆ͤ͞ ͍ͯΔ