Contenu connexe Similaire à Using Apache Solr (20) Using Apache Solr20. SELECT * FROM post WHERE
topic LIKE ‘%aoi%’ OR author
LIKE ‘%aoi%’ ORDER BY id DESC 21. SELECT * FROM post WHERE
(topic LIKE ‘%aoi%’ OR author
LIKE ‘%aoi%’)
OR
(topic LIKE ‘%miyabi%’ OR
author LIKE ‘%miyabi%’)
ORDER BY id DESC 26. Indexer
Update index
Query
Solr Web App
Lucene
Result 29. <field name=quot;idquot; type=quot;stringquot;
indexed=quot;truequot; stored=quot;truequot; />
<field name=quot;fullnamequot; type=quot;stringquot;
indexed=quot;truequot; stored=quot;truequot; />
<field name=quot;positionquot; type=quot;stringquot;
indexed=quot;truequot; stored=quot;truequot; />
<field name=quot;tagquot; type=quot;stringiquot;
indexed=quot;truequot; stored=quot;truequot;
multiValued=quot;truequot; /> 35. Document format
<add><doc>
<field name=”id”>555</field>
<field name=”fullname”>Kaka</field>
<field name=”position”>Midfielder</field>
<field name=”tag”>AC Milan</field>
<field name=”tag”>Brazil</field>
</doc></add> 47. <response>
<result numFound=”46” start=”0”>
<doc>
<str name=”fullname”>Sergio Ramos</str>
<str name=”position”>Defender</str>
<str name=”tag”>Real Madrid</str>
<str name=”tag”>Spain</str>
</doc>
<doc>
<str name=”fullname”>Diego Forlan</str>
<str name=”position”>Striker</str>
<str name=”tag”>Atletico Madrid</str>
<str name=”tag”>Uruguay</str>
</doc>
</result>
</response> 49. {
“result”: { “numFound”: 46, “start”: 0,
“docs” : [
{ “fullname”: “Sergio Ramos”,
“position”: “Defender”,
“tag”: [“Real Madrid”, “Spain”] },
{ “fullname”: “Diego Forlan”,
“position”: “Striker”,
“tag”: [“Atletico Madrid”, “Uruguay”] }
]
}
} 51. • David Pizzarro
• Equiv: David OR Pizzarro
• Default operator is
“OR” (con gurable)
• Result: David Villa, David
Pizzarro, Claudio Pizzarro,
David Seaman 66. <fieldType name=quot;html_thquot; class=quot;solr.TextFieldquot;
positionIncrementGap=quot;100quot;>
<analyzer type=quot;indexquot;>
<tokenizer
class=quot;solr.HTMLStripStandardTokenizerFactoryquot;/>
<filter class=quot;solr.ThaiWordFilterFactoryquot; />
<filter class=quot;solr.StopFilterFactoryquot;
ignoreCase=quot;truequot; words=quot;stopwords.txtquot;/>
<filter class=quot;solr.LowerCaseFilterFactoryquot;/>
<filter class=quot;solr.EnglishPorterFilterFactoryquot;
protected=quot;protwords.txtquot;/>
<filter
class=quot;solr.RemoveDuplicatesTokenFilterFactoryquot;/>
</analyzer>
</fieldType> 67. <field name=quot;idquot; type=quot;stringquot;
indexed=quot;truequot; stored=quot;truequot; />
<field name=quot;titlequot; type=quot;html_thquot;
indexed=quot;truequot; stored=quot;truequot; />
<field name=quot;detailquot; type=quot;html_thquot;
indexed=quot;truequot; stored=quot;truequot; />
<field name=quot;tagquot; type=quot;stringiquot;
indexed=quot;truequot; stored=quot;truequot;
multiValued=quot;truequot; />
<field name=quot;useridquot; type=quot;integerquot;
indexed=quot;falsequot; stored=quot;truequot; /> 71. Further readings
• http://lucene.apache.org/solr/
• http://wiki.apache.org/solr
• http://www.xml.com/pub/a/2006/08/09/
solr-indexing-xml-with-lucene-
andrest.html
• http://lucene.apache.org/java/docs/
scoring.html