Your SlideShare is downloading. ×
What's new in Lucene and Solr 4.x
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

What's new in Lucene and Solr 4.x


Published on

Slides from my LinkedIn Tech Talk on what's new in Apache Lucene and Solr 4.x.

Slides from my LinkedIn Tech Talk on what's new in Apache Lucene and Solr 4.x.

Published in: Technology
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide
  • Search Abuse Can discuss how I started just doing free text, but then a curious thing happened, started to see people using the engine for things like: key/value, denormalized DBs, browsing engines, plagiarism detection, teaching languages, record linkage and much, much more
  • Search has added more DB features over the yearsTED: We need to introduce the idea of *REVOLUTION* somewhere in here.
  • Okapi BM25 & DFR divergence from randomness
  • Power users are often more likely to recoverTools for recovery:Auto-suggest, related searches, spelling suggestions
  • CharacteristicsConflicts from other clients
  • Power users are often more likely to recoverTools for recovery:Auto-suggest, related searches, spelling suggestions
  • Thanks, LinkedIn for sponsoring!
  • Transcript

    • 1. luceneSolr = new LuceneSolr(4.x) Grant Ingersoll CTO, LucidWorksConfidential © Copyright 2012
    • 2. Search is dead, long live search • Embrace fuzziness! • Search is a system building block • If the algorithms fit, use them! • Search use leads to search abuse - Denormalization frees your mind - Scoring is just a sparse matrix multiply • Scoring features are everywhere Confidential and Proprietary2 © 2012 LucidWorks
    • 3. Search (R)evolution• “T’ain’t your father’s search engine” - Non free text usages abound• NoSQL before NoSQL was cool - Many DB-like features• Flexibility during indexing and scoring• Finite State Transducers FTW!• ScaleConfidential and Proprietary© 2012 LucidWorks
    • 4. Agenda• What’s new In Lucene 4?• What’s new in Solr 4?• Sneak Peek: what’s ahead?Confidential and Proprietary© 2012 LucidWorks
    • 5. Lucene 4Confidential © Copyright 2012
    • 6. Up and to the Right • dexing.html Confidential and Proprietary6 © 2012 LucidWorks
    • 7. Lucene: Flexibility• Flexible Index Formats - New posting list codecs: Block, Simple Text, Append (HDFS..), etc - Pulsing codec: improves performance of primary key searches, inlining docs, positions, and payloads, saves disk seeks• Pluggable Scoring - Decoupled from TF/IDF - Built in alternatives include BM25 & DFR » » and Proprietary© 2012 LucidWorks
    • 8. Lucene: Speed and Memory• Native Near Real Time (NRT) support - Per segment - FieldCache can be controlled to only load new segments• Soft commit - Faster without fsync, allows quicker update visibility• DWPT (Document Writer per Thread) - Faster more consistent index speed• Faster fuzzy & wildcard query processing - Higher performance searching• String -> BytesRef - Much improved data structure - … means less memory and less garbage collection effortConfidential and Proprietary© 2012 LucidWorks
    • 9. BytesRef memory management improvements • On a Wikipedia index (11M documents) - Time to perform the first query with sorting (no warmup queries) Solr 3x: 13 seconds, Solr 4: 6 seconds. - Memory consumption Solr 3x: 1,040M, Solr 4: 366M. - Number of objects on the heap. Solr 3x: 19.4M, Solr 4: 80K. No, that’s not a typo. - solr-3x-and-trunk/ Confidential and Proprietary9 © 2012 LucidWorks
    • 10. FuzzyQuery • uzzy2.html Confidential and Proprietary10 © 2012 LucidWorks
    • 11. QPS (primary key lookup) • KLookup.html Confidential and Proprietary11 © 2012 LucidWorks
    • 12. Lucene: Features• Doc Values • DirectSpellChecker - Store data in column order - No more sidecar index! - Tradeoffs when using vs. • Geospatial improvements FieldCache (more later) - /02/fun-with-docvalues-in- solr-4-2/ - enerevolution/willnauer- simon-doc-values-column- stride-fields-in-luceneConfidential and Proprietary© 2012 LucidWorks
    • 13. Solr 4Confidential © Copyright 2012
    • 14. Solr 4: Features• Search/Faceting/Relevance - New Relevance Function Queries (tf, df, others) - Pivot Faceting - Pseudo-join - DirectSpellChecker support - Improved Spatial (more later)• Indexing - New Update Processors, including scripting option - NRT• Other - DocTransformer pluggability - New Admin UIConfidential and Proprietary© 2012 LucidWorks
    • 15. Geospatial improvements• Multiple values per field• Index shapes other than points (circles, polygons, etc)• More complex interactions than point in a circle• Indexing: - "geo”:”43.17614,-90.57341” - “geo”:”Circle(4.56,1.23 d=0.0710)” - “geo”:”POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30))”• Searching: - fq=geo:"Intersects(-74.093 41.042 -69.347 44.558)" - fq=geo:"Intersects(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30)))”Confidential and Proprietary© 2012 LucidWorks
    • 16. /solrConfidential and Proprietary© 2012 LucidWorks
    • 17. SolrCloud• Distributed/sharded indexing & search - Auto distributes updates and queries to appropriate shards - Near Real Time (NRT) indexing capable• Dynamically scalable - New SolrCloud instances add indexing and query capacity• Reliable - No single point of failure - Transactions logged - Robust, automatic recover• and Proprietary© 2012 LucidWorks
    • 18. Confidential and Proprietary18 © 2012 LucidWorks
    • 19. SolrCloud’s capabilities• Transaction log - All updates are added to the transaction log. The tlog provides support for: durability for updates that have not yet been committed, peer syncing, real-time get (retrieve documents by unique id) always up to date because it checks the tlog first, does not require opening a new searcher to see changes• Near Real Time (NRT) indexing - Soft commits make updates visible - Hard commits make updates durable• Durability - Updates to Solr may be in several different states: buffered in memory, flushed, but not committed or viewable, soft committed (flushed and viewable), committed (durable) - The transaction log ensures data is not lost in any of these states if Solr crashes.• Recovery - Solr uses the transaction log for recovery; on startup Solr checks to see if the tlog is in a committed state, if not updates since the last commit are applied• Optimistic locking - Solr maintains a document version (_version_ field); updates can now specify _version_; updates to incorrect version will failConfidential and Proprietary© 2012 LucidWorks
    • 20. SolrCloud details • “Leaders” and “replicas” - Leaders are automatically elected • Leaders are just a replica with some coordination responsibilities for the associated replicas • If a leader goes down, one of the associated replicas is elected as the new leader • New nodes are automatically assigned a shard and role, and replicate/recover as needed • SolrJ’s CloudSolrServer • Replication in Solr 4 - Used for new and recovering replicas - Or for traditional master/slave configuration Confidential and Proprietary20 © 2012 LucidWorks
    • 21. Solr as NoSQL• Characteristics - Non-traditional data stores - Not designed for SQL type queries - Distributed fault tolerant architecture - Document oriented, data format agnostic(JSON, XML, CSV, binary)• Updated durability via transaction log• Real-time /get fetches latest version w/o hard commit• Versioning and optimistic locking - w/ Real Time GET, allows read/write/update w/o conflicts• Atomic updates - Can add/remove/change and increment a field in existing doc w/o re-indexingConfidential and Proprietary© 2012 LucidWorks
    • 22. Distributed Key / Value Pair Database • Real-time Get combined with Solr Cloud make a very powerful key/value pair database - Durable (tlog) - Isolated (Optimistic locking) - Redundant (Solr Cloud Replicas) - Distributed & scalable (billions of keys, Solr Cloud Sharding) - Efficient Multi-tenant (Solr Cloud document routing, Solr 4.1) - Fast (milli-second response time, Pulsing Codec) - Real-time (tlog) Confidential and Proprietary22 © 2012 LucidWorks
    • 23. Routing • Allows you to route documents and queries to a subset of shards • Provides efficient multi-tenancy • Indexing: - A shard key can be prepended to the unique document id: shard_key!unique_id - Documents with the same shard_key will reside on the same shard. • Querying: shard.keys=shard_key1!... - Much more efficient then searching the entire collection. Confidential and Proprietary23 © 2012 LucidWorks
    • 24. Looking ahead• Automatic shard splitting• Query parsing: rich query tree control via JSON/XML• “Schemaless” - Marketing term meaning convention over configuration for fields• More programmatic control over system• Continually improving performance, scalability, and robustnessConfidential and Proprietary© 2012 LucidWorks
    • 25. • Want to learn more? • Join us in San Diego April 29 – May 2, 2013 • • Confidential and Proprietary25 © 2012 LucidWorks
    • 26. Resources• Lucene/Solr -• Me - @gsingers, -• Company - - - Products, Support, Training on and around Lucene and SolrConfidential and Proprietary© 2012 LucidWorks