lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesiel Trevisan" <jesieltrevi...@gmail.com>
Subject Getting Start to LUCENE 2.2.0 - How to Indexing a Directory of Your WebSite.
Date Wed, 02 Jan 2008 12:07:00 GMT
Hi everyone,

I'm trying to use the Lucene 2.2.0 in my webpage, I would like to create a
simple websearch field/function in my site.

I'm intalled the example of Lucene, but, there is only a Search funcional
implemented as example, not the indexing files.

I would like to know how I can create a filter to create the lucene index
files

I need to indexing, for example, a directory of my website

I created a example to try to Index a directory wirh a simple TXT file
insite it :

...
       String indexDir =
"c:\\eclipse\\workspace\\JavaSource\\br\\com\\testeLucene"    (* there is a
test.txt file with some words insite it )*

       String dataDir =
"c:\\eclipse\\workspace\\JavaSource\\br\\com\\lucene\\indexedFiles"
...

    public static int index(File indexDir, File dataDir) throws IOException
{

        if (!dataDir.exists() || !dataDir.isDirectory()) {
            throw new IOException(dataDir + "It is NOT a Directory");
        }

        IndexWriter writer = new IndexWriter(indexDir, new
StandardAnalyzer(), true);
        writer.setUseCompoundFile(false);

        indexDirectory(writer, dataDir);

        int numIndexed = writer.docCount();
        writer.optimize();
        writer.close();

        return numIndexed;
    }

All right, the Lunece indexs files were created, but, following the Lucene
Search example, I could find the words that were inside the test.txt file

Is it work ? is it right ?

If someone can help me to starting the Lucene 2.2.0 I will really appreciate
it.

Tks so much.

-- 
_______________________________________________________
Jesiel A.S. Trevisan
Email: jesieltrevisan@gmail.com.br
MSN: jesieltrevisan@hotmail.com
Skype & AIM: jesieltrevisan
YahooMessager: jesiel.trevisan
ICQ:: 46527510
_______________________________________________________
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is
for the sole use of the intended recipient(s) and may contain confidential
and privileged information or otherwise be protected by law. Any
unauthorized review, use, disclosure or distribution is prohibited. If you
are not the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message