SlideShare a Scribd company logo
Introdução a buscas com Solr
+
Claudson Oliveira
@cloudson
cloudson.github.io
batman
select * from produtos
where nome like '%batman%'

Batman Arkham Asylum

Batman Arkham City

Batman Arkham Origins
batman city

select * from produtos
where nome like '%batman%' and nome like '%city%'

Batman Arkham City
batman ps3

select * from produtos
where nome like '%batman%' and nome like '%ps3%'
batman ps3
select * from produtos
where (nome like '%batman%' and nome like '%ps3%')
or (genero like '%batman%' and genero '%ps3%' )
or (nome like '%batman%' or nome like '%ps3%'
or genero like '%batman%' or genero '%ps3%' )

Batman Arkham Origins
cartões de visita == cartão de visita ?

Celular == iphone?
cade == cadern == caderno ?
Filtros?

CAPA DE NOTEBOOK == Capa de Notebook ?
Solr ?
Java 6
Jetty
Lucene ou Solr 4.5.1?
http://Localhost:8983
Apache License version 2 link

Referência
Núcleos

solrSkeleton/schemas/solr.xml
<?xml version="1.0" encoding="UTF-8" ?>
<solr>
<cores adminPath="/admin/cores">
<core name="produto" instanceDir="produto" />
</cores>
</solr>
Esquemas
Documento = Linha no banco
Esquema = Estrutura de dado

solrSkeleton/schemas/product/conf/schema.xml
<?xml version="1.0" encoding="UTF-8"?>
<schema name="Product" version="1.1">
<types>
<!-- tipos -->
</types>
<fields>
<!-- campos -->
</fields>
</schema>
Esquemas - tipos
Classe

Descrição

Solr. IntField
Solr.StrField

Inteiros de 32bits com sinal
String

Solr.TextField

Text, usually multiple words or tokens.

Solr.DateTime

“Y-m-d H:i:s”
Referência

solrSkeleton/schemas/product/conf/schema.xml
<?xml version="1.0" encoding="UTF-8"?>
<schema name="Product" version="1.1">
<types>
<fieldType name="inteiro" class="solr.IntField" />
<fieldType name=“frase" class="solr.StrField" />
</types>
<fields>
<field name="numero_compras" type="inteiro" />
</fields>
</schema>
Esquemas - Filtros
solrSkeleton/schemas/product/conf/schema.xml
<?xml version="1.0" encoding="UTF-8"?>
<schema name="Product" version="1.1">
<types>
<fieldType name="inteiro" class="solr.IntField" />
<fieldType name=“frase" class="solr.String" />
<fieldType name=“complexo" class=“solr.TextField">
solrSkeleton/schemas/product/conf/schema.xml
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" />
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.BrazilianStemFilterFactory"/>
</analyzer>
</fieldType>
</types>
<fields>
<field name="numero_compras" type="inteiro" />
</fields>
</schema>
Esquemas - Filtros
<filter class="solr.StopFilterFactory" words="stopwords.txt" />
<filter class="solr.LowerCaseFilterFactory"/>
Cartão de Visita
Cartão

Visita

cartao

visita

cartao

visita

Cartao de visita

Cartão Visita
Esquemas - Filtros
Filtro

Exemplo

TrimFilterFactory

“ phpsp” => “phpsp”

StopFilterFactory

“encontro de novembro” => “encontro novembro”

EdgeNGramFilterFactory

“programador” => “pro” , “progr” ... “programador”

WordDelimiterFilterFactory “phpSp” => “php”, “sp” / “git2u” => “git” , “2” , “u”
SynonymFilterFactory

“celular” => “iphone”, “galaxy”, “foston”, “celular”

Referência
Handler
solrSkeleton/schemas/product/conf/solrconfig.xml
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<luceneMatchVersion>4.4</luceneMatchVersion>
<directoryFactory name="DirectoryFactory"
class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
<dataDir>${solr.core0.data.dir:}</dataDir>
<schemaFactory class="ClassicIndexSchemaFactory"/>
<updateHandler class="solr.DirectUpdateHandler2" />
<requestHandler name="standard" class="solr.StandardRequestHandler"
default="true" />
<requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
<requestHandler name="/admin/"
class="org.apache.solr.handler.admin.AdminHandlers" />
<admin>
<defaultQuery>solr</defaultQuery>
</admin>
</config>
Como salvar/atualizar um documento solr ?
POST http://locahost:8983/solr/product/update HTTP/1.1
Content-Type: text/xml

<add>
<doc>
<field name="fieldname1">field valueA</field>
<field name="fieldname2">field valueB</field>
</doc
</add>
Leia mais
http://lucene.apache.org/solr/
Ascii cast http://asciinema.org/a/6219

Caching http://wiki.apache.org/solr/SolrCaching
Replication http://wiki.apache.org/solr/SolrReplication
SpellChecker http://wiki.apache.org/solr/SpellCheckComponent
Livro http://www.packtpub.com/apache-solr-4-cookbook/book

http://blog.sematext.com/2012/08/23/solr-vs-elasticsearch-part-1-overview/

Ferramentas
Solr Pecl - http://pecl.php.net/package/solr

Solarium - http://www.solarium-project.org/
SolrBundle - https://github.com/floriansemm/SolrBundle
Dúvidas ?

@cloudson

More Related Content

Similar to Introdução a buscas com solr

[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자
[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자
[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자Donghyeok Kang
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
Chris Wilcoxson
 
Using Apache Solr
Using Apache SolrUsing Apache Solr
Using Apache Solr
pittaya
 
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsJava Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom Tags
IMC Institute
 
Learning Dtrace
Learning DtraceLearning Dtrace
Learning Dtrace
JeongHun Byeon
 
Solr Anti-Patterns: Presented by Rafał Kuć, Sematext
Solr Anti-Patterns: Presented by Rafał Kuć, SematextSolr Anti-Patterns: Presented by Rafał Kuć, Sematext
Solr Anti-Patterns: Presented by Rafał Kuć, Sematext
Lucidworks
 
Rapid prototyping search applications with solr
Rapid prototyping search applications with solrRapid prototyping search applications with solr
Rapid prototyping search applications with solr
Lucidworks (Archived)
 
Schematron
SchematronSchematron
Schematron
Emiel Paasschens
 
Unix executable buffer overflow
Unix executable buffer overflowUnix executable buffer overflow
Unix executable buffer overflow
Ammarit Thongthua ,CISSP CISM GXPN CSSLP CCNP
 
Solr integration in Magento Enterprise
Solr integration in Magento EnterpriseSolr integration in Magento Enterprise
Solr integration in Magento EnterpriseTobias Zander
 
Struts2
Struts2Struts2
Solr features
Solr featuresSolr features
Solr features
Marcos García
 
as400 built in function- %REPLACE
as400 built in function- %REPLACEas400 built in function- %REPLACE
as400 built in function- %REPLACE
aminem_mp
 
Spring Surf 101
Spring Surf 101Spring Surf 101
Spring Surf 101
Alfresco Software
 
2009 Barcamp Nashville Web Security 101
2009 Barcamp Nashville   Web Security 1012009 Barcamp Nashville   Web Security 101
2009 Barcamp Nashville Web Security 101
brian_dailey
 
Writing DSLs with Parslet - Wicked Good Ruby Conf
Writing DSLs with Parslet - Wicked Good Ruby ConfWriting DSLs with Parslet - Wicked Good Ruby Conf
Writing DSLs with Parslet - Wicked Good Ruby Conf
Jason Garber
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with Solr
Erik Hatcher
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaJevgeni Kabanov
 
Great Developers Steal
Great Developers StealGreat Developers Steal
Great Developers Steal
Ben Scofield
 

Similar to Introdução a buscas com solr (20)

[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자
[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자
[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
 
Using Apache Solr
Using Apache SolrUsing Apache Solr
Using Apache Solr
 
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsJava Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom Tags
 
Learning Dtrace
Learning DtraceLearning Dtrace
Learning Dtrace
 
Solr Anti-Patterns: Presented by Rafał Kuć, Sematext
Solr Anti-Patterns: Presented by Rafał Kuć, SematextSolr Anti-Patterns: Presented by Rafał Kuć, Sematext
Solr Anti-Patterns: Presented by Rafał Kuć, Sematext
 
Rapid prototyping search applications with solr
Rapid prototyping search applications with solrRapid prototyping search applications with solr
Rapid prototyping search applications with solr
 
Schematron
SchematronSchematron
Schematron
 
Unix executable buffer overflow
Unix executable buffer overflowUnix executable buffer overflow
Unix executable buffer overflow
 
Solr integration in Magento Enterprise
Solr integration in Magento EnterpriseSolr integration in Magento Enterprise
Solr integration in Magento Enterprise
 
Practica n° 7
Practica n° 7Practica n° 7
Practica n° 7
 
Struts2
Struts2Struts2
Struts2
 
Solr features
Solr featuresSolr features
Solr features
 
as400 built in function- %REPLACE
as400 built in function- %REPLACEas400 built in function- %REPLACE
as400 built in function- %REPLACE
 
Spring Surf 101
Spring Surf 101Spring Surf 101
Spring Surf 101
 
2009 Barcamp Nashville Web Security 101
2009 Barcamp Nashville   Web Security 1012009 Barcamp Nashville   Web Security 101
2009 Barcamp Nashville Web Security 101
 
Writing DSLs with Parslet - Wicked Good Ruby Conf
Writing DSLs with Parslet - Wicked Good Ruby ConfWriting DSLs with Parslet - Wicked Good Ruby Conf
Writing DSLs with Parslet - Wicked Good Ruby Conf
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with Solr
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
 
Great Developers Steal
Great Developers StealGreat Developers Steal
Great Developers Steal
 

Recently uploaded

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 

Recently uploaded (20)

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 

Introdução a buscas com solr

  • 3.
  • 4. batman select * from produtos where nome like '%batman%' Batman Arkham Asylum Batman Arkham City Batman Arkham Origins
  • 5. batman city select * from produtos where nome like '%batman%' and nome like '%city%' Batman Arkham City
  • 6. batman ps3 select * from produtos where nome like '%batman%' and nome like '%ps3%'
  • 7. batman ps3 select * from produtos where (nome like '%batman%' and nome like '%ps3%') or (genero like '%batman%' and genero '%ps3%' ) or (nome like '%batman%' or nome like '%ps3%' or genero like '%batman%' or genero '%ps3%' ) Batman Arkham Origins
  • 8. cartões de visita == cartão de visita ? Celular == iphone? cade == cadern == caderno ? Filtros? CAPA DE NOTEBOOK == Capa de Notebook ?
  • 10. Java 6 Jetty Lucene ou Solr 4.5.1? http://Localhost:8983 Apache License version 2 link Referência
  • 11. Núcleos solrSkeleton/schemas/solr.xml <?xml version="1.0" encoding="UTF-8" ?> <solr> <cores adminPath="/admin/cores"> <core name="produto" instanceDir="produto" /> </cores> </solr>
  • 12. Esquemas Documento = Linha no banco Esquema = Estrutura de dado solrSkeleton/schemas/product/conf/schema.xml <?xml version="1.0" encoding="UTF-8"?> <schema name="Product" version="1.1"> <types> <!-- tipos --> </types> <fields> <!-- campos --> </fields> </schema>
  • 13. Esquemas - tipos Classe Descrição Solr. IntField Solr.StrField Inteiros de 32bits com sinal String Solr.TextField Text, usually multiple words or tokens. Solr.DateTime “Y-m-d H:i:s” Referência solrSkeleton/schemas/product/conf/schema.xml <?xml version="1.0" encoding="UTF-8"?> <schema name="Product" version="1.1"> <types> <fieldType name="inteiro" class="solr.IntField" /> <fieldType name=“frase" class="solr.StrField" /> </types> <fields> <field name="numero_compras" type="inteiro" /> </fields> </schema>
  • 14. Esquemas - Filtros solrSkeleton/schemas/product/conf/schema.xml <?xml version="1.0" encoding="UTF-8"?> <schema name="Product" version="1.1"> <types> <fieldType name="inteiro" class="solr.IntField" /> <fieldType name=“frase" class="solr.String" /> <fieldType name=“complexo" class=“solr.TextField"> solrSkeleton/schemas/product/conf/schema.xml <analyzer> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.StopFilterFactory" words="stopwords.txt" /> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.BrazilianStemFilterFactory"/> </analyzer> </fieldType> </types> <fields> <field name="numero_compras" type="inteiro" /> </fields> </schema>
  • 15. Esquemas - Filtros <filter class="solr.StopFilterFactory" words="stopwords.txt" /> <filter class="solr.LowerCaseFilterFactory"/> Cartão de Visita Cartão Visita cartao visita cartao visita Cartao de visita Cartão Visita
  • 16. Esquemas - Filtros Filtro Exemplo TrimFilterFactory “ phpsp” => “phpsp” StopFilterFactory “encontro de novembro” => “encontro novembro” EdgeNGramFilterFactory “programador” => “pro” , “progr” ... “programador” WordDelimiterFilterFactory “phpSp” => “php”, “sp” / “git2u” => “git” , “2” , “u” SynonymFilterFactory “celular” => “iphone”, “galaxy”, “foston”, “celular” Referência
  • 17. Handler solrSkeleton/schemas/product/conf/solrconfig.xml <?xml version="1.0" encoding="UTF-8" ?> <config> <luceneMatchVersion>4.4</luceneMatchVersion> <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/> <dataDir>${solr.core0.data.dir:}</dataDir> <schemaFactory class="ClassicIndexSchemaFactory"/> <updateHandler class="solr.DirectUpdateHandler2" /> <requestHandler name="standard" class="solr.StandardRequestHandler" default="true" /> <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" /> <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" /> <admin> <defaultQuery>solr</defaultQuery> </admin> </config>
  • 18. Como salvar/atualizar um documento solr ? POST http://locahost:8983/solr/product/update HTTP/1.1 Content-Type: text/xml <add> <doc> <field name="fieldname1">field valueA</field> <field name="fieldname2">field valueB</field> </doc </add>
  • 19. Leia mais http://lucene.apache.org/solr/ Ascii cast http://asciinema.org/a/6219 Caching http://wiki.apache.org/solr/SolrCaching Replication http://wiki.apache.org/solr/SolrReplication SpellChecker http://wiki.apache.org/solr/SpellCheckComponent Livro http://www.packtpub.com/apache-solr-4-cookbook/book http://blog.sematext.com/2012/08/23/solr-vs-elasticsearch-part-1-overview/ Ferramentas Solr Pecl - http://pecl.php.net/package/solr Solarium - http://www.solarium-project.org/ SolrBundle - https://github.com/floriansemm/SolrBundle