lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Parkes" <>
Subject RE: Fast index traversal and update for stored field?
Date Mon, 19 Mar 2007 18:08:55 GMT
You'll have a difficult time updating Lucene indexes in place. A lot of
coordination exists within Lucene specifically not to do this: it's the
fact that Lucene does not do this that enables a lot of the lockless
parallelism in Lucene. This applies equally to the data store and the
inverted index portions of the Lucene index.

-----Original Message-----
From: Thomas K. Burkholder [] 
Sent: Wednesday, March 14, 2007 5:36 PM
Subject: Re: Fast index traversal and update for stored field?

Hey, thanks for the quick reply.

I've considered using a secondary index just for this data but  
thought I would look at storing the data in lucene first, since  
ultimately this data gets transported to an outside system, and it's  
a lot easier if there's only one "thing" to transfer.  The  
destination environment that receives this lucene index doesn't (and  
shouldn't) have access to the database, which is why we don't simply  
store it there.  Even if it did, we try not to access the database  
for search results when we don't have to, as this tends to make  
searching slow (as I think you were alluding to).

Sounds like there's nothing "out of the box" to solve my problem; if  
I write something to update lucene indexes in place I'll follow up  
about it in here (don't know that I will though; building a new,  
narrower index is probably more expedient and will probably be fast  
enough for my purposes in this case).

Thanks again,


On Mar 14, 2007, at 4:50 PM, Erick Erickson wrote:

> If you search the mail archive for "update in place" (no quotes),
> you'll find extensive discussions of this idea. Although you're
> raising an interesting variant because you're talking about a non-
> indexed field, so now I'm not sure those discussions are relevant.
> I don't know of anyone who has done what you're asking though...
> But if it's just stored data, you could go out to a database and
> pick it up at search time, although there are sound reasons for
> not requiring a database connection.
> What about having a separate index for just this one field? And
> make it an indexed value, along with some id (not the Lucene ID,
> probably) of your original. Something like
> index fields
> ID  (unique ID for each document)
> field (the corresponding value).
> Searching this should be very fast, and if the usual Hits based
> search wasn't fast enough, perhaps something with
> termenum/termdocs would be faster.
> Or you could just index the unique ID and store (but not index)
> the field. Hits or variants should work for that too.
> So the general algorithm would be:
> search main index
> for each hit:
>   search second index and fetch that field
> I have no idea whether this has any traction for your problem
> space, but I thought I'd mention it. This assumes that building
> the mutable index would be acceptably fast...
> Although conceptually, this is really just a Map of ID/value pairs.
> I have no idea how much data you're talking about, but if it's not
> a huge data set, might it be possible just to store it in
> a simple map and look it up that way?
> And if I'm all wet, I'm sure others will chime in...
> Best
> Erick
> *
> *
> On 3/14/07, Thomas K. Burkholder <> wrote:
>> Hi there,
>> I'm using lucene to index and store entries from a database table for
>> ultimate retrieval as search results.  This works fine.  But I find
>> myself in the position of wanting to occasionally (daily-ish) bulk-
>> update a single, stored, non-indexed field in every document in the
>> index, without changing any indexed value at all.
>> The obviously documented way to do this would be to remove and then
>> re-add each updated document successively.  However, I know from
>> experience that rebuilding our index from scratch in this fashion
>> would take several hours at least, which is too long to delay pending
>> incremental index jobs.  It seems to me that at some level it should
>> be possible to iterate over all the document storage on disk and
>> modify only the field I'm interested in (no index modification
>> required remember as this is a field that is stored but not
>> indexed).  It's plain from the documentation on file formats that it
>> would be potentially possible to do this from a low level, however
>> before I go possibly re-inventing that wheel, I'm wondering if anyone
>> knows of any existing code out there that would aid in solving this
>> problem.
>> Thanks in advance,
>> //Thomas
>> Thomas K. Burkholder
>> Code Janitor
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

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

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

View raw message