Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Solr入門?

 Solr入門?

Jun Ohtani

June 18, 2013
Tweet

More Decks by Jun Ohtani

Other Decks in Technology

Transcript

  1. ݕࡧΤϯδϯͷಈ࡞ υΩϡϝϯτొ࿥ͷྲྀΕ 1 2 ΧπΦ͸αβΤͷఋ αβΤ͸ϫΧϝͷ࢞ 1 2 ΧπΦ αβΤ

    ͸ ͸ ͷ ͷ αβΤ ϫΧϝ ఋ ࢞ υΩϡϝϯτͷొ࿥ ୯ޠʹ෼ׂ 13೥6݄19೔ਫ༵೔
  2. ݕࡧΤϯδϯͷಈ࡞ υΩϡϝϯτొ࿥ͷྲྀΕ 1 2 ΧπΦ͸αβΤͷఋ αβΤ͸ϫΧϝͷ࢞ 1 2 ΧπΦ αβΤ

    ͸ ͸ ͷ ͷ αβΤ ϫΧϝ ఋ ࢞ ΧπΦ αβΤ 1 1 2 ͸ ͷ ࢞ ϫΧϝ 2 1 2 1 2 1 ఋ 2 υΩϡϝϯτͷొ࿥ ୯ޠʹ෼ׂ ୯ޠ͔Βidͷ഑ྻ͕Ҿ ͚ΔΑ͏ʹ ʹసஔΠϯσοΫε 13೥6݄19೔ਫ༵೔
  3. ݕࡧΤϯδϯͷಈ࡞ ݕࡧͷྲྀΕ ΧπΦɹαβΤ ΧπΦ αβΤ 1 1 2 ͸ ͷ

    ࢞ ϫΧϝ 2 1 2 1 2 1 ఋ 2 ݕࡧจࣈೖྗ 13೥6݄19೔ਫ༵೔
  4. ݕࡧΤϯδϯͷಈ࡞ ݕࡧͷྲྀΕ ΧπΦɹαβΤ ΧπΦ αβΤ ΧπΦ αβΤ 1 1 2

    ͸ ͷ ࢞ ϫΧϝ 2 1 2 1 2 1 ఋ 2 ݕࡧจࣈೖྗ ݕࡧจࣈͷύʔε ʴݕࡧΫΤϦԽ AND 13೥6݄19೔ਫ༵೔
  5. ݕࡧΤϯδϯͷಈ࡞ ݕࡧͷྲྀΕ ΧπΦɹαβΤ ΧπΦ αβΤ ΧπΦ αβΤ 1 1 2

    ͸ ͷ ࢞ ϫΧϝ 2 1 2 1 2 1 ఋ 2 ݕࡧจࣈೖྗ ݕࡧจࣈͷύʔε ʴݕࡧΫΤϦԽ సஔΠϯσοΫεΛ ݕࡧ AND 13೥6݄19೔ਫ༵೔
  6. ݕࡧΤϯδϯͷಈ࡞ ݕࡧͷྲྀΕ ΧπΦɹαβΤ ΧπΦ αβΤ ΧπΦ αβΤ 1 1 2

    ͸ ͷ ࢞ ϫΧϝ 2 1 2 1 2 1 ఋ 2 ݕࡧจࣈೖྗ ݕࡧจࣈͷύʔε ʴݕࡧΫΤϦԽ సஔΠϯσοΫεΛ ݕࡧ AND 13೥6݄19೔ਫ༵೔
  7. ݕࡧΤϯδϯͷಈ࡞ ݕࡧͷྲྀΕ ΧπΦɹαβΤ ΧπΦ αβΤ ΧπΦ αβΤ 1 1 2

    ͸ ͷ ࢞ ϫΧϝ 2 1 2 1 2 1 ఋ 2 ݕࡧจࣈೖྗ ݕࡧจࣈͷύʔε ʴݕࡧΫΤϦԽ సஔΠϯσοΫεΛ ݕࡧ ˠANDݕࡧͳͷͰidͷ ഑ྻͷANDΛͱΔ AND 13೥6݄19೔ਫ༵೔
  8. SolrͷΞʔΩςΫνϟ &RQWHQW )HHGHU HJ6ROU- &RQWHQW &RQQHFWRUV 0&) &RQWHQW 6RXUFHV ,QGH[

    /XFHQH 6ROU:HE$SS VFKHPD VROU FRQILJ 8SGDWH&KDLQ $QDO\VLV 6HDUFK5HTXHVW +DQGOLQJ 4XHU\ 4XHU\ 3DUVHU 8SGDWH5HTXHVW +DQGOLQJ -DYD$SS6HUYHU 6HDUFK&RPS 6ROU&RUH $GPLQ 6WDWV =RR .HHSHU 5HVS :ULWHU $SDFKH6ROU &RQFHSWXDO $UFKLWHFWXUH $GPLQ 8VHU 8SGDWH +DQGOHU ,OOXVWUDWLRQE\&RPLQYHQW$6 <RXPD\IUHHO\XVHLWDV ORQJDV\RXDWWULEXWHZLWK OLQNWRZZZFRPLQYHQWFRP DFFRUGLQJWR&&E\OLFHQVH ZZZFUHDWLYHFRPPRQVRUJ 2ULJLQDOGLDJUDPE\ ZZZFRPLQYHQWFRP &RUH $GPLQ &RO OHFWLRQ $GPLQ ςΩετ Original diagram byɹ http://www.cominvent.com 13೥6݄19೔ਫ༵೔
  9. ߏ੒֓ཁ Update Reuqest Handling ߋ৽ॲཧΛUpdateChainͱ͍͏ܗͰఆٛՄೳ SolrଆͰొ࿥લॲཧΛॻ͚Δ ྫɿݴޠ൑ผͯ͠ɺϑΟʔϧυΛܾఆͳͲ http://wiki.apache.org/solr/UpdateRequestProcessor Search Request

    Handling ݕࡧΫΤϦΛड͚औΓ݁ՌΛग़ྗ͢Δॲཧ SearchComponentͷ૊Έ߹ΘͤʹΑΓఆٛՄೳ http://wiki.apache.org/solr/SolrRequestHandler 13೥6݄19೔ਫ༵೔
  10. SolrͷΞʔΩςΫνϟ &RQWHQW )HHGHU HJ6ROU- &RQWHQW &RQQHFWRUV 0&) &RQWHQW 6RXUFHV ,QGH[

    /XFHQH 6ROU:HE$SS VFKHPD VROU FRQILJ 8SGDWH&KDLQ $QDO\VLV 6HDUFK5HTXHVW +DQGOLQJ 4XHU\ 4XHU\ 3DUVHU 8SGDWH5HTXHVW +DQGOLQJ -DYD$SS6HUYHU 6HDUFK&RPS 6ROU&RUH $GPLQ 6WDWV =RR .HHSHU 5HVS :ULWHU $SDFKH6ROU &RQFHSWXDO $UFKLWHFWXUH $GPLQ 8VHU 8SGDWH +DQGOHU ,OOXVWUDWLRQE\&RPLQYHQW$6 <RXPD\IUHHO\XVHLWDV ORQJDV\RXDWWULEXWHZLWK OLQNWRZZZFRPLQYHQWFRP DFFRUGLQJWR&&E\OLFHQVH ZZZFUHDWLYHFRPPRQVRUJ 2ULJLQDOGLDJUDPE\ ZZZFRPLQYHQWFRP &RUH $GPLQ &RO OHFWLRQ $GPLQ ͜͜ Original diagram byɹ http://www.cominvent.com 13೥6݄19೔ਫ༵೔
  11. FieldType:ςΩετܥ ྫɿtext_jaϑΟʔϧυܕ <fieldType name="text_ja" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="false"> <analyzer> <tokenizer class="solr.JapaneseTokenizerFactory"

    mode="search"/> <filter class="solr.JapaneseBaseFormFilterFactory"/> <filter class="solr.JapanesePartOfSpeechStopFilterFactory" tags="lang/stoptags_ja.txt" /> ... </analyzer> </fieldType> nameɺclass͸ඇςΩετܥಉ༷ AnalysisॲཧΛఆٛՄೳ 13೥6݄19೔ਫ༵೔
  12. Fieldఆٛͷઃఆ߲໨ ଐੑ໊ આ໌ σϑΥϧτ indexed ݕࡧର৅ϑΟʔϧυ͔Ͳ͏͔ true stored ϑΟʔϧυ஋Λอଘ͢Δ͔Ͳ͏͔ true

    required ඞਢϑΟʔϧυ͔Ͳ͏͔ false multiValued ϑΟʔϧυ͕഑ྻܕʢෳ਺஋ʣ͔Ͳ͏͔ false omitNorms norm஋Λอଘ͢Δ false termVectors termPositions termOffsets Termʹؔ͢Δ৘ใΛอଘ͢Δ false 13೥6݄19೔ਫ༵೔
  13. addσʔλαϯϓϧʢXMLʣ <add> <doc> <field name="authors">Patrick Eagar</field> <field name="subject">Sports</field> <field name="dd">796.35</field>

    <field name="numpages">128</field> <field name="desc"></field> <field name="price">12.40</field> <field name="title" boost="2.0">Summer of the all-rounder: Test and championship cricket in England 1982</field> <field name="isbn">0002166313</field> <field name="yearpub">1982</field> <field name="publisher">Collins</field> </doc> <doc boost="2.5"> ... </doc> </add> 13೥6݄19೔ਫ༵೔
  14. SolrͷΞʔΩςΫνϟ &RQWHQW )HHGHU HJ6ROU- &RQWHQW &RQQHFWRUV 0&) &RQWHQW 6RXUFHV ,QGH[

    /XFHQH 6ROU:HE$SS VFKHPD VROU FRQILJ 8SGDWH&KDLQ $QDO\VLV 6HDUFK5HTXHVW +DQGOLQJ 4XHU\ 4XHU\ 3DUVHU 8SGDWH5HTXHVW +DQGOLQJ -DYD$SS6HUYHU 6HDUFK&RPS 6ROU&RUH $GPLQ 6WDWV =RR .HHSHU 5HVS :ULWHU $SDFKH6ROU &RQFHSWXDO $UFKLWHFWXUH $GPLQ 8VHU 8SGDWH +DQGOHU ,OOXVWUDWLRQE\&RPLQYHQW$6 <RXPD\IUHHO\XVHLWDV ORQJDV\RXDWWULEXWHZLWK OLQNWRZZZFRPLQYHQWFRP DFFRUGLQJWR&&E\OLFHQVH ZZZFUHDWLYHFRPPRQVRUJ 2ULJLQDOGLDJUDPE\ ZZZFRPLQYHQWFRP &RUH $GPLQ &RO OHFWLRQ $GPLQ ͜͜ Original diagram byɹ http://www.cominvent.com 13೥6݄19೔ਫ༵೔
  15. ग़ྗܗࣜ wtύϥϝʔλʹΑΓࢦఆՄೳ solrconfig.xmlʹ<queryResponseWriter>Ͱઃఆ ҎԼ͸ઃఆͳ͠Ͱར༻Մೳ http://wiki.apache.org/solr/QueryResponseWriter ஋ આ໌ xml xml XMLܗࣜɻσϑΥϧτ

    json JSONܗࣜ python PythonͷγϦΞϥΠζܗࣜ ruby RubyͷγϦΞϥΠζܗࣜ php PHPͷevalؔ਺ܗࣜ phps PHPͷγϦΞϥΠζܗࣜ csv CSVܗࣜ 13೥6݄19೔ਫ༵೔
  16. ͦͷଞݕࡧύϥϝʔλ ओͳύϥϝʔλ ύϥϝʔλ આ໌ σϑΥϧτ start ݁ՌͷελʔτҐஔ 0 rows औಘ݅਺

    10 fl औಘϑΟʔϧυ *,score fq ߜΓࠐΈ৚݅ df σϑΥϧτݕࡧϑΟʔϧυ 13೥6݄19೔ਫ༵೔
  17. ෼ࢄݕࡧͷ࢓૊Έ 1. shardݕࡧ Solr Core Solr Core Solr Core Solr

    Core index index index shard title:Apache 13೥6݄19೔ਫ༵೔
  18. ෼ࢄݕࡧͷ࢓૊Έ 1. shardݕࡧ Solr Core Solr Core Solr Core Solr

    Core index index index shard title:Apache title:Apache title:Apache 13೥6݄19೔ਫ༵೔
  19. ෼ࢄݕࡧͷ࢓૊Έ 1. shardݕࡧ Solr Core Solr Core Solr Core Solr

    Core index index index shard title:Apache title:Apache title:Apache 13೥6݄19೔ਫ༵೔
  20. ෼ࢄݕࡧͷ࢓૊Έ 1. shardݕࡧ Solr Core Solr Core Solr Core Solr

    Core index index index shard idͷϦετ idͷϦετ idͷϦετ 13೥6݄19೔ਫ༵೔
  21. ෼ࢄݕࡧͷ࢓૊Έ 1. shardݕࡧ Solr Core Solr Core Solr Core Solr

    Core index index index shard idͷϦετ idͷϦετ idͷϦετ 13೥6݄19೔ਫ༵೔
  22. ෼ࢄݕࡧͷ࢓૊Έ 2. ݁Ռ౷߹ Solr Core Solr Core Solr Core Solr

    Core index index index shard ֤shard͔Β ͷ݁ՌΛείΞ Ͱιʔτ͠ɺඞ ཁͳ෦෼ΛऔΓ ग़͢ 13೥6݄19೔ਫ༵೔
  23. ෼ࢄݕࡧͷ࢓૊Έ 2. ݁Ռ౷߹ Solr Core Solr Core Solr Core Solr

    Core index index index shard ฦ٫σʔλऔಘ ͷͨΊɺ֤ shardʹidͰ໰ ͍߹Θͤ 13೥6݄19೔ਫ༵೔
  24. ෼ࢄݕࡧͷ࢓૊Έ 2. ݁Ռ౷߹ Solr Core Solr Core Solr Core Solr

    Core index index index shard 13೥6݄19೔ਫ༵೔
  25. ෼ࢄݕࡧͷ࢓૊Έ 2. ݁Ռ౷߹ Solr Core Solr Core Solr Core Solr

    Core index index index shard flύϥϝʔλͰࢦఆ͞Εͨ ϑΟʔϧυ৘ใΛฦ٫ 13೥6݄19೔ਫ༵೔
  26. ෼ࢄݕࡧͷ࢓૊Έ 2. ݁Ռ౷߹ Solr Core Solr Core Solr Core Solr

    Core index index index shard 13೥6݄19೔ਫ༵೔
  27. ෼ࢄݕࡧͷ࢓૊Έ 2. ݁Ռ౷߹ Solr Core Solr Core Solr Core Solr

    Core index index index shard ݁ՌΛXMLԽͯ͠ Ϩεϙϯεग़ྗ 13೥6݄19೔ਫ༵೔
  28. ࢀߟURL SolrຊՈͷWikiɿ ɹhttp://wiki.apache.org/solr/ LucidWorksͷϦϑΝϨϯεΨΠυɿ ɹhttp://docs.lucidworks.com/display/solr/Apache+Solr +Reference+Guide Tokenizerͷಈ࡞ʹ͍ͭͯʢLucene Revolution 2013ͷεϥΠυʣ ɹhttp://www.lucenerevolution.org/sites/default/files/

    Language%20support%20and%20linguistics%20in %20LuceneSolr%20%26%20its%20eco-system.pdf Lucene RevolutionͷαΠτ ɹhttp://www.lucenerevolution.org/2013/Lucene-Solr- Revolution-2013-Presentations 13೥6݄19೔ਫ༵೔