lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Øie <>
Subject Re: Help on creating and maintaining an index that changes
Date Thu, 21 Nov 2002 13:31:59 GMT
> I want to do something similiar with Lucene, but I
> don't know how to approach it.  I thought maybe
> keeping the first hashmap as is, and building a
> Directory in lucene that replaces the master Hashmap.
>  When I get hits back from lucene I look them up in
> the first hashmap, and return those.

If your index is big its probably best to do it this way. I got indexes 
that takes up to 12 hours to build and takes about 1gb of harddrive 
space but searching is still fast. if you put the client id's into 
keyword fields you can use lucenes to filter out hits from the clients 
you know is offline by using a boolean NOT, either manually or through 
the queryparser.

> How do I put the needed information into Directory so
> I can look them up in the first hashmap.  I would need
> the unique id identifying the client, and a key that
> identifies the document that the client has.

you add a keyword field to each document that contains the unique id 
identifying the client. This way you can search for documents from a 
client, and also filter out documents from that client.

> Then how do I clean up the Directory when a client is
> not available?  How do I remove a document from
> Lucene's Directory?

the org.apache.lucene.index.IndexReader class contains a delete() 
function to delete documents from lucene. But as said before, if your 
index is big it's best not to delete the documents just because a 
client goes offline, its better to filter out the hits.

mvh karl øie

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message