You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Peter Spam <ps...@mac.com> on 2011/04/27 06:35:16 UTC

Re: How to Update Value of One Field of a Document in Index?

My schema: id, name, checksum, body, notes, date

I'd like for a user to be able to add notes to the notes field, and not have to re-index the document (since the body field may contain 100MB of text).  Some ideas:

1) How about creating another core which only contains id, checksum, and notes?  Then, "updating" (delete followed by add) wouldn't be that painful?

2) What about using a multValued field?  Could you just keep adding values as the user enters more notes?


Pete

On Sep 9, 2010, at 11:06 PM, Liam O'Boyle wrote:

> Hi Savannah,
> 
> You can only reindex the entire document; if you only have the ID,
> then do a search to retrieve the rest of the data, then reindex.  This
> assumes that all of the fields you need to index are stored (so that
> you can retrieve them) and not just indexed.
> 
> Liam
> 
> On Fri, Sep 10, 2010 at 3:29 PM, Savannah Beckett
> <sa...@yahoo.com> wrote:
>> 
>> I use nutch to crawl and index to Solr.  My code is working.  Now, I want to
>> update the value of one of the fields of a document in the solr index after the
>> document was already indexed, and I have only the document id.  How do I do
>> that?
>> 
>> Thanks.
>> 
>> 
>> 


Re: How to Update Value of One Field of a Document in Index?

Posted by Luis Cappa Banda <lu...@gmail.com>.
Hello.

You should be able to get the current document that you want to update,
change your notes value with the new ones to be added bye the user, and then
make and update petition to Solr to delete the old document (findable by the
id that you include in the POST petition) and add the new document with the
changes done. Try to develop a small Java application with SolrJ resources,
for example. Depending on the number of update petitions that your
system/application will do I recommend you, or not, to include a commit
order after the update one. Also you can configure a periodic auto-commit to
update indexes automatically.

Re: How to Update Value of One Field of a Document in Index?

Posted by Erick Erickson <er...@gmail.com>.
OK, thanks.

On Wed, Apr 27, 2011 at 9:29 AM, Steven A Rowe <sa...@syr.edu> wrote:
>> There's the "limited join" patch, see:
>> https://issues.apache.org/jira/browse/SOLR-2272
>> that hasn't been applied  yet
>
> Correction: Yonik committed this feature in r1096978.
>
>

RE: How to Update Value of One Field of a Document in Index?

Posted by Steven A Rowe <sa...@syr.edu>.
> There's the "limited join" patch, see:
> https://issues.apache.org/jira/browse/SOLR-2272
> that hasn't been applied  yet

Correction: Yonik committed this feature in r1096978.


Re: How to Update Value of One Field of a Document in Index?

Posted by Erick Erickson <er...@gmail.com>.
(2) isn't viable. Updating a multiValued field is the same as any other field, a
    delete followed by an add of the entire document.
(1) could work. The problem here is how you need to search. If you need
    to search your notes it would be separate from the document. In other
    words, you couldn't form a query like
    "+body:(body text of interest) + notes:(stuff I put in my notes)
    You could search for each independently, but not both together.

There's the "limited join" patch, see:
https://issues.apache.org/jira/browse/SOLR-2272
that hasn't been applied  yet that *might* help. A variant of (1) is
that there's
really no need to have two separate cores. Documents in Solr don't need to all
have the same fields. So you could have, say, two types of documents,
"fulldoc" and "notesdoc". Fulldocs wouldn't have a "notes" field, and notesdocs
wouldn't have a "body" field. You'd have to take some care that the <uniqueKey>
was different for the two different types of documents. That might
work with 2272.
Warning: I haven't played with that patch, so caveat emptor.

Best
Erick

On Wed, Apr 27, 2011 at 12:35 AM, Peter Spam <ps...@mac.com> wrote:
> My schema: id, name, checksum, body, notes, date
>
> I'd like for a user to be able to add notes to the notes field, and not have to re-index the document (since the body field may contain 100MB of text).  Some ideas:
>
> 1) How about creating another core which only contains id, checksum, and notes?  Then, "updating" (delete followed by add) wouldn't be that painful?
>
> 2) What about using a multValued field?  Could you just keep adding values as the user enters more notes?
>
>
> Pete
>
> On Sep 9, 2010, at 11:06 PM, Liam O'Boyle wrote:
>
>> Hi Savannah,
>>
>> You can only reindex the entire document; if you only have the ID,
>> then do a search to retrieve the rest of the data, then reindex.  This
>> assumes that all of the fields you need to index are stored (so that
>> you can retrieve them) and not just indexed.
>>
>> Liam
>>
>> On Fri, Sep 10, 2010 at 3:29 PM, Savannah Beckett
>> <sa...@yahoo.com> wrote:
>>>
>>> I use nutch to crawl and index to Solr.  My code is working.  Now, I want to
>>> update the value of one of the fields of a document in the solr index after the
>>> document was already indexed, and I have only the document id.  How do I do
>>> that?
>>>
>>> Thanks.
>>>
>>>
>>>
>
>