You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by jason rutherglen <ja...@yahoo.com> on 2006/08/12 01:10:49 UTC

DirectUpdateHandler2 deleteByQuery

Why does the deleteByQuery method and the DirectUpdateHandler2 not use the existing IndexSearcher for deleting.  Why does it open it's own Searcher?  


Re: OpenBitSet.equals(Object o) bug?

Posted by Yonik Seeley <yo...@apache.org>.
Fix checked in with tests.
There should be no impact to regular Solr users (equals was not used by Solr).

-Yonik

On 8/12/06, Yonik Seeley <yo...@apache.org> wrote:
> Right you are, Thanks!
>
> -Yonik
>
> On 8/12/06, eks dev <ek...@yahoo.co.uk> wrote:
> >
> > Yonik, should this not be the other way round, or I missed something? "this" is always an instance of OpenBitSet
> >
> >     if (!(o instanceof OpenBitSet)) return false;
> > instead of:
> >
> >   public boolean equals(Object o) {
> > ...
> >     if (!(this instanceof OpenBitSet)) return false;
> > ...

Re: OpenBitSet.flip(int, int) bug, ugly one?

Posted by Yonik Seeley <yo...@apache.org>.
Fixed... someone put 'c' too close to 'f' on the keyboard ;-)

-    long endmask = (endIndex&0x3c)==0 ? 0 : -1L >>> (64-endIndex);
+    long endmask = (endIndex&0x3f)==0 ? 0 : -1L >>> (64-endIndex);

-Yonik


On 8/13/06, eks dev <ek...@yahoo.co.uk> wrote:
> Hi Yonik,
>
> it seams we have another one nobody uses :)
>
> this fails:
>   public void testFlipRange() {
>     OpenBitSet b1 = new OpenBitSet(100);
>
>     b1.set(0);
>     b1.set(4);
>     b1.set(5);
>     b1.set(9);
>
>     b1.flip(0,3);
>
>     assertFalse(b1.get(0));
>     assertTrue(b1.get(1));
>     assertTrue(b1.get(2));
>   }
>
>
> but if you flip(0,5) it works
>
> cheers, e.

Re: OpenBitSet.flip(int, int) bug, ugly one?

Posted by eks dev <ek...@yahoo.co.uk>.
Hi Yonik, 

it seams we have another one nobody uses :)

this fails:
  public void testFlipRange() {
    OpenBitSet b1 = new OpenBitSet(100);
    
    b1.set(0);
    b1.set(4);
    b1.set(5);
    b1.set(9);
   
    b1.flip(0,3);
   
    assertFalse(b1.get(0));
    assertTrue(b1.get(1));
    assertTrue(b1.get(2)); 
  }


but if you flip(0,5) it works

cheers, e.



Re: OpenBitSet.equals(Object o) bug?

Posted by eks dev <ek...@yahoo.co.uk>.
as for  1. , I am stupid, i did not read it correctly and I gave wrong example !
example should read...

x = new OpenBitSet(1024);
x. set(22);
x.capacity() should return 23, but it returnes 1024

and this is exactly what is written in javadoc for this method, so forget it.

what I was reading was: "(1 greater than the index of the last *set* bit)" like standard BitSet.length();




----- Original Message ----
From: eks dev <ek...@yahoo.co.uk>
To: solr-dev@lucene.apache.org
Sent: Saturday, 12 August, 2006 7:53:27 PM
Subject: Re: OpenBitSet.equals(Object o) bug?

When we are allready in the office :)

1. Is this javadoc correct and what are invariants for this to be true? Actually, I think it is not and I have no idea how I would make it do this efficiently.

  /** Returns the current capacity in bits (1 greater than the index of the last bit) */
  public long capacity() { return bits.length << 6; }

in this case:
x = new OpenBitSet(1024);
x. set(22);
x.capacity() should return 23, but it returnes 22

right?

The question really is how to implement lastSetBit(long )

2. nextClearBit(int/long index). Any ideas how to do it efficiantly?

I will try to add set(long from, long to) and clear(long from, long to) as there is a nice flip(long, long) method as a template (any hints there?). For previous 2 questions, bit twidlling is not my world, especially in this turbo_save_every_cpu_tick you made :) That is why I bother you


----- Original Message ----
From: Yonik Seeley <yo...@apache.org>
To: solr-dev@lucene.apache.org
Sent: Saturday, 12 August, 2006 7:25:50 PM
Subject: Re: OpenBitSet.equals(Object o) bug?

Right you are, Thanks!

-Yonik

On 8/12/06, eks dev <ek...@yahoo.co.uk> wrote:
>
> Yonik, should this not be the other way round, or I missed something? "this" is always an instance of OpenBitSet
>
>     if (!(o instanceof OpenBitSet)) return false;
> instead of:
>
>   public boolean equals(Object o) {
> ...
>     if (!(this instanceof OpenBitSet)) return false;
> ...







Re: OpenBitSet.equals(Object o) bug?

Posted by eks dev <ek...@yahoo.co.uk>.
When we are allready in the office :)

1. Is this javadoc correct and what are invariants for this to be true? Actually, I think it is not and I have no idea how I would make it do this efficiently.

  /** Returns the current capacity in bits (1 greater than the index of the last bit) */
  public long capacity() { return bits.length << 6; }

in this case:
x = new OpenBitSet(1024);
x. set(22);
x.capacity() should return 23, but it returnes 22

right?

The question really is how to implement lastSetBit(long )

2. nextClearBit(int/long index). Any ideas how to do it efficiantly?

I will try to add set(long from, long to) and clear(long from, long to) as there is a nice flip(long, long) method as a template (any hints there?). For previous 2 questions, bit twidlling is not my world, especially in this turbo_save_every_cpu_tick you made :) That is why I bother you


----- Original Message ----
From: Yonik Seeley <yo...@apache.org>
To: solr-dev@lucene.apache.org
Sent: Saturday, 12 August, 2006 7:25:50 PM
Subject: Re: OpenBitSet.equals(Object o) bug?

Right you are, Thanks!

-Yonik

On 8/12/06, eks dev <ek...@yahoo.co.uk> wrote:
>
> Yonik, should this not be the other way round, or I missed something? "this" is always an instance of OpenBitSet
>
>     if (!(o instanceof OpenBitSet)) return false;
> instead of:
>
>   public boolean equals(Object o) {
> ...
>     if (!(this instanceof OpenBitSet)) return false;
> ...




Re: OpenBitSet.equals(Object o) bug?

Posted by Yonik Seeley <yo...@apache.org>.
Right you are, Thanks!

-Yonik

On 8/12/06, eks dev <ek...@yahoo.co.uk> wrote:
>
> Yonik, should this not be the other way round, or I missed something? "this" is always an instance of OpenBitSet
>
>     if (!(o instanceof OpenBitSet)) return false;
> instead of:
>
>   public boolean equals(Object o) {
> ...
>     if (!(this instanceof OpenBitSet)) return false;
> ...

OpenBitSet.equals(Object o) bug?

Posted by eks dev <ek...@yahoo.co.uk>.
Yonik, should this not be the other way round, or I missed something? "this" is always an instance of OpenBitSet

    if (!(o instanceof OpenBitSet)) return false;
instead of: 

  public boolean equals(Object o) {
...
    if (!(this instanceof OpenBitSet)) return false;
...


Re: DirectUpdateHandler2 deleteByQuery

Posted by Yonik Seeley <yo...@apache.org>.
On 8/11/06, jason rutherglen <ja...@yahoo.com> wrote:
> Why does the deleteByQuery method and the DirectUpdateHandler2 not use the existing IndexSearcher for deleting.  Why does it open it's own Searcher?

A couple of reasons:
- you can't overlap deletes and adds, so you would have to close
whatever reader you used to do deletes before opening a new
IndexWriter and adding more documents.
- you want deletes and adds visible at the same time.  when
overwriting a document you want the old one to disappear at a
different time from when the new one is visible.

-Yonik