SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
SOLR Introduction




                Lucence / SOLR




1
SOLR Introduction



       Why do we need a Search Engine ?
       What is Lucene/SOLR ?
       Advantages of SOLR
       SOLR Architecture
       Query Syntax
       Working with SOLR: Feed data, query data
       SOLR installation
       SOLR configuration




2
Why do we need a Search Engine ?



    Google, Bing, Yahoo, …                 Database



                                  Yes, that’s normal way
     Can not access to our data
                                  The problem is response time




                   Need a Search Engine:
                       Lucene / SOLR
3
What is Lucene/SOLR ?

    Lucene
       Apache Lucene is a free/open source information retrieval
        software library.
       Lucene is just an indexing and search library
       Lucene supports: Java, Delphi, Perl, C#, C++, Python, Ruby, and
        PHP




4
What is Lucene/SOLR ?

    Solr
       Solr is wrapper of Lucene for Java
       Solr is a web application (WAR) which can be deployed in any
        servlet container, e.g. Jetty, Tomcat
       Solr is a REST service




5
SOLR Introduction

    Advantages of SOLR
       Open source/free
       Administration Interface
       Rich Document Parsing and Indexing (PDF, Word, HTML, etc)
       Full-Text Search
       Faceted Search and Filtering
       Multi Server support

    The comparison of Search Engines:
    http://blog.sematext.com/2012/08/23/solr-vs-elasticsearch-part-1-
    overview/




6
SOLR architecture




7
SOLR Shard




8
Query Syntax

    Keyword matching
    title:foo - Search for word "foo" in the title field.

    title:"foo bar” - Search for phrase "foo bar" in the title field.

    -title:bar - Search everything, except "bar" in the title field.




9
Query Syntax

     Wildcard matching
     title:foo* - Search for any word that starts with "foo" in the title field.

     title:foo*bar - Search for any word that starts with "foo" and ends with
     bar in the title field.

     *:* - Search every thing




10
Query Syntax

     Proximity matching
     "foo bar"~number

     Number = 0, exactly match
     Number = 1, The result may be “bar foo”




11
Query Syntax

     Range searches
     field:[a TO z] - Search the field has value in range [a->z]

     field:[* TO 100] - Search all values less than or equal to 100

     field:[100 TO *] - Search all values greater than or equal to 100

     field:[* TO *] - Matches all documents with the field




12
Query Syntax

     Nested query
     _query_:”field:*lap” OR _query_:”field:*tran”

     _query_:”{!dismax qf=somefield} cat dog”




13
Query Syntax




     Join
     {!join from=inner-id to=outer-id}zzz:vvv

     SQL
     SELECT xxx, yyy FROM collection1
     WHERE outer-id IN (
     SELECT inner-id FROM collection1 where zzz = "vvv")




14
Query Syntax

     Faceted Search
     q=inStock:true&facet=true&facet.field=cat&facet.limit=5
     <response>
     <responseHeader><status>0</status><QTime>4</QTime></responseHeader>
     <result numFound="12" start="0"/>
     <lst name="facet_counts">
     <lst name="facet_queries"/>
     <lst name="facet_fields">
      <lst name="cat">
          <int name="electronics">10</int>
          <int name="memory">3</int>
          <int name="drive">2</int>
          <int name="hard">2</int>
          <int name="monitor">2</int>
      </lst>
     </lst>
     </lst>
     </response>


15
SolrJ

     Feed data
     // make a connection to Solr server
     SolrServer server = new HttpSolrServer("http://localhost:8080/solr/");
     // prepare a doc
     final SolrInputDocument doc1 = new SolrInputDocument();
     doc1.addField("id", 1);
     doc1.addField("firstName", "First Name");
     doc1.addField("lastName", "Last Name");
     final Collection<SolrInputDocument> docs = new
     ArrayList<SolrInputDocument>();
     docs.add(doc1);
     // add docs to Solr
     server.add(docs);
     server.commit();


16
SolrJ

     Query data
     final SolrQuery query = new SolrQuery();
     query.setQuery("*:*");
     query.addSortField("firstName", SolrQuery.ORDER.asc);
     final QueryResponse rsp = server.query(query);
     final SolrDocumentList solrDocumentList = rsp.getResults();
     for (final SolrDocument doc : solrDocumentList) {
               final String firstName = (String)
     doc.getFieldValue("firstName");
               final String id = (String) doc.getFieldValue("id");
     }




17
SOLR Introduction

     SOLR installation
     Ref:
     http://wiki.apache.org/solr/SolrInstall
     http://wiki.apache.org/solr/SolrTomcat
     http://lucene.apache.org/solr/4_ 1/tutorial.html
                                      2_

     Prerequisite:
     Tomcat (7) http://tomcat.apache.org/
     JDK 1.6
     SOLR 4.2.1 http://lucene.apache.org/solr/




18
SOLR Introduction


• Extract solr-4.2.1.zip to (D:Projectsolr_websolr-4.2.1)
• Copy resourcesolr-4.2.1examplessolr to D:Projectsolr_websolr = SOLR_HOME
• Copy resourcesolr-4.2.1distsolr-4.2.1.war to SOLR_HOME and rename to solr.war
• Open the SOLR_HOMEcollection1confsolrconfig.xml and modify the <dataDir>
          <dataDir>${solr.data.dir:D:/Project/sorl_web/solr/collection1/data}</dataDir>
• Create a Tomcat Context (solr.xml) file like this:
<?xml version="1.0" encoding="utf-8"?>
   <Context docBase="D:/Project/solr_web/solr/solr.war" debug="0“
crossContext="true">
   <Environment name="solr/home" type="java.lang.String"
value="D:/Project/solr_web/solr" override="true"/>
</Context>
• Copy this file (solr.xml) to tomcat.7.0.35confCatalinalocalhost
• Start Tomcat
• Open the SOLR dashboard with address: http://localhost:8080/sorl/#/


19
SOLR Introduction

     SOLR Configuration
     Ref:
     http://wiki.apache.org/solr/SolrConfigXml
     http://wiki.apache.org/solr/SchemaXml

     In the configuration of a Solr server, we need at least 2 xml files:
     solrconfig.xml and schema.xml

     Solrconfig.xml: contains the common configuration of a Core: size of
     memory, data path, transaction, …

     Schema.xml: contains the definitions of data: structure, data type,
     fields name …



20
SOLR Introduction

     SOLR Configuration
     Schema.xml

     field : a field will be indexed by solr
     <field name="firstName" type="string" indexed="true" stored="true"/>

     dynamicField: like a field but the name is not specified yet
     <dynamicField name="*_i" type="int" indexed="true"
     stored="true"/>

     name="*_i" will match any field ending in _i (like myid_i, z_i)




21

Más contenido relacionado

La actualidad más candente

Using Apache Solr
Using Apache SolrUsing Apache Solr
Using Apache Solrpittaya
 
Apache Solr crash course
Apache Solr crash courseApache Solr crash course
Apache Solr crash courseTommaso Teofili
 
Andrzej bialecki lr-2013-dublin
Andrzej bialecki lr-2013-dublinAndrzej bialecki lr-2013-dublin
Andrzej bialecki lr-2013-dublinlucenerevolution
 
Enterprise Search Solution: Apache SOLR. What's available and why it's so cool
Enterprise Search Solution: Apache SOLR. What's available and why it's so coolEnterprise Search Solution: Apache SOLR. What's available and why it's so cool
Enterprise Search Solution: Apache SOLR. What's available and why it's so coolEcommerce Solution Provider SysIQ
 
Building Intelligent Search Applications with Apache Solr and PHP5
Building Intelligent Search Applications with Apache Solr and PHP5Building Intelligent Search Applications with Apache Solr and PHP5
Building Intelligent Search Applications with Apache Solr and PHP5israelekpo
 
Integrating the Solr search engine
Integrating the Solr search engineIntegrating the Solr search engine
Integrating the Solr search engineth0masr
 
Lucene's Latest (for Libraries)
Lucene's Latest (for Libraries)Lucene's Latest (for Libraries)
Lucene's Latest (for Libraries)Erik Hatcher
 
Introduction Apache Solr & PHP
Introduction Apache Solr & PHPIntroduction Apache Solr & PHP
Introduction Apache Solr & PHPHiraq Citra M
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with SolrErik Hatcher
 
20130310 solr tuorial
20130310 solr tuorial20130310 solr tuorial
20130310 solr tuorialChris Huang
 
Introduction to Apache Solr.
Introduction to Apache Solr.Introduction to Apache Solr.
Introduction to Apache Solr.ashish0x90
 
Beyond full-text searches with Lucene and Solr
Beyond full-text searches with Lucene and SolrBeyond full-text searches with Lucene and Solr
Beyond full-text searches with Lucene and SolrBertrand Delacretaz
 
Introduction to Solr
Introduction to SolrIntroduction to Solr
Introduction to SolrJayesh Bhoyar
 
Solr Black Belt Pre-conference
Solr Black Belt Pre-conferenceSolr Black Belt Pre-conference
Solr Black Belt Pre-conferenceErik Hatcher
 

La actualidad más candente (20)

Apache Solr Workshop
Apache Solr WorkshopApache Solr Workshop
Apache Solr Workshop
 
Using Apache Solr
Using Apache SolrUsing Apache Solr
Using Apache Solr
 
Apache Solr crash course
Apache Solr crash courseApache Solr crash course
Apache Solr crash course
 
Andrzej bialecki lr-2013-dublin
Andrzej bialecki lr-2013-dublinAndrzej bialecki lr-2013-dublin
Andrzej bialecki lr-2013-dublin
 
Introduction to Apache Solr
Introduction to Apache SolrIntroduction to Apache Solr
Introduction to Apache Solr
 
Enterprise Search Solution: Apache SOLR. What's available and why it's so cool
Enterprise Search Solution: Apache SOLR. What's available and why it's so coolEnterprise Search Solution: Apache SOLR. What's available and why it's so cool
Enterprise Search Solution: Apache SOLR. What's available and why it's so cool
 
Building Intelligent Search Applications with Apache Solr and PHP5
Building Intelligent Search Applications with Apache Solr and PHP5Building Intelligent Search Applications with Apache Solr and PHP5
Building Intelligent Search Applications with Apache Solr and PHP5
 
Integrating the Solr search engine
Integrating the Solr search engineIntegrating the Solr search engine
Integrating the Solr search engine
 
Lucene's Latest (for Libraries)
Lucene's Latest (for Libraries)Lucene's Latest (for Libraries)
Lucene's Latest (for Libraries)
 
Introduction Apache Solr & PHP
Introduction Apache Solr & PHPIntroduction Apache Solr & PHP
Introduction Apache Solr & PHP
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with Solr
 
20130310 solr tuorial
20130310 solr tuorial20130310 solr tuorial
20130310 solr tuorial
 
Introduction to Apache Solr.
Introduction to Apache Solr.Introduction to Apache Solr.
Introduction to Apache Solr.
 
Beyond full-text searches with Lucene and Solr
Beyond full-text searches with Lucene and SolrBeyond full-text searches with Lucene and Solr
Beyond full-text searches with Lucene and Solr
 
Apache Solr
Apache SolrApache Solr
Apache Solr
 
Introduction to Solr
Introduction to SolrIntroduction to Solr
Introduction to Solr
 
Building a Search Engine Using Lucene
Building a Search Engine Using LuceneBuilding a Search Engine Using Lucene
Building a Search Engine Using Lucene
 
Solr Black Belt Pre-conference
Solr Black Belt Pre-conferenceSolr Black Belt Pre-conference
Solr Black Belt Pre-conference
 
Solr Masterclass Bangkok, June 2014
Solr Masterclass Bangkok, June 2014Solr Masterclass Bangkok, June 2014
Solr Masterclass Bangkok, June 2014
 
Solr Presentation
Solr PresentationSolr Presentation
Solr Presentation
 

Similar a Solr introduction

Solr search engine with multiple table relation
Solr search engine with multiple table relationSolr search engine with multiple table relation
Solr search engine with multiple table relationJay Bharat
 
Hortonworks Technical Workshop - HDP Search
Hortonworks Technical Workshop - HDP Search Hortonworks Technical Workshop - HDP Search
Hortonworks Technical Workshop - HDP Search Hortonworks
 
Apache Solr + ajax solr
Apache Solr + ajax solrApache Solr + ajax solr
Apache Solr + ajax solrNet7
 
Dev8d Apache Solr Tutorial
Dev8d Apache Solr TutorialDev8d Apache Solr Tutorial
Dev8d Apache Solr TutorialSourcesense
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with SolrErik Hatcher
 
Lucene Introduction
Lucene IntroductionLucene Introduction
Lucene Introductionotisg
 
Solr Powered Lucene
Solr Powered LuceneSolr Powered Lucene
Solr Powered LuceneErik Hatcher
 
20150210 solr introdution
20150210 solr introdution20150210 solr introdution
20150210 solr introdutionXuan-Chao Huang
 
Lifecycle of a Solr Search Request - Chris "Hoss" Hostetter, Lucidworks
Lifecycle of a Solr Search Request - Chris "Hoss" Hostetter, LucidworksLifecycle of a Solr Search Request - Chris "Hoss" Hostetter, Lucidworks
Lifecycle of a Solr Search Request - Chris "Hoss" Hostetter, LucidworksLucidworks
 
Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)
Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)
Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)Kai Chan
 
Oslo Solr MeetUp March 2012 - Solr4 alpha
Oslo Solr MeetUp March 2012 - Solr4 alphaOslo Solr MeetUp March 2012 - Solr4 alpha
Oslo Solr MeetUp March 2012 - Solr4 alphaCominvent AS
 
Enterprise search in_drupal_pub
Enterprise search in_drupal_pubEnterprise search in_drupal_pub
Enterprise search in_drupal_pubdstuartnz
 
"Solr Update" at code4lib '13 - Chicago
"Solr Update" at code4lib '13 - Chicago"Solr Update" at code4lib '13 - Chicago
"Solr Update" at code4lib '13 - ChicagoErik Hatcher
 
Solr中国8月4日答疑交流v2
Solr中国8月4日答疑交流v2Solr中国8月4日答疑交流v2
Solr中国8月4日答疑交流v2longkeyy
 
New-Age Search through Apache Solr
New-Age Search through Apache SolrNew-Age Search through Apache Solr
New-Age Search through Apache SolrEdureka!
 
Solr Application Development Tutorial
Solr Application Development TutorialSolr Application Development Tutorial
Solr Application Development TutorialErik Hatcher
 
Tutorial on developing a Solr search component plugin
Tutorial on developing a Solr search component pluginTutorial on developing a Solr search component plugin
Tutorial on developing a Solr search component pluginsearchbox-com
 

Similar a Solr introduction (20)

Solr search engine with multiple table relation
Solr search engine with multiple table relationSolr search engine with multiple table relation
Solr search engine with multiple table relation
 
Hortonworks Technical Workshop - HDP Search
Hortonworks Technical Workshop - HDP Search Hortonworks Technical Workshop - HDP Search
Hortonworks Technical Workshop - HDP Search
 
Apache Solr + ajax solr
Apache Solr + ajax solrApache Solr + ajax solr
Apache Solr + ajax solr
 
Dev8d Apache Solr Tutorial
Dev8d Apache Solr TutorialDev8d Apache Solr Tutorial
Dev8d Apache Solr Tutorial
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with Solr
 
Lucene Introduction
Lucene IntroductionLucene Introduction
Lucene Introduction
 
Solr Powered Lucene
Solr Powered LuceneSolr Powered Lucene
Solr Powered Lucene
 
20150210 solr introdution
20150210 solr introdution20150210 solr introdution
20150210 solr introdution
 
Lifecycle of a Solr Search Request - Chris "Hoss" Hostetter, Lucidworks
Lifecycle of a Solr Search Request - Chris "Hoss" Hostetter, LucidworksLifecycle of a Solr Search Request - Chris "Hoss" Hostetter, Lucidworks
Lifecycle of a Solr Search Request - Chris "Hoss" Hostetter, Lucidworks
 
Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)
Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)
Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)
 
Oslo Solr MeetUp March 2012 - Solr4 alpha
Oslo Solr MeetUp March 2012 - Solr4 alphaOslo Solr MeetUp March 2012 - Solr4 alpha
Oslo Solr MeetUp March 2012 - Solr4 alpha
 
Enterprise search in_drupal_pub
Enterprise search in_drupal_pubEnterprise search in_drupal_pub
Enterprise search in_drupal_pub
 
"Solr Update" at code4lib '13 - Chicago
"Solr Update" at code4lib '13 - Chicago"Solr Update" at code4lib '13 - Chicago
"Solr Update" at code4lib '13 - Chicago
 
Apache solr liferay
Apache solr liferayApache solr liferay
Apache solr liferay
 
Apache solr
Apache solrApache solr
Apache solr
 
Solr 3.1 and beyond
Solr 3.1 and beyondSolr 3.1 and beyond
Solr 3.1 and beyond
 
Solr中国8月4日答疑交流v2
Solr中国8月4日答疑交流v2Solr中国8月4日答疑交流v2
Solr中国8月4日答疑交流v2
 
New-Age Search through Apache Solr
New-Age Search through Apache SolrNew-Age Search through Apache Solr
New-Age Search through Apache Solr
 
Solr Application Development Tutorial
Solr Application Development TutorialSolr Application Development Tutorial
Solr Application Development Tutorial
 
Tutorial on developing a Solr search component plugin
Tutorial on developing a Solr search component pluginTutorial on developing a Solr search component plugin
Tutorial on developing a Solr search component plugin
 

Último

Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 

Último (20)

Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 

Solr introduction

  • 1. SOLR Introduction Lucence / SOLR 1
  • 2. SOLR Introduction  Why do we need a Search Engine ?  What is Lucene/SOLR ?  Advantages of SOLR  SOLR Architecture  Query Syntax  Working with SOLR: Feed data, query data  SOLR installation  SOLR configuration 2
  • 3. Why do we need a Search Engine ? Google, Bing, Yahoo, … Database Yes, that’s normal way Can not access to our data The problem is response time Need a Search Engine: Lucene / SOLR 3
  • 4. What is Lucene/SOLR ? Lucene  Apache Lucene is a free/open source information retrieval software library.  Lucene is just an indexing and search library  Lucene supports: Java, Delphi, Perl, C#, C++, Python, Ruby, and PHP 4
  • 5. What is Lucene/SOLR ? Solr  Solr is wrapper of Lucene for Java  Solr is a web application (WAR) which can be deployed in any servlet container, e.g. Jetty, Tomcat  Solr is a REST service 5
  • 6. SOLR Introduction Advantages of SOLR  Open source/free  Administration Interface  Rich Document Parsing and Indexing (PDF, Word, HTML, etc)  Full-Text Search  Faceted Search and Filtering  Multi Server support The comparison of Search Engines: http://blog.sematext.com/2012/08/23/solr-vs-elasticsearch-part-1- overview/ 6
  • 9. Query Syntax Keyword matching title:foo - Search for word "foo" in the title field. title:"foo bar” - Search for phrase "foo bar" in the title field. -title:bar - Search everything, except "bar" in the title field. 9
  • 10. Query Syntax Wildcard matching title:foo* - Search for any word that starts with "foo" in the title field. title:foo*bar - Search for any word that starts with "foo" and ends with bar in the title field. *:* - Search every thing 10
  • 11. Query Syntax Proximity matching "foo bar"~number Number = 0, exactly match Number = 1, The result may be “bar foo” 11
  • 12. Query Syntax Range searches field:[a TO z] - Search the field has value in range [a->z] field:[* TO 100] - Search all values less than or equal to 100 field:[100 TO *] - Search all values greater than or equal to 100 field:[* TO *] - Matches all documents with the field 12
  • 13. Query Syntax Nested query _query_:”field:*lap” OR _query_:”field:*tran” _query_:”{!dismax qf=somefield} cat dog” 13
  • 14. Query Syntax Join {!join from=inner-id to=outer-id}zzz:vvv SQL SELECT xxx, yyy FROM collection1 WHERE outer-id IN ( SELECT inner-id FROM collection1 where zzz = "vvv") 14
  • 15. Query Syntax Faceted Search q=inStock:true&facet=true&facet.field=cat&facet.limit=5 <response> <responseHeader><status>0</status><QTime>4</QTime></responseHeader> <result numFound="12" start="0"/> <lst name="facet_counts"> <lst name="facet_queries"/> <lst name="facet_fields"> <lst name="cat"> <int name="electronics">10</int> <int name="memory">3</int> <int name="drive">2</int> <int name="hard">2</int> <int name="monitor">2</int> </lst> </lst> </lst> </response> 15
  • 16. SolrJ Feed data // make a connection to Solr server SolrServer server = new HttpSolrServer("http://localhost:8080/solr/"); // prepare a doc final SolrInputDocument doc1 = new SolrInputDocument(); doc1.addField("id", 1); doc1.addField("firstName", "First Name"); doc1.addField("lastName", "Last Name"); final Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>(); docs.add(doc1); // add docs to Solr server.add(docs); server.commit(); 16
  • 17. SolrJ Query data final SolrQuery query = new SolrQuery(); query.setQuery("*:*"); query.addSortField("firstName", SolrQuery.ORDER.asc); final QueryResponse rsp = server.query(query); final SolrDocumentList solrDocumentList = rsp.getResults(); for (final SolrDocument doc : solrDocumentList) { final String firstName = (String) doc.getFieldValue("firstName"); final String id = (String) doc.getFieldValue("id"); } 17
  • 18. SOLR Introduction SOLR installation Ref: http://wiki.apache.org/solr/SolrInstall http://wiki.apache.org/solr/SolrTomcat http://lucene.apache.org/solr/4_ 1/tutorial.html 2_ Prerequisite: Tomcat (7) http://tomcat.apache.org/ JDK 1.6 SOLR 4.2.1 http://lucene.apache.org/solr/ 18
  • 19. SOLR Introduction • Extract solr-4.2.1.zip to (D:Projectsolr_websolr-4.2.1) • Copy resourcesolr-4.2.1examplessolr to D:Projectsolr_websolr = SOLR_HOME • Copy resourcesolr-4.2.1distsolr-4.2.1.war to SOLR_HOME and rename to solr.war • Open the SOLR_HOMEcollection1confsolrconfig.xml and modify the <dataDir> <dataDir>${solr.data.dir:D:/Project/sorl_web/solr/collection1/data}</dataDir> • Create a Tomcat Context (solr.xml) file like this: <?xml version="1.0" encoding="utf-8"?> <Context docBase="D:/Project/solr_web/solr/solr.war" debug="0“ crossContext="true"> <Environment name="solr/home" type="java.lang.String" value="D:/Project/solr_web/solr" override="true"/> </Context> • Copy this file (solr.xml) to tomcat.7.0.35confCatalinalocalhost • Start Tomcat • Open the SOLR dashboard with address: http://localhost:8080/sorl/#/ 19
  • 20. SOLR Introduction SOLR Configuration Ref: http://wiki.apache.org/solr/SolrConfigXml http://wiki.apache.org/solr/SchemaXml In the configuration of a Solr server, we need at least 2 xml files: solrconfig.xml and schema.xml Solrconfig.xml: contains the common configuration of a Core: size of memory, data path, transaction, … Schema.xml: contains the definitions of data: structure, data type, fields name … 20
  • 21. SOLR Introduction SOLR Configuration Schema.xml field : a field will be indexed by solr <field name="firstName" type="string" indexed="true" stored="true"/> dynamicField: like a field but the name is not specified yet <dynamicField name="*_i" type="int" indexed="true" stored="true"/> name="*_i" will match any field ending in _i (like myid_i, z_i) 21

Notas del editor

  1. http://www.solrtutorial.com/
  2. Full-Text Search: In text retrieval, full-text search refers to techniques for searching a single computer-stored document or a collection in a full-text database. Full-text search is distinguished from searches based on metadata or on parts of the original texts represented in databases (such as titles, abstracts, selected sections, or bibliographical references).In a full-text search, the search engine examines all of the words in every stored document as it tries to match search criteria (text specified by a user) Faceted Search: Faceted search is the dynamic clustering of items or search results into categories that let users drill into search results (or even skip searching entirely) by any value in any field. Each facet displayed also shows the number of hits within the search that match that category. Users can then “drill down” by applying specific contstraints to the search results. Faceted search is also called faceted browsing, faceted navigation, guided navigation and sometimes parametric search. Faceted search provides an effective way to allow users to refine search results, continually drilling down until the desired items are found. Example for Faceted Search: A computer selling page, normally, we have a panel to select the manufactory of computer (sony, ibm, …) the we search the appropriate product. In faceted search concept, we do an opposite thing, from a query, we show the suitable manufactory, then user can continue the searching based on current result.Ref: http://searchhub.org/2009/09/02/faceted-search-with-solr/