CloudSearch nanapi use case

62e3a4be6ab33ebbc44dfbc7147c2666?s=47 violetyk
October 17, 2014

CloudSearch nanapi use case

62e3a4be6ab33ebbc44dfbc7147c2666?s=128

violetyk

October 17, 2014
Tweet

Transcript

  1. CloudSearch nanapiͷࣄྫ঺հ גࣜձࣾnanapiɹՃլ୩ ༞ฏ

  2. ࣗݾ঺հ • Ճլ୩ ༞ฏɹ • גࣜձࣾnanapi • nanapi.jpνʔϜɹαʔόαΠυΤϯδχΞ • Vim͕޷͖

    violetyk @yuhei_kagaya
  3. αʔϏε঺հɹnanapi • ੜ׆ͷ஌ܙ͕ू·ΔαΠτ • http://nanapi.jp • ༷ʑͳϋ΢πʔΛఏڙ͢Δ αʔϏε • ݄ؒ2500ສUU

    • 10ສهࣄ
  4. αʔϏε঺հɹnanapiϫʔΫε • ʮnanapiʯϥΠλʔͷҝ ͷϥΠςΟϯάελδΦ • https://works.nanapi.jp

  5. αʔϏε঺հɹanswer • ଈϨείϛϡχέʔγϣϯΞ ϓϦ • http://answer.jp • 5෼Ҏ಺ͷίϝϯτ͕84%Ҏ্ • 1೔40ສίϝϯτ

    • iOS൛ 2013೥12݄ϦϦʔε • Android൛2014೥5݄ϦϦʔε
  6. αʔϏε঺հɹIGNITION • ίϯηϓτ͸ʮ೔ຊͱੈ քΛܨ͙ʯϝσΟΞ • http://ignition.co • ೔ຊͷάϩʔόϧԽΛՃ ଎͢ΔͨΊʹɺ೔ຊͷ৘ ใΛӳޠͰੈքʹൃ৴

    • Χϧνϟʔ͔ΒϏδωε ·Ͱ෯޿͘঺հ
  7. nanapiͰ CloudSearchΛ࢖͍ͬͯ·͢

  8. ࠓ೔࿩͢͜ͱ ̍ɽCloudSearchಋೖͷ͖͔͚ͬ ̎ɽݕࡧ͍ͯ͠Δ΋ͷ ̏ɽݕࡧσʔλͷͭ͘Γ͔ͨ ̐ɽݕࡧͷ͔ͨ͠ ̑ɽCloudSearchͷϝϦοτ

  9. ࠓ೔࿩͢͜ͱ ̍ɽCloudSearchಋೖͷ͖͔͚ͬ ̎ɽݕࡧ͍ͯ͠Δ΋ͷ ̏ɽݕࡧσʔλͷͭ͘Γ͔ͨ ̐ɽݕࡧͷ͔ͨ͠ ̑ɽCloudSearchͷϝϦοτ

  10. AWS΁ͷҠߦ • 2014೥7݄຤ɹΠϯϑϥΛAWS΁શͯҠߦ • ը૾ΦϦδϯαʔόɹˠɹS3 • MemcacheɺRedis ɹˠɹElastiCache • MySQLɹɹɹɹɹ

    ɹˠɹRDS • શจݕࡧɹɹɹɹ ɹˠɹCloudSearch
  11. nanapiͷݕࡧγεςϜ Senna ↓ mroonga ↓ CloudSearch

  12. CloudSearchͷӡ༻ • 100,000 υΩϡϝϯτ • 1υϝΠϯ • search.m1.small

  13. ࠓ೔࿩͢͜ͱ ̍ɽCloudSearchಋೖͷ͖͔͚ͬ ̎ɽݕࡧ͍ͯ͠Δ΋ͷ ̏ɽݕࡧσʔλͷͭ͘Γ͔ͨ ̐ɽݕࡧͷ͔ͨ͠ ̑ɽCloudSearchͷϝϦοτ

  14. nanapiͷهࣄݕࡧ

  15. ʮӡಈձʯ×ʮྉཧϨγϐʯ

  16. ʮӡಈձʯ×ʮΧϝϥɾࣸਅʯ

  17. ʮӡಈձʯ×ʮεϙʔπɾΞ΢τυΞʯ

  18. ͱͯ΋͍͍ײ͡ʂ

  19. ࠓ೔࿩͢͜ͱ ̍ɽCloudSearchಋೖͷ͖͔͚ͬ ̎ɽݕࡧ͍ͯ͠Δ΋ͷ ̏ɽݕࡧσʔλͷͭ͘Γ͔ͨ ̐ɽݕࡧͷ͔ͨ͠ ̑ɽCloudSearchͷϝϦοτ

  20. CloudSearch΁ೖΕΔσʔλ • ݕࡧ༻ • ιʔτ༻ • දࣔ༻

  21. ݕࡧ༻ • هࣄͷλΠτϧɺຊจ • ΧςΰϦ໊ͷ֊૚ߏ଄

  22. ιʔτ༻ • PV • هࣄͷࣥච೔࣌

  23. දࣔ༻ • هࣄͷΞ΢τϥΠϯ • ஶऀ৘ใ • هࣄͷΩϟονը૾ͷURL

  24. σʔλͷܕ

  25. ֤ςʔϒϧߋ৽࣌ʹίʔϧόοΫ هࣄ ஶऀ ΧςΰϦ ݕࡧσʔλ afterSave()

  26. CloudSearch΁อଘ هࣄ ஶऀ ΧςΰϦ ݕࡧσʔλ afterSave() CloudSearch

  27. ࠓ೔࿩͢͜ͱ ̍ɽCloudSearchಋೖͷ͖͔͚ͬ ̎ɽݕࡧ͍ͯ͠Δ΋ͷ ̏ɽݕࡧσʔλͷͭ͘Γ͔ͨ ̐ɽݕࡧͷ͔ͨ͠ ̑ɽCloudSearchͷϝϦοτ

  28. CakePHP + CloudSearch • CakePHP͔ΒCloudSearchΛૢ࡞͢ΔϓϥάΠϯ • https://github.com/nanapi/cakephp-cloud-search • AWS SDK

    for PHPΛϥοϓͨ͠Datasource • CakePHPͷModelͱͯ͠ѻ͏͜ͱ͕Ͱ͖Δ • Modelͱಉ͡ϝιουɺfind() / save()
  29. อଘ // save $save_data = $this->MyModel->create(); $save_data = [ 'id'

    => '123', 'fields' => [ 'subject' => 'ژ౎Ͱͷ͓͢͢Ίͷ͓౔࢈' 'outline' => ['ژ౎ͷ͓౔࢈', '࣮ࡍʹങͬͨ͜ͱͷ͋Δ͓౔࢈', 'ژ౎ͷ͓౔࢈ʹ͍ͭͯ ͷΞυόΠε'] ] ]; $this->MyModel->save($save_data);
  30. ೔෇ܕ͸UTC ! CakeTime::i18nFormat($created, "%FT%TZ", false, new DateTimeZone('UTC'));

  31. ݕࡧ // find $result = $this->MyModel->find('all', [ 'conditions' => [

    'query' => 'ژ౎' ], 'fields' => [ 'id', 'subject', '_score' ] ]);
  32. ࡟আ // delete $this->MyModel->delete(123); ! $this->MyModel->deleteAll([ 'MyModel.id' => ['111', '222',

    '333'], ]);
  33. ؆୯ɺγϯϓϧʂ

  34. ࠓ೔࿩͢͜ͱ ̍ɽCloudSearchಋೖͷ͖͔͚ͬ ̎ɽݕࡧ͍ͯ͠Δ΋ͷ ̏ɽݕࡧσʔλͷͭ͘Γ͔ͨ ̐ɽݕࡧͷ͔ͨ͠ ̑ɽCloudSearchͷϝϦοτ

  35. CloudSearchͷϝϦοτ • σϑΥϧτͷ··Ͱ͍͍ײ͡ʹݕࡧͰ͖Δ • ؆୯ʹ೔ຊޠશจݕࡧγεςϜΛ࡞ΕΔ • ͱʹָ͔͘

  36. CloudSearchͰΒ͘Β͘ݕࡧʂ

  37. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠