lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley (JIRA)" <>
Subject [jira] Commented: (SOLR-139) Support updateable/modifiable documents
Date Sun, 04 Feb 2007 16:13:05 GMT


Yonik Seeley commented on SOLR-139:

I browsed the code really quick, looking for the tricky part... It's here:
+      openSearcher();
+      Term t = new Term( uniqueKey.getName(), uniqueKey.getType().toInternal( id.toString()
) );
+      int docID = searcher.getFirstMatch( t );

When you overwrite a document, it is really just adds another instance... so the index contains
multiple copies.  When we "commit", deletes of the older versions are performed.  So you really
want the *last* doc matching a term, not the first.

Also, to need to make sure that the searcher you are using can actually "see" the last document
(once a searcher is opened, it sees documents that were added since the last IndexWriter close().

So a quick fix would be to do a commit() first that would close the writer, and then delete
any old copies of docments.
Opening and closing readers and writers is *very* expensive though.
You can get slightly more sophisticated by checking the pset (set of pending documents), and
skip the commit() if the doc you are updating isn't in there (so you know an older searcher
will still have the freshest doc for that id).

We might be able to get more efficient yet in the future by leveraging NewIndexModifier: SOLR-124

> Support updateable/modifiable documents
> ---------------------------------------
>                 Key: SOLR-139
>                 URL:
>             Project: Solr
>          Issue Type: Improvement
>          Components: update
>            Reporter: Ryan McKinley
>         Attachments: SOLR-139-IndexDocumentCommand.patch, SOLR-139-IndexDocumentCommand.patch,
> It would be nice to be able to update some fields on a document without having to insert
the entire document.
> Given the way lucene is structured, (for now) one can only modify stored fields.
> While we are at it, we can support incrementing an existing value - I think this only
makes sense for numbers.
> for background, see:

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message