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 Luis Neves <lu...@co.sapo.pt> on 2007/02/01 19:23:05 UTC
Increment field value
Hello all,
We have a Solr/Lucene index for newspaper articles, those articles have
associated comments. When searching for articles we want to present the number
of comments per article.
What we do now is to fetch from the DB the sum of comments for each articleId
that Solr returns, but this is bringing the DB to its knees. We would like to
store the number of comments in the Solr index to save the DB some work.
Is it possible when updating a numeric field to increment the existing value
instead of replacing it with a new value?
The problem we are having is that we can't retrieve the number of comments
increment it and update the index because the "actual" value might be
uncommitted... is there any other alternative to this problem?
Thanks in advance for any help.
--
Luis Neves
Re: Increment field value
Posted by Luis Neves <lu...@co.sapo.pt>.
I forgot one little detail.
The DB server is untouchable. I have "read-only" access to it. The database is a
component of an big "enterprisy" CMS. The obvious solution of adding a "#Posts"
field to the table updated with a trigger is not viable.
We have a ticket open with the vendor, but they are not what we could call agile.
--
Luis Neves
Luis Neves wrote:
> Hello all,
>
> We have a Solr/Lucene index for newspaper articles, those articles have
> associated comments. When searching for articles we want to present the
> number of comments per article.
> What we do now is to fetch from the DB the sum of comments for each
> articleId that Solr returns, but this is bringing the DB to its knees.
> We would like to store the number of comments in the Solr index to save
> the DB some work.
>
> Is it possible when updating a numeric field to increment the existing
> value instead of replacing it with a new value?
>
> The problem we are having is that we can't retrieve the number of
> comments increment it and update the index because the "actual" value
> might be uncommitted... is there any other alternative to this problem?
>
> Thanks in advance for any help.
>
> --
> Luis Neves
>
Re: Increment field value
Posted by Chris Hostetter <ho...@fucit.org>.
: Is it possible when updating a numeric field to increment the existing value
: instead of replacing it with a new value?
it's not currently possible to update a document "in place" at all -- you
must provide all of the field values when doing an "update" -- this is
largely due to some limitations impossed by lucene when dealing with
fields that are indexed but unstored.
(some discussion is currently taking place on the solr-dev list as to how
to make some simple cases possible)
-Hoss