Lucene Homework - PowerPoint PPT Presentation

1 / 5
About This Presentation
Title:

Lucene Homework

Description:

import org.apache.lucene.index.IndexWriter; import org.apache. ... import java.io.FileNotFoundException; import java.io.IOException; import java.util.Date; ... – PowerPoint PPT presentation

Number of Views:65
Avg rating:3.0/5.0
Slides: 6
Provided by: chuckb73
Category:

less

Transcript and Presenter's Notes

Title: Lucene Homework


1
Lucene Homework
  • Search,
  • Corpora Characteristics,
  • Lucene Introduction

2
Lucene Intro
  • Lucene is an open source library that allows
    indexing and search applications to be built
  • It is not a standalone application
  • The Lucene demos provide starting points

3
Lucene CLASSPATH variable
  • If you installed lucene _at_ c\, your CLASSPATH
    variable is
  • . C\lucene-2.4.0\lucene-core-2.4.0.jarC\lucen
    e-2.4.0\lucene-demos-2.4.0.jar

watch the s
watch the periods hyphens
4
Lucene IndexFiles Demo
  • Changes I made to IndexFiles.java --
  • //package org.apache.lucene.demo lt- COMMENT
    THIS OUT
  • import org.apache.lucene.analysis.standard.Standar
    dAnalyzer
  • import org.apache.lucene.index.IndexWriter
  • import org.apache.lucene.demo.FileDocument lt-
    ADD THIS
  • import java.io.File
  • import java.io.FileNotFoundException
  • import java.io.IOException
  • import java.util.Date

5
Changing invoked analyzer
Put different analyzers here
  • Date start new Date()
  • try
  • IndexWriter writer new IndexWriter(INDEX_D
    IR, new StandardAnalyzer(), true,
    IndexWriter.MaxFieldLength.LIMITED)
  • System.out.println("Indexing to directory
    '" INDEX_DIR "'...")
  • indexDocs(writer, docDir)
  • System.out.println("Optimizing...")
  • writer.optimize()
  • writer.close()
  • Date end new Date()
  • System.out.println(end.getTime() -
    start.getTime() " total milliseconds")
  • catch (IOException e)
  • System.out.println(" caught a "
    e.getClass()
  • "\n with message " e.getMessage())
  • ()
Write a Comment
User Comments (0)
About PowerShow.com