Using the commitWithin attribute in an XML update message

163 views
Skip to first unread message

Rich Tebb

unread,
Jan 4, 2011, 1:39:29 PM1/4/11
to SolrNet
Since Solr 1.4 the commitWithin attribute is supported in an update
XML message (see http://wiki.apache.org/solr/UpdateXmlMessages). I'd
like to be able to specify this attribute some times (e.g. when
updating a new or modified database record) but not use this attribute
at other times (e.g. when performing a full index update). In some
respects, it's analogous to AddWithBoost(), where the optional boost
parameter is an attribute on the serialized XML document.

I don't think this scenario can this be supported with the current API
- correct? If I were to change SolrNet to support it, what would be
the best way to do so, and would you be interested enough to pull this
kind of an API change into the trunk? I could add an AddWithDelay()
method (or some such name), but then you might want to add with boost
and delay, and there would be even more permutations if another
attribute were required - we wouldn't want to end up with
AddWithBoostAndDelayAndSomethingElse() ...

Rich

Mauricio Scheffer

unread,
Jan 4, 2011, 4:16:48 PM1/4/11
to sol...@googlegroups.com
That's correct, commitWithin is currently not implemented (see http://code.google.com/p/solrnet/issues/detail?id=85 ).
As for the implementation, first we should create a class (e.g. AddParameters) to hold values for commitWithin (nullable<int>) and overwrite (nullable<bool>). Then,  ISolrBasicOperations.AddWithBoost() should be changed to add an AddParameters parameter. This will impact on SolrNet.Commands.AddCommand which has to be modified as well. The actual serialization of these parameters would happen in AddCommand.
In ISolrOperations, we could just add overloads for Add() and AddWithBoost() (both single-doc and IEnumerable of docs) that accept an additional AddParameters parameter.

What do you think? 

--
Mauricio




--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To post to this group, send email to sol...@googlegroups.com.
To unsubscribe from this group, send email to solrnet+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/solrnet?hl=en.


Rich Tebb

unread,
Jan 4, 2011, 4:37:59 PM1/4/11
to SolrNet
Sorry Mauricio, I should have checked the issues list.

I think your proposed solution will work just great. I'll get started!

Rich

On Jan 4, 9:16 pm, Mauricio Scheffer <mauricioschef...@gmail.com>
wrote:
> That's correct, commitWithin is currently not implemented (seehttp://code.google.com/p/solrnet/issues/detail?id=85).
> As for the implementation, first we should create a class (e.g.
> AddParameters) to hold values for commitWithin (nullable<int>) and overwrite
> (nullable<bool>). Then,  ISolrBasicOperations.AddWithBoost() should be
> changed to add an AddParameters parameter. This will impact
> on SolrNet.Commands.AddCommand which has to be modified as well. The actual
> serialization of these parameters would happen in AddCommand.
> In ISolrOperations, we could just add overloads for Add() and AddWithBoost()
> (both single-doc and IEnumerable of docs) that accept an additional
> AddParameters parameter.
>
> What do you think?
>
> --
> Mauricio
>
>
>
>
>
>
>
> On Tue, Jan 4, 2011 at 3:39 PM, Rich Tebb <rich.t...@gmail.com> wrote:
> > Since Solr 1.4 the commitWithin attribute is supported in an update
> > XML message (seehttp://wiki.apache.org/solr/UpdateXmlMessages). I'd
> > like to be able to specify this attribute some times (e.g. when
> > updating a new or modified database record) but not use this attribute
> > at other times (e.g. when performing a full index update). In some
> > respects, it's analogous to AddWithBoost(), where the optional boost
> > parameter is an attribute on the serialized XML document.
>
> > I don't think this scenario can this be supported with the current API
> > - correct? If I were to change SolrNet to support it, what would be
> > the best way to do so, and would you be interested enough to pull this
> > kind of an API change into the trunk? I could add an AddWithDelay()
> > method (or some such name), but then you might want to add with boost
> > and delay, and there would be even more permutations if another
> > attribute were required - we wouldn't want to end up with
> > AddWithBoostAndDelayAndSomethingElse() ...
>
> > Rich
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "SolrNet" group.
> > To post to this group, send email to sol...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > solrnet+u...@googlegroups.com<solrnet%2Bunsu...@googlegroups.com >
> > .

Rich Tebb

unread,
Jan 4, 2011, 5:59:29 PM1/4/11
to SolrNet
Completed. I couldn't think of a useful integration test, but if you
can suggest something I'd be happy to implement.

Rich

Rich Tebb

unread,
Jan 5, 2011, 4:41:40 AM1/5/11
to SolrNet
Now I come to using this (via the NHibernate integration) there is
something else that's missing - there's no way to specify any add
parameters to the SolrNetListener<T> instance. By analogy with the
auto-commit option, I propose to add an AddParameters parameter to the
CfgHelper.Configure() method (by creating an overload for backward
compatibility), then using that value to configure a new property on
the SolrNetListener<T>. Does that sound OK?

Mauricio Scheffer

unread,
Jan 5, 2011, 7:46:56 AM1/5/11
to SolrNet
Sounds great!
Reply all
Reply to author
Forward
0 new messages