Download - Introducción a Solr
![Page 1: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/1.jpg)
Introducción a
Solr
![Page 2: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/2.jpg)
¿Solr?
🔍 búsqueda
![Page 3: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/3.jpg)
¡Queremos buscar!
![Page 4: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/4.jpg)
SELECT ... FROM ... WHERE ... LIKE “%query%”
Primera solución
![Page 5: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/5.jpg)
20 minutos después …
![Page 6: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/6.jpg)
![Page 7: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/7.jpg)
No tan así ...
• lento con muchas tuplas •mayúsculas/minúsculas • longitud del campo •match parciales •análisis textuales
![Page 8: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/8.jpg)
1) la uci 2) bienvenido la uci 3) esta es la uci
Match parciales
query=“la uci”
query=“esta uci”
![Page 9: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/9.jpg)
Análisis textuales
ABCD123 ➜ [“ABCD”, “123”]
“la casa” ➜ [“casa”]
“drinking, learning” ➜ [“drink”, “learn”]
![Page 10: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/10.jpg)
No tan así ...• lento con muchas tuplas •mayúsculas/minúsculas • longitud del campo •match parciales •análisis textuales •¿relevancia?
![Page 11: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/11.jpg)
Características
![Page 12: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/12.jpg)
• servidor de indexación • comunica a través HTTP (REST) • soporta formatos XML y JSON • configuración vía ficheros • caché a diferentes niveles • basado en Lucene • orientado a documentos (NoSQL) • extensible • distribuido, escalable, etc.
![Page 13: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/13.jpg)
Lucene
![Page 14: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/14.jpg)
• librería de búsqueda full-text • muy utilizada y extendida • desarrollada desde el 2000 • pertenece a la Fundación Apache • open source
Lucene es...
y no es:• un servidor, crawler o un sistema
![Page 15: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/15.jpg)
Indice Invertido
correlación entre términos y los documentos donde aparece, posición relativa y frecuencia.
![Page 16: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/16.jpg)
Término Documentos
a doc1[2x]
brown doc2[1x],doc3[1x]
cat doc4[1x]
cow doc2[1x]
… …
once doc1[1x]
over doc2[1x]
the doc2[1x],doc3[1x] doc4[1x]
…
Documento Contenido
doc1 once upon a time, in a land
doc2 the brown cow jumped over...
doc3 the quick brown fox…
doc4 the cat in the hat
Indice Invertido
además se guarda la posición del término en el documento
![Page 17: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/17.jpg)
• Documento: Cualquier fragmento de información enviado a Solr.
• Campo: Unidad lógica que compone a los documentos (columnas en un SGBD).
• Término: Es la unidad básica que compone cada campo de un documento.
Conceptos Fundamentales
![Page 18: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/18.jpg)
¡Queremos buscar!
![Page 19: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/19.jpg)
Funcionamiento de SolrWeb
secundario📸
![Page 20: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/20.jpg)
Nutch ♥ Solr
![Page 21: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/21.jpg)
spider
BD
Web
![Page 22: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/22.jpg)
Instalando Solr
![Page 23: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/23.jpg)
JARs con funciones adicionales
JARs de Solr, SolrJ (cliente Java)
ejemplos de configuraciones
directorio “home” para el ejemplo
distribución standard
![Page 24: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/24.jpg)
nombre del core/colección
subdirectorio de configuración
subdirectorio de datos
esquema (estructura)configuración principal de un core
Estructura de una colección
![Page 25: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/25.jpg)
➜ cd /path/a/solr/example ➜ java -jar start.jar
Iniciando Solr
⌨ Ctrl+C# para detener el servidor
![Page 26: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/26.jpg)
puerto en el que se inició Solr
![Page 27: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/27.jpg)
http://localhost:8983/solr
![Page 28: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/28.jpg)
Interfaz Web de Solr
![Page 29: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/29.jpg)
➜ cd exampledocs/ ➜ java -jar post.jar *.xml
Añadiendo documentos
![Page 30: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/30.jpg)
http://localhost:8983/solr/select?q=*:*
Endpoint REST
Todos los documentos
![Page 31: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/31.jpg)
![Page 32: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/32.jpg)
Respuesta de Solr
![Page 33: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/33.jpg)
<response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">1</int> </lst> <result name="response" numFound="32"> <doc> <str name="id">belkin</str> <arr name="compName_s"> <str>Belkin</str> </arr> <arr name="address_s"> <str>12045 E. Waterfront Drive</str> </arr> </doc> </result> </response>
XML
![Page 34: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/34.jpg)
<doc> <str name="id">belkin</str> <arr name="compName_s"> <str>Belkin</str> </arr> <arr name="address_s"> <str> 12045 E. Waterfront Drive </str> </arr> </doc>
<doc></doc>
![Page 35: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/35.jpg)
{ "responseHeader":{ "status":0, "QTime":15}, "response":{ "numFound":32, "docs":[ { "id":"belkin", "compName_s":["Belkin"], "address_s":["12045 E. Waterfront Drive Playa Vista, CA 90094"] } ] } }
JSON
![Page 36: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/36.jpg)
Bibliografía adicional
![Page 37: Introducción a Solr](https://reader035.vdocuments.co/reader035/viewer/2022062313/55b816e2bb61eb731c8b467d/html5/thumbnails/37.jpg)
http://sunshine.prod.uci.cu/search/solr