SlideShare a Scribd company logo
Searching
Agenda
 Search Engine
 Lucene Java
 Features
 Code Example
 Scalability
 Solr
 Nutch
About Speaker
 Abhiram Gandhe
 9+ Years Experience on Java/J2EE platform
 Consultant eCommerce Architect with Delivery Cube
 Pursuing PhD from VNIT Nagpur on Link Prediction on
Graph Databases
 M.Tech. (Comp. Sci. & Engg.) MNNIT Allahabad, B.E.
(Comp. Tech.) YCCE Nagpur
 …
What is a Search Engine?
 Answer: A software that
 Builds an index on text
 Answers queries using the index
“But we have database already for that…”
 A Search Engine offers
 Scalability
 Relevance Ranking
 Integrates different data sources (email, web
pages, files, databases, …)
 Works on words not substrings
 auto !=automatic, automobile
 Indexing Process:
 Convert document
 Extract text and meta data
 Normalize text
 Write (inverted) index
 Example:
 Document 1: Apache Lucene at JUGNagpur
 Document 2: JUGNagpur conference
What is Apache Lucene?
“Apache Lucene is a high-
performance, full- featured text search
engine library written entirely in Java”
- from http://lucene.apache.org/
What is Apache Lucene?
 Lucene is specifically an API, not an application.
 Hard parts have been done, easy programming has
been left to you.
 You can build a search application that is specifically
suited to your needs.
 You can use Lucene to provide consistent full-text
indexing across both database objects and documents
in various formats (Microsoft Office
documents, PDF, HTML, text, emails and so on).
Availability
 Freely Available (no cost)
 Open Source
 Apache License, version 2.0
 http://www.apache.org/licenses/LICENSE-2.0
 Download from:
 http://www.apache.org/dyn/closer.cgi/lucene/java/
Apache Lucene Overview
 The Apache LuceneTM project develops open-source search
software, including:
 Lucene Core, our flagship sub-project, provides Java-based
indexing and search technology, as well as spellchecking, hit
highlighting and advanced analysis/tokenization capabilities.
 SolrTM is a high performance search server built using Lucene
Core, with XML/HTTP and JSON/Python/Ruby APIs, hit
highlighting, faceted search, caching, replication, and a web
admin interface.
 Open Relevance Project is a subproject with the aim of collecting
and distributing free materials for relevance testing and
performance.
 PyLucene is a Python port of the Core project.
Lucene Java Features
 Powerful Query Syntax
 Create queries from user input or programmatically
 Ranked Search
 Flexible Queries
 Phrases, wildcard, etc.
 Field Specific Queries
 eg. Title, artist, album
 Fast indexing
 Fast searching
 Sorting by relevance or other
 Large and active community
 Apache License 2.0
Lucene Query Example
 JUGNagpur
 JUGNagpur AND Lucene  +JUGNagpur +Lucene
 JUGNagpur OR Lucene
 JUGNagpur NOT PHP  +JUGNagpur -PHP
 “Java Conference”
 Title: Lucene
 J?GNagpur
 JUG*
 schmidt~  schmidt, schmit, schmitt
 price: [100 TO 500]
Index
For this
Demo, we'r
e going to
create an in-
memory
index from
some
strings.
StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_40);
Directory index = new RAMDirectory();
IndexWriterConfig config = new
IndexWriterConfig(Version.LUCENE_40, analyzer);
IndexWriter w = new IndexWriter(index, config);
addDoc(w, "Lucene in Action", "193398817");
addDoc(w, "Lucene for Dummies", "55320055Z");
addDoc(w, "Managing Gigabytes", "55063554A");
addDoc(w, "The Art of Computer Science", "9900333X");
w.close();
Index...
addDoc() is
what
actually
adds
documents
to the index
private static void addDoc(IndexWriter w, String title, String isbn) throws
IOException {
Document doc = new Document();
doc.add(new TextField("title", title, Field.Store.YES));
doc.add(new StringField("isbn", isbn, Field.Store.YES));
w.addDocument(doc);
}
Note the use of TextField for content we want tokenized,
and StringField for id fields and the like, which we don't
want tokenized.
Query
We read the
query from
stdin, parse
it and build
a lucene
Query out
of it.
String querystr = args.length > 0 ? args[0] : "lucene";
Query q = new
QueryParser(Version.LUCENE_40, "title", analyzer).parse(queryst
r);
Search
Using the
Query we
create a
Searcher to
search the
index.
Then a
TopScoreDocC
ollector is
instantiated to
collect the top
10 scoring hits.
int hitsPerPage = 10;
IndexReader reader = IndexReader.open(index);
IndexSearcher searcher = new IndexSearcher(reader);
TopScoreDocCollector collector = TopScoreDocCollector.create(hitsPerPage,
true);
searcher.search(q, collector);
ScoreDoc[] hits = collector.topDocs().scoreDocs;
Display
Now that we
have results
from our
search, we
display the
results to
the user.
System.out.println("Found " + hits.length + " hits.");
for(int i=0;i<hits.length;++i) {
int docId = hits[i].doc;
Document d = searcher.doc(docId);
System.out.println((i + 1) + ". " + d.get("isbn") + "t" +
d.get("title"));
}
Apache lucene
Everything is a Document
 A document can represent anything textual:
 Word Document
 DVD (the textual metadata only)
 Website Member (name, ID, etc...)
 A Lucene Document need not refer to an actual file on a
disk, it could also resemble a row in a relational database.
 Each developer is responsible for turning their own data
sets into Lucene Documents. Lucene comes with a number
of 3rd party contributions, including examples for parsing
structured data files such as XML documents and Word
files.
Indexes
 The type of index used in Lucene and other full- text
search engines is sometimes also called an “inverted
index”.
 Indexes track term frequencies
 Every term maps back to a Document
 This index is what allows Lucene to quickly locate
every document currently associated with a given set
up input search terms.
Basic Indexing
 An index consists of one or more Lucene Documents
 1. Create a Document
 A document consists of one or more Fields: name-value pair
 Example: a Field commonly found in applications is title. In the case of a title Field, the field name is
title and the value is the title of that content item.
 Add one or more Fields to the Document
 2. Add the Document to an Index
 Indexing involves adding Documents to an IndexWriter
 3. Indexer will Analyze the Document
 We can provide specialized Analyzers such as StandardAnalyzer
 Analyzers control how the text is broken into terms which are then used to index the document:
 Analyzers can be used to remove stop words, perform stemming
Lucene comes with a default Analyzer which works well for unstructured English
text, however it often performs incorrect normalizations on non-English texts. Lucene
makes it easy to build custom Analyzers, and provides a number of helpful building
blocks with which to build your own. Lucene even includes a number of “stemming”
algorithms for various languages, which can improve document retrieval accuracy
whenthe source language is known at indexing time.
Basic Searching
 Searching requires an index to have already been built.
 Create a Query
 E.g. Usually via QueryParser, MultiPhraseQuery, etc. That parses user input
 Open an Index
 Search the Index
 E.g. Via IndexSearcher
 Use the same Analyzer as before
 Iterate through returned Documents
 Extract out needed results
 Extract out result scores (if needed)
It is important that Queries use the same (or very similar) Analyzer that was used
when the index was created. The reason for this is due to the way that the
Analyzer performs normalization computations on the input text. Inorder to
find Documents using the same type of text that was used when indexing, that
text must be normalized in the same way that the original data was
normalized.
Apache lucene
Scalability Limits
 3 main scalability factors:
 Query Rate
 Index Size
 Update Rate
Query Rate Scalability
 Lucene is already fast
 Built-in simple cache mechanism
 Easy solution for heavy workloads:
(gives near-linear scaling)
 Add more query servers behind a load balancer
 Can grow as your traffic grows
Index Size Scalability
 Can easily handle millions of Documents
 Lucene is very commonly deployed into systems with 10s of
millions of Documents.
 Although query performance can degrade as more
Documents are added to the index, the growth factor is
very low. The main limits related to Index size that you are
likely to run in to will be disk capacity and disk I/O limits.
 If you need bigger:
 Built-in methods to allow queries to span multiple remote
Lucene indexes
 Can merge multiple remote indexes at query-time.
 Lucene is threadsafe
 Can update and query at the same time
 I/O is limiting factor

More Related Content

PPTX
Introduction to apache lucene
Shrikrishna Parab
 
PDF
Introduction To Apache Lucene
Mindfire Solutions
 
ODP
Apache Lucene: Searching the Web and Everything Else (Jazoon07)
dnaber
 
PPT
Intelligent crawling and indexing using lucene
Swapnil & Patil
 
PPT
Lucene basics
Nitin Pande
 
PPTX
Lucene
Harshit Agarwal
 
PPT
Lucene and MySQL
farhan "Frank"​ mashraqi
 
PPT
Lucene BootCamp
GokulD
 
Introduction to apache lucene
Shrikrishna Parab
 
Introduction To Apache Lucene
Mindfire Solutions
 
Apache Lucene: Searching the Web and Everything Else (Jazoon07)
dnaber
 
Intelligent crawling and indexing using lucene
Swapnil & Patil
 
Lucene basics
Nitin Pande
 
Lucene and MySQL
farhan "Frank"​ mashraqi
 
Lucene BootCamp
GokulD
 

What's hot (19)

PPT
Lucene Introduction
otisg
 
PPTX
Lucene indexing
Lucky Sharma
 
PDF
Apache Lucene intro - Breizhcamp 2015
Adrien Grand
 
PPTX
Azure search
Alexej Sommer
 
PDF
What is in a Lucene index?
lucenerevolution
 
PDF
Full Text Search with Lucene
WO Community
 
PDF
Munching & crunching - Lucene index post-processing
abial
 
PDF
Faceted Search with Lucene
lucenerevolution
 
PDF
Tutorial 5 (lucene)
Kira
 
PDF
Apache Solr/Lucene Internals by Anatoliy Sokolenko
Provectus
 
PPTX
Intro to Apache Lucene and Solr
Grant Ingersoll
 
PDF
Lucene
Surinder Kaur
 
PPTX
Hacking Lucene for Custom Search Results
OpenSource Connections
 
PDF
Berlin Buzzwords 2013 - How does lucene store your data?
Adrien Grand
 
PDF
Elasticsearch speed is key
Enterprise Search Warsaw Meetup
 
PPT
Lucece Indexing
Prasenjit Mukherjee
 
PPTX
Introduction to Apache Lucene/Solr
Rahul Jain
 
PPT
Advanced full text searching techniques using Lucene
Asad Abbas
 
PDF
Multi faceted responsive search, autocomplete, feeds engine & logging
lucenerevolution
 
Lucene Introduction
otisg
 
Lucene indexing
Lucky Sharma
 
Apache Lucene intro - Breizhcamp 2015
Adrien Grand
 
Azure search
Alexej Sommer
 
What is in a Lucene index?
lucenerevolution
 
Full Text Search with Lucene
WO Community
 
Munching & crunching - Lucene index post-processing
abial
 
Faceted Search with Lucene
lucenerevolution
 
Tutorial 5 (lucene)
Kira
 
Apache Solr/Lucene Internals by Anatoliy Sokolenko
Provectus
 
Intro to Apache Lucene and Solr
Grant Ingersoll
 
Hacking Lucene for Custom Search Results
OpenSource Connections
 
Berlin Buzzwords 2013 - How does lucene store your data?
Adrien Grand
 
Elasticsearch speed is key
Enterprise Search Warsaw Meetup
 
Lucece Indexing
Prasenjit Mukherjee
 
Introduction to Apache Lucene/Solr
Rahul Jain
 
Advanced full text searching techniques using Lucene
Asad Abbas
 
Multi faceted responsive search, autocomplete, feeds engine & logging
lucenerevolution
 
Ad

Similar to Apache lucene (20)

PPT
Apache Lucene Searching The Web
Francisco Gonçalves
 
PPT
Lucene Bootcamp -1
GokulD
 
PDF
Searching and Analyzing Qualitative Data on Personal Computer
IOSR Journals
 
PDF
Solr中国6月21日企业搜索
longkeyy
 
PPTX
Search Engine Capabilities - Apache Solr(Lucene)
Manish kumar
 
PDF
Apace Solr Web Development.pdf
Abanti Aazmin
 
PPTX
Elastic search basic conceptes by gggg.pptx
gows88
 
PPTX
Search Me: Using Lucene.Net
gramana
 
PDF
Wanna search? Piece of cake!
Alex Kursov
 
PDF
A customized web search engine [autosaved]
Mustafa Elkhiat
 
PDF
Elasticsearch and Spark
Audible, Inc.
 
PPT
Using Thinking Sphinx with rails
Rishav Dixit
 
PPTX
Getting started with Elasticsearch in .net
Ismaeel Enjreny
 
PPTX
Getting Started With Elasticsearch In .NET
Ahmed Abd Ellatif
 
PPTX
PyCon India 2012: Rapid development of website search in python
Chetan Giridhar
 
DOC
How a search engine works report
Sovan Misra
 
PPTX
Implementing full text search with Apache Solr
techprane
 
PDF
Introduction to Lucidworks Fusion - Alexander Kanarsky, Lucidworks
Lucidworks
 
PPTX
Apache Solr-Webinar
Edureka!
 
PPTX
Introduction to Lucene and Solr - 1
YI-CHING WU
 
Apache Lucene Searching The Web
Francisco Gonçalves
 
Lucene Bootcamp -1
GokulD
 
Searching and Analyzing Qualitative Data on Personal Computer
IOSR Journals
 
Solr中国6月21日企业搜索
longkeyy
 
Search Engine Capabilities - Apache Solr(Lucene)
Manish kumar
 
Apace Solr Web Development.pdf
Abanti Aazmin
 
Elastic search basic conceptes by gggg.pptx
gows88
 
Search Me: Using Lucene.Net
gramana
 
Wanna search? Piece of cake!
Alex Kursov
 
A customized web search engine [autosaved]
Mustafa Elkhiat
 
Elasticsearch and Spark
Audible, Inc.
 
Using Thinking Sphinx with rails
Rishav Dixit
 
Getting started with Elasticsearch in .net
Ismaeel Enjreny
 
Getting Started With Elasticsearch In .NET
Ahmed Abd Ellatif
 
PyCon India 2012: Rapid development of website search in python
Chetan Giridhar
 
How a search engine works report
Sovan Misra
 
Implementing full text search with Apache Solr
techprane
 
Introduction to Lucidworks Fusion - Alexander Kanarsky, Lucidworks
Lucidworks
 
Apache Solr-Webinar
Edureka!
 
Introduction to Lucene and Solr - 1
YI-CHING WU
 
Ad

Recently uploaded (20)

PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
The Future of Artificial Intelligence (AI)
Mukul
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 

Apache lucene

  • 2. Agenda  Search Engine  Lucene Java  Features  Code Example  Scalability  Solr  Nutch
  • 3. About Speaker  Abhiram Gandhe  9+ Years Experience on Java/J2EE platform  Consultant eCommerce Architect with Delivery Cube  Pursuing PhD from VNIT Nagpur on Link Prediction on Graph Databases  M.Tech. (Comp. Sci. & Engg.) MNNIT Allahabad, B.E. (Comp. Tech.) YCCE Nagpur  …
  • 4. What is a Search Engine?  Answer: A software that  Builds an index on text  Answers queries using the index “But we have database already for that…”  A Search Engine offers  Scalability  Relevance Ranking  Integrates different data sources (email, web pages, files, databases, …)
  • 5.  Works on words not substrings  auto !=automatic, automobile  Indexing Process:  Convert document  Extract text and meta data  Normalize text  Write (inverted) index  Example:  Document 1: Apache Lucene at JUGNagpur  Document 2: JUGNagpur conference
  • 6. What is Apache Lucene? “Apache Lucene is a high- performance, full- featured text search engine library written entirely in Java” - from http://lucene.apache.org/
  • 7. What is Apache Lucene?  Lucene is specifically an API, not an application.  Hard parts have been done, easy programming has been left to you.  You can build a search application that is specifically suited to your needs.  You can use Lucene to provide consistent full-text indexing across both database objects and documents in various formats (Microsoft Office documents, PDF, HTML, text, emails and so on).
  • 8. Availability  Freely Available (no cost)  Open Source  Apache License, version 2.0  http://www.apache.org/licenses/LICENSE-2.0  Download from:  http://www.apache.org/dyn/closer.cgi/lucene/java/
  • 9. Apache Lucene Overview  The Apache LuceneTM project develops open-source search software, including:  Lucene Core, our flagship sub-project, provides Java-based indexing and search technology, as well as spellchecking, hit highlighting and advanced analysis/tokenization capabilities.  SolrTM is a high performance search server built using Lucene Core, with XML/HTTP and JSON/Python/Ruby APIs, hit highlighting, faceted search, caching, replication, and a web admin interface.  Open Relevance Project is a subproject with the aim of collecting and distributing free materials for relevance testing and performance.  PyLucene is a Python port of the Core project.
  • 10. Lucene Java Features  Powerful Query Syntax  Create queries from user input or programmatically  Ranked Search  Flexible Queries  Phrases, wildcard, etc.  Field Specific Queries  eg. Title, artist, album  Fast indexing  Fast searching  Sorting by relevance or other  Large and active community  Apache License 2.0
  • 11. Lucene Query Example  JUGNagpur  JUGNagpur AND Lucene  +JUGNagpur +Lucene  JUGNagpur OR Lucene  JUGNagpur NOT PHP  +JUGNagpur -PHP  “Java Conference”  Title: Lucene  J?GNagpur  JUG*  schmidt~  schmidt, schmit, schmitt  price: [100 TO 500]
  • 12. Index For this Demo, we'r e going to create an in- memory index from some strings. StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_40); Directory index = new RAMDirectory(); IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer); IndexWriter w = new IndexWriter(index, config); addDoc(w, "Lucene in Action", "193398817"); addDoc(w, "Lucene for Dummies", "55320055Z"); addDoc(w, "Managing Gigabytes", "55063554A"); addDoc(w, "The Art of Computer Science", "9900333X"); w.close();
  • 13. Index... addDoc() is what actually adds documents to the index private static void addDoc(IndexWriter w, String title, String isbn) throws IOException { Document doc = new Document(); doc.add(new TextField("title", title, Field.Store.YES)); doc.add(new StringField("isbn", isbn, Field.Store.YES)); w.addDocument(doc); } Note the use of TextField for content we want tokenized, and StringField for id fields and the like, which we don't want tokenized.
  • 14. Query We read the query from stdin, parse it and build a lucene Query out of it. String querystr = args.length > 0 ? args[0] : "lucene"; Query q = new QueryParser(Version.LUCENE_40, "title", analyzer).parse(queryst r);
  • 15. Search Using the Query we create a Searcher to search the index. Then a TopScoreDocC ollector is instantiated to collect the top 10 scoring hits. int hitsPerPage = 10; IndexReader reader = IndexReader.open(index); IndexSearcher searcher = new IndexSearcher(reader); TopScoreDocCollector collector = TopScoreDocCollector.create(hitsPerPage, true); searcher.search(q, collector); ScoreDoc[] hits = collector.topDocs().scoreDocs;
  • 16. Display Now that we have results from our search, we display the results to the user. System.out.println("Found " + hits.length + " hits."); for(int i=0;i<hits.length;++i) { int docId = hits[i].doc; Document d = searcher.doc(docId); System.out.println((i + 1) + ". " + d.get("isbn") + "t" + d.get("title")); }
  • 18. Everything is a Document  A document can represent anything textual:  Word Document  DVD (the textual metadata only)  Website Member (name, ID, etc...)  A Lucene Document need not refer to an actual file on a disk, it could also resemble a row in a relational database.  Each developer is responsible for turning their own data sets into Lucene Documents. Lucene comes with a number of 3rd party contributions, including examples for parsing structured data files such as XML documents and Word files.
  • 19. Indexes  The type of index used in Lucene and other full- text search engines is sometimes also called an “inverted index”.  Indexes track term frequencies  Every term maps back to a Document  This index is what allows Lucene to quickly locate every document currently associated with a given set up input search terms.
  • 20. Basic Indexing  An index consists of one or more Lucene Documents  1. Create a Document  A document consists of one or more Fields: name-value pair  Example: a Field commonly found in applications is title. In the case of a title Field, the field name is title and the value is the title of that content item.  Add one or more Fields to the Document  2. Add the Document to an Index  Indexing involves adding Documents to an IndexWriter  3. Indexer will Analyze the Document  We can provide specialized Analyzers such as StandardAnalyzer  Analyzers control how the text is broken into terms which are then used to index the document:  Analyzers can be used to remove stop words, perform stemming Lucene comes with a default Analyzer which works well for unstructured English text, however it often performs incorrect normalizations on non-English texts. Lucene makes it easy to build custom Analyzers, and provides a number of helpful building blocks with which to build your own. Lucene even includes a number of “stemming” algorithms for various languages, which can improve document retrieval accuracy whenthe source language is known at indexing time.
  • 21. Basic Searching  Searching requires an index to have already been built.  Create a Query  E.g. Usually via QueryParser, MultiPhraseQuery, etc. That parses user input  Open an Index  Search the Index  E.g. Via IndexSearcher  Use the same Analyzer as before  Iterate through returned Documents  Extract out needed results  Extract out result scores (if needed) It is important that Queries use the same (or very similar) Analyzer that was used when the index was created. The reason for this is due to the way that the Analyzer performs normalization computations on the input text. Inorder to find Documents using the same type of text that was used when indexing, that text must be normalized in the same way that the original data was normalized.
  • 23. Scalability Limits  3 main scalability factors:  Query Rate  Index Size  Update Rate
  • 24. Query Rate Scalability  Lucene is already fast  Built-in simple cache mechanism  Easy solution for heavy workloads: (gives near-linear scaling)  Add more query servers behind a load balancer  Can grow as your traffic grows
  • 25. Index Size Scalability  Can easily handle millions of Documents  Lucene is very commonly deployed into systems with 10s of millions of Documents.  Although query performance can degrade as more Documents are added to the index, the growth factor is very low. The main limits related to Index size that you are likely to run in to will be disk capacity and disk I/O limits.  If you need bigger:  Built-in methods to allow queries to span multiple remote Lucene indexes  Can merge multiple remote indexes at query-time.
  • 26.  Lucene is threadsafe  Can update and query at the same time  I/O is limiting factor