Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Lucene 4 Cookbook

You're reading from  Lucene 4 Cookbook

Product type Book
Published in Jun 2015
Publisher
ISBN-13 9781782162285
Pages 220 pages
Edition 1st Edition
Languages
Authors (2):
Edwood Ng Edwood Ng
Profile icon Edwood Ng
Vineeth Mohan Vineeth Mohan
Profile icon Vineeth Mohan
View More author details

Table of Contents (16) Chapters

Lucene 4 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Introducing Lucene Analyzing Your Text Indexing Your Data Searching Your Indexes Near Real-time Searching Querying and Filtering Data Flexible Scoring Introducing Elasticsearch Extending Lucene with Modules Index

Creating a StringField


Let's look at a quick recap of field objects in Lucene; they are part of a document containing information about the document. A field is composed of three parts: name, type, and value. Values can be text, binary, or numeric. A field can also be stored in the index so that their values are returned along with hits. Lucene provides a number of field implementations out of the box that are suitable for most applications. In this section, we will cover a field implementation that stores the literal string, StringField. Any value stored in this field can be indexed, but not tokenized. The entire string is treated as a single token.

So why don't we want to tokenize the text since we have talked about tokenization for quite a bit already? Consider that a part of a document is an address and that you have fields such as street address, city, state, and country contained within it. It's not a very good idea to analyze and tokenize the city, state, and country, because it's...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}