Christian Meder & Andrew Kenworthy inovex Lucenes Welt Ordnen, finden, klassifizieren
Lucene's Welt: Ordnen, Finden, Klassifizieren JAX, 2012 Andrew Kenworthy Christian Meder inovex GmbH 19.04.2012 1
Speaker Andrew Kenworthy Schwerpunkte Business Intelligence Java Solr Hadoop andrew.kenworthy@inovex.de 19.04.2012 2
Speaker Christian Meder Schwerpunkte open source (free software) Linux Web Java Android CTO@inovex Christian Meder 19.04.2012 3
Agenda Motivation Beispiele Projektübersicht Projekte Möglichkeiten Bewertung 19.04.2012 4
Motivation 19.04.2012 5
Motivation Google klassisch (2010) 19.04.2012 6
Motivation Google klassisch (2010) Relevanz 19.04.2012 7
Motivation Google klassisch (2010) Snippets Autovervollstaendigung 19.04.2012 8
Motivation Google klassisch (2010) Antwortzeiten Spellchecker Aehnliche Seiten (More like this) 19.04.2012 9
Motivation Google Evolution (2011) 19.04.2012 10
Motivation Google Evolution (2011) Facetten Instant Search Vorschau 19.04.2012 11
Motivation Google Evolution (2011) 19.04.2012 12
Motivation Google Evolution (2011) Facetten 19.04.2012 13
Motivation Google Evolution (2012) SPYW 19.04.2012 14
Motivation Google Evolution (2012) SPYW 19.04.2012 15
Motivation Amazon 19.04.2012 16
Motivation usability.de Die Aussage eines Probanden bei einem Usability-Test einer Faceted Search Lösung im Rahmen dieser Studie ist damit richtungsweisend: Mit dem Filter hier habe ich das Gefühl, dass selbst eine schnöde Suche richtig Spaß machen kann. Quelle: Faceted Search: Die neue Suche im Usability-Test (zum kostenlosen Download unter http://usability.de) 19.04.2012 17
Motivation osscensus.org Rank Package Installs 1 firefox 3761 82% 2 zlib 3118 67% 3 wget 3000 65% 4 xerces 2494 54% 5 prototype 2450 53% 6 eclipse 2428 52% 7 c.-logging 2423 52% 8 docbook-xml 1692 52% 9 lucene 2394 52% 10 xalan 2363 51% 11 commons-lang 2349 51% 12 wsdl4j 2242 48% 13 tk 1557 48% 14 samba 1554 48% 15 activation 2175 47% 19.04.2012 18
Beispiele 19.04.2012 19
Beispiele Ebay Kleinanzeigen 19.04.2012 20
Beispiele Ebay Kleinanzeigen (aus Olaf Zschiedrich solr@ebay Kleinanzeigen) Site metrics: ~ 3.2 M active ads 16 24 M PVs per day Peak hours = 1.8 M PVs (~ 500 PVs per second) Solr request metrics: ~ 60 M requests per day Peak hours = ~ 1500 request per second Avg. response time 20 ms (search) and 3 ms for auto-suggest 19.04.2012 21
Beispiele Ebay Kleinanzeigen (aus Olaf Zschiedrich solr@ebay Kleinanzeigen) 2 datacenters 1 Master + 6 Slaves per datacenter Slaves show very low resource consumption. Could go down to 4 slaves per datacenter while still having 50% overcapacity Master only used for indexing Load balancer in front of slaves Varnish in front of slaves (for dedicated use cases) Working closely with SITE-OPS Team DEV-OPS are part of development process 19.04.2012 22
Beispiele ElasticSearch IGN's search 10 nodes / 2 clusters 56 M documents Scala over TCP PHP/JS over HTTP ~5k rpm 19.04.2012 23
Beispiele ElasticSearch Sonian Inc. Cloud electronic document search 20+ cluster 5 billion documents Index into 100s TB 19.04.2012 24
Projektuebersicht 19.04.2012 25
Projektübersicht Lucene Lucene: Suchbibliothek Solr: Suchserver Nutch: Crawler Tika: Inhaltsanalyse ElasticSearch (Compass): Suchserver Mahout: Machine Learning ManifoldCF: Repository Connectors (incubation) 19.04.2012 26
Projekte 19.04.2012 27
Architektur Indizierung Inhalte Bereitstellung Solr Aufbereitung Analyse Lucene Indizierung Index 19.04.2012 28
Projekte Lucene Information Retrieval Bibliothek Kern einer Sucharchitektur effizient skalierbar Viele Ports:.Net, C, Python Vielfach integriert in Produkte 19.04.2012 29
Historie Lucene 0.01 (2000) Doug Cutting 1.2 (2002) Apache Jakarta Projekt - 2.9 (2009) Sortieren, Datums- und Zahlenfelder, Bereichsfelder, near realtime search, neue Analyzer,... 3.0 (2009) cleanup release, deprecations 3.1-3.6 (2011/2012) performance, grouping, autocomplete Verbesserungen, facet, join,... 19.04.2012 30
Projekte Solr Enterprise Suchserver XML über HTTP skalierbar Adminoberfläche schema-basiert viele Analyse-Klassen Handler, Filter, Facetten 19.04.2012 31
Projekte Solr: Schema enthält Felder / Feldtypen Feldtypen mit unterschiedlichen Analysern dynamische Felder CopyField Konfigurierbare Textanalyse Listen von Synonymen, Stopp- Wörtern, etc. 19.04.2012 32
Projekte Solr: Schema, Beispiele Felder <field name="subject" type="string" indexed="true" stored="true" /> <field name="contactphotourl" type="string" indexed="false" stored="true" /> <field name="priceperhour" type="sfloat" indexed="true" stored="true" /> <field name="created" type="date" indexed="true" stored="true" /> <field name="subject" type="string" indexed="true" stored="true" multivalued="true" /> <field name="all_text" type="text" indexed="true" stored="false" /> <dynamicfield name="skills_*" type="text" indexed="true" stored="true" multivalued="true" /> <copyfield source="subject" dest="all_text" /> 19.04.2012 33
Projekte Solr: Features Markierte Treffer Spellchecker MoreLikeThis Dismax Query DataImportHandler: DB, XML,... Indexanalyse 19.04.2012 34
Historie Solr 2006 code donation von CNET 1.1: 17.1.2007 aus incubator zu lucene Subprojekt 1.2: 2.6.2007 spellcheck, sounds-like,... 1.3: 15.9.2008 verteiltes Suchen,... 1.4: 10.11.2009 db dataimporthandler,... 3.1 3.6 (2011/2012) geospatial support, grouping/collapsing,... 19.04.2012 35
Projekte Solr: Queries HTTP Interface mit verschiedenen Formaten (XML, JSON...) Mehrfachsortierung Auto Suggest Dismax query Snippets Spelling suggestions More Like This einfache Datumsberechnungen Function Query einfache Statistik (min, max,...) Facetten Suche (Filtern nach mehreren Facetten) 19.04.2012 36
Projekte Solr: Einfache Beispiele für q +goethe +schiller +goethe -schiller title:faust title:faust AND -all_text:goethe romeo and juliet water* water~ created:[1995-12-31t23:59:59.999z TO 2007-03-06T00:00:00Z] price:[20 TO 50] price:[100 TO *] 19.04.2012 37
Projekte Solr: Beispiele für Parameter sort=score asc sort=created asc sort=created asc, title asc start=10 rows=20 fl=* fl=id, title fl=*, score created:[now/day-1month TO NOW/DAY] fq=created:[now/day-2years TO NOW/DAY]&fq=all_text:poetry 19.04.2012 38
Projekte Nutch Web Crawler verteilt, parallel Erstellt gerichteten Graphen Multi-Format (HTML, PDF, Office, Tika,...) MapReduce, Hadoop Lucene oder Solr 19.04.2012 39
Projekte Tika Inhaltsanalyse Extrahiert Metadaten und strukturierte Inhalte nutzt existierende Parser große und wachsende Anzahl an Formaten weitere Parser einfach ergänzbar 19.04.2012 40
Projekte ElasticSearch nutzt Lucene Facetten, Typen,... elastic: sharding/replicas automatisch schemalos Vorgänger: Compass Framework 19.04.2012 41
Projekte Mahout Machine Learning Empfehlungen Clustering Classification Hadoop Zahlreiche Algorithmen 19.04.2012 42
Moeglichkeiten 19.04.2012 43
Möglichkeiten Beispiel 2009 19.04.2012 44
API 19.04.2012 45
Commit Options 19.04.2012 46
Concurrency 19.04.2012 47
Config org.apache.solr.common.solrexception: Error opening new searcher. exceeded limit of maxwarmingsearchers=2, try again later. request: http://localhost:8983/solr/update? commit=true&waitflush=true&waitsearcher=true&... at... In standard solr configuration: <maxwarmingsearchers>2</maxwarmingsearchers> 19.04.2012 48
Solr Wiki: "...every time a new index searcher is opened, some autowarming of the cache occurs before Solr hands queries over to that version of the collection. It is crucial to individual query latency that queries have warmed caches." Near-Real-Time (Lucene since 2.9, Solr/trunk, ElasticSearch) 19.04.2012 49
INDEX Belkin belkin QUERY Belkin belkin But... belk* belk 19.04.2012 50
MultiCore <solr persistent="false"> <cores adminpath="/admin/cores" defaultcorename="core0"> <core name="originalcore" instancedir="core0"> <property name="datadir" value="/data/core0" /> </core> <core name="newcore" instancedir="core1" > <property name="datadir" value="/data/core1" /> </core> </cores> </solr> 19.04.2012 51
Schema-less 19.04.2012 52
Distributed, Autosharding 19.04.2012 53
Multitenancy (cf Multicore) 19.04.2012 54
Lucene & Hadoop - Hadoop: parallel processing power - Lucene: dynamic, rapid search But... - HDFS: no random read/writes - Solr: distributed indexes So... - Index built in HDFS, export to local - HBase 19.04.2012 55
Bewertung The road ahead Solr: einfach, konfigurierbar, skalierbar, endnutzerfreundlich Lucene: lowlevel, komplexer, volle Flexibilität ElasticSearch: relativ neu, aber automatische Skalierung Mahout: komplex, mächtig, skalierbar 19.04.2012 56
Vielen Dank! 19.04.2012 57