Apache Solr for Indexing Data - Sachin Handiekar - E-Book

Apache Solr for Indexing Data E-Book

Sachin Handiekar

0,0
27,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Apache Solr is a widely used, open source enterprise search server that delivers powerful indexing and searching features. These features help fetch relevant information from various sources and documentation. Solr also combines with other open source tools such as Apache Tika and Apache Nutch to provide more powerful features.
This fast-paced guide starts by helping you set up Solr and get acquainted with its basic building blocks, to give you a better understanding of Solr indexing. You’ll quickly move on to indexing text and boosting the indexing time. Next, you’ll focus on basic indexing techniques, various index handlers designed to modify documents, and indexing a structured data source through Data Import Handler.
Moving on, you will learn techniques to perform real-time indexing and atomic updates, as well as more advanced indexing techniques such as de-duplication. Later on, we’ll help you set up a cluster of Solr servers that combine fault tolerance and high availability. You will also gain insights into working scenarios of different aspects of Solr and how to use Solr with e-commerce data.
By the end of the book, you will be competent and confident working with indexing and will have a good knowledge base to efficiently program elements.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 130

Veröffentlichungsjahr: 2015

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Apache Solr for Indexing Data
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started
Overview and installation of Solr
Installing Solr in OS X (Mac)
Running Solr
Installing Solr in Windows
Installing Solr on Linux
The Solr architecture and directory structure
Solr directory structure
Cores in Solr (Multicore Solr)
Summary
2. Understanding Analyzers, Tokenizers, and Filters
Introducing analyzers
Analysis phases
Tokenizers
Standard tokenizer
Keyword tokenizer
Lowercase tokenizer
N-gram tokenizer
Filters
Lowercase filter
Synonym filter
Porter stem filter
Running your analyzer
Summary
3. Indexing Data
Indexing data in Solr
Introducing field types
Defining fields
Defining an unique key
Copy fields and dynamic fields
Building our musicCatalogue example
Using the Solr Admin UI
Facet searching
Summary
4. Indexing Data – The Basic Technique and Using Index Handlers
Inserting data into Solr
Configuring UpdateRequestHandler
Indexing documents using XML
Adding and updating documents
Deleting a document
Indexing documents using JSON
Adding a single document
Adding multiple JSON documents
Sequential JSON update commands
Indexing updates using CSV
Summary
5. Indexing Data with the Help of Structured Datasources – Using DIH
Indexing data from MySQL
Configuring datasource
DIH commands
Indexing data using XPath
Summary
6. Indexing Data Using Apache Tika
Introducing Apache Tika
Configuring Apache Tika in Solr
Indexing PDF and Word documents
Summary
7. Apache Nutch
Introducing Apache Nutch
Installing Apache Nutch
Configuring Solr with Nutch
Summary
8. Commits, Real-Time Index Optimizations, and Atomic Updates
Understanding soft commit, optimize, and hard commit
Using atomic updates in Solr
Using RealTime Get
Summary
9. Advanced Topics – Multilanguage, Deduplication, and Others
Multilanguage indexing
Removing duplicate documents (deduplication)
Content streaming
UIMA integration with Solr
Summary
10. Distributed Indexing
Setting up SolrCloud
The collections API
Updating configuration files
Distributed indexing and searching
Summary
11. Case Study of Using Solr in E-Commerce
Creating an AutoSuggest feature
Facet navigation
Search filtering and sorting
Relevancy boosting
Summary
Index

Apache Solr for Indexing Data

Apache Solr for Indexing Data

Copyright © 2015 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: December 2015

Production reference: 1151215

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78355-323-5

www.packtpub.com

Credits

Authors

Sachin Handiekar

Anshul Johri

Reviewers

Damiano Braga

Florian Hopf

Commissioning Editor

Ashwin Nair

Acquisition Editors

Rebecca Pedley

Reshma Raman

Content Development Editor

Rohit Kumar Singh

Technical Editor

Utkarsha S. Kadam

Copy Editor

Vikrant Phadke

Project Coordinator

Mary Alex

Proofreader

Safis Editing

Indexer

Rekha Nair

Production Coordinator

Manu Joseph

Cover Work

Manu Joseph

About the Authors

Sachin Handiekar is a senior software developer with over 5 years of experience in Java EE development. He graduated in computer science from the University of Greenwich, London, and currently works for a global consulting company, developing enterprise applications using various open source technologies, such as Apache Camel, ServiceMix, ActiveMQ, and ZooKeeper.

He has a lot of interest in open source projects and has contributed code to Apache Camel and developed plugins for the Spring Social, which can be found on GitHub at https://github.com/sachin-handiekar.

He also actively writes about enterprise application development on his blog (http://www.sachinhandiekar.com/).

Anshul Johri has more than 10 years of technical experience in software engineering. He did his masters in computer science from the computer science department in the University of Pune. Anshul has always been a start-up mindset guy, working on fast-paced development using cutting-edge technologies and doing multiple things at a time. His core strength has always been search technology, whereby Solr plays an important role in his career. Anshul started using Solr around 9 years ago, and since then, he has never looked back. He did better and better with Solr, whether using it or contributing to the open source search community. He has used Solr extensively in all his organizations across various projects.

As mentioned earlier, Anshul has always been a start-up mindset guy. Because of that, he has worked with many start-ups in his career so far, which includes early-age and mid-size start-ups as well. To name a few, they are Ibibo.com, Asklaila.com, Bookadda.com, and so on. His last company was Amazon, where he spent around 2 years building scalable systems for Amazon Prime (a global product). Anshul recently started his own company in India with another friend from Amazon and founded http://www.rentomo.com/, a unique concept of a peer-to-peer sharing platform in a trusted community. He heads the technology and other core pillars of his own start-up.

Anshul did the technical review of the book Indexing with Solr, published by Packt Publishing.

About the Reviewers

Damiano Braga is the technical search lead at Trulia, where he leads all the backend search and browsing-related projects. He's also an open source contributor and has participated as a speaker at the Lucene Revolution 2014, where he presented Thoth, a real-time Solr monitoring and search analysis engine. He also previously reviewed the book Apache Solr Search Patterns, Packt Publishing.

Prior to Trulia, Damiano studied and worked for the University of Ferrara (Italy), where he also completed his master's degree in computer science engineering.

Florian Hopf works as a freelance software developer and consultant in Karlsruhe, Germany. He familiarized himself with Lucene-based searching while working with different content management systems on the Java platform. He is responsible for small and large search systems, on both the Internet and Intranet, for web content and application-specific data based on Lucene, Solr, and Elasticsearch. He helps organize the local Java user group as well as the Search Meetup in Karlsruhe. Florian has also written a German book on Elasticsearch. He posts blogs at http://blog.florian-hopf.de/.

www.PacktPub.com

Support files, eBooks, discount offers, and more

For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?

Fully searchable across every book published by PacktCopy and paste, print, and bookmark contentOn demand and accessible via a web browser

Free access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.

I would like to dedicate this book to my parents, especially my late mother, Anuradha Johri, who has always been my inspiration and my friend for life. After that I would like to thank my wife, Aparna, who is always there with me in every situation no matter how tough it is; she is someone who always makes me feel complete.

Preface

Welcome to Apache Solr for Indexing Data. Solr is an amazing enterprise tool that gives us a search engine with various possibilities to index data and gives users a better experience. This book will cover the various indexing methods that we can use to improve the indexing process by covering step-by-step examples.

The book is all about indexing in Solr, and we'll cover all the possible topics in Solr that developers can use in their use cases by following simple examples.

What this book covers

Chapter 1, Getting Started, covers the basic setup and installation needed to run Solr. It also covers the directory structure and the main configuration files used by Solr.

Chapter 2, Understanding Analyzers, Tokenizers, and Filters, shows you the basic building blocks of Solr, such as analyzers, tokenizers, and filters. These help in the indexing of data. This chapter also covers the most commonly used components in detail and how they work together.

Chapter 3, Indexing Data, helps you get a better understanding of how indexing works in Solr by building a real-life example that covers various aspects, for example, the copy field, facet, indexing time boosting, and so on.

Chapter 4, Indexing Data – The Basic Techniques and Using Index Handlers, covers various techniques by which we can index data in Solr. This chapter explains the various request handlers that are used by Solr to index CSV, JSON, and XML data type documents.

Chapter 5, Indexing Data Using Structured Datasource Using DIH, covers how we can use indexed data from a database by using the data import handler available in Solr.

Chapter 6, Indexing Data Using Apache Tika, illustrates the integration of Apache Tika with Solr for the indexing of documents.

Chapter 7, Apache Nutch, covers the integration of Apache Nutch with Solr for indexing crawl data from the Internet.

Chapter 8, Commits, Real-Time Index Optimizations, and Atomic Updates, shows us how we can use the real-time indexing features available in Solr and utilize these features to provide a real-time search experience.

Chapter 9, Advanced Topics – Multilanguage, Deduplication, and Others, covers advanced topics such as indexing multilanguage documents and removing duplicate documents from Solr.

Chapter 10, Distributed Indexing, tells us how we can utilize SolrCloud to provide a high-availability and fault-tolerant cluster.

Chapter 11, Case Study of Using Solr in E-Commerce, covers a case study by going through easy-to-use, simple examples that can be used in an e-commerce website.

What you need for this book

We are going to cover various approaches to Solr indexing. Each chapter will introduce different approaches with different software. Also, each chapter will cover the installation steps/instructions needed to run the examples for the specific scenario.

The minimal installation which we'll need to run the example code are as follows:

JDK 1.6+ (the JAVA_HOME variable should be set up correctly on the system path)Apache Solr 4.10.1The cURL tool (Windows users can download it from http://curl.haxx.se/download.html)

Who this book is for

This book is for developers who want to increase their experience of indexing in Solr by learning about the various index handlers, analyzers, and methods available in Solr. Beginner level Solr development skills are expected.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

<solr persistent="false"> <cores adminPath="/admin/cores" defaultCoreName="core1"> <core name="core1" instanceDir="core1"/> <core name="core2" instanceDir="core2"/> </cores> </solr>

Any command-line input or output is written as follows:

$cd $SOLR_HOME/example/exampledocs/$./post.shvidcard.xml

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Click on Install service. You should get a service successfully installed message."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail <[email protected]>, and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at <[email protected]>, and we will do our best to address the problem.

Chapter 1. Getting Started

We will start this chapter with a quick overview of Solr, followed by a section that helps you get Solr up and running. We will also cover some basic building blocks of the Solr architecture, its directory structure, and its configurations files. This chapter covers following topics:

Overview and installation of SolrRunning Solr