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 Jack L <jl...@yahoo.ca> on 2007/05/25 03:49:06 UTC

Re[2]: add and delete docs at same time

Oh, is that the case? One document per request for delete?
I'm about to implement delete. Just want to confirm.

-- 
Best regards,
Jack

Thursday, May 24, 2007, 12:47:21 PM, you wrote:

> currently no.

> Right now you even need a new request for each delete...


> Patrick Givisiez wrote:
>> 
>> can I add and delete docs at same post?
>> 
>> Some thing like this:
>> 
>> myDocs.xml
>> =====================================
>> <add>
>> <doc><field name="mainId">4</field></doc>
>> <doc><field name="mainId">5</field></doc>
>> <doc><field name="mainId">6</field></doc>
>> </add>
>> <delete><id>1</id></delete>
>> <delete><id>2</id></delete>
>> <delete><id>3</id></delete>
>> =====================================
>> 
>> Thanks!
>> 
>> 
>> 
>> 


Re: AW: Re[2]: add and delete docs at same time

Posted by Mike Klaas <mi...@gmail.com>.
On 25-May-07, at 2:49 AM, Burkamp, Christian wrote:

> Thierry,
>
> If you always start from scratch you could even reset the index  
> completely (i.e. delete the index directory). Solr will create a  
> new index automatically at startup.

This will also make indexing and optimizing much faster for any non- 
trivial size index.

-Mike

Re: AW: Re[2]: add and delete docs at same time

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Just to be clear, [* TO *] does not necessarily return all  
documents.  It returns all documents that have a value in the  
specified (or default) field.  Be careful with that!   *:*, however,  
does match all documents.

	Erik


On May 25, 2007, at 5:49 AM, Burkamp, Christian wrote:

> Thierry,
>
> If you always start from scratch you could even reset the index  
> completely (i.e. delete the index directory). Solr will create a  
> new index automatically at startup.
> If you don't like to delete the files another approach would be to  
> use a query that returns all documents. You do not need a dummy  
> field for this. The range query [* TO *] returns all documents. (In  
> newer versions of solr you can use *:* which is executing a bit  
> faster.
>
> -- Christian
>
> -----Ursprüngliche Nachricht-----
> Von: Thierry Collogne [mailto:thierry.collogne@gmail.com]
> Gesendet: Freitag, 25. Mai 2007 10:30
> An: solr-user@lucene.apache.org; Jack L
> Betreff: Re: Re[2]: add and delete docs at same time
>
> We always do a full delete before indexing, this is because for us  
> that is the only way to be sure that there are no documents in the  
> index that don't exist anymore.
>
> So delete all, than add all.
>
> To use the delete all, we did the following. We added a field  
> called dummyDelete. This field always contains the value delete.
> Like this
>                 <field name="dummyDelete">delete</field>
>
> Then to delete all documents we do a request containing:
>
>                  <delete><query>dummyDelete:delete</query></delete>
>
> That way all documents are deleted where the field dummyDelete  
> contains delete => all the documents
>
> Hope this is clear. I am not sure if this is a good solution, but  
> it does work. :)
>
> Greet,
>
> Thierry
>
> On 25/05/07, Jack L <jl...@yahoo.ca> wrote:
>>
>> Oh, is that the case? One document per request for delete?
>> I'm about to implement delete. Just want to confirm.
>>
>> --
>> Best regards,
>> Jack
>>
>> Thursday, May 24, 2007, 12:47:21 PM, you wrote:
>>
>>> currently no.
>>
>>> Right now you even need a new request for each delete...
>>
>>
>>> Patrick Givisiez wrote:
>>>>
>>>> can I add and delete docs at same post?
>>>>
>>>> Some thing like this:
>>>>
>>>> myDocs.xml
>>>> =====================================
>>>> <add>
>>>> <doc><field name="mainId">4</field></doc> <doc><field
>>>> name="mainId">5</field></doc> <doc><field
>>>> name="mainId">6</field></doc> </add> <delete><id>1</id></delete>
>>>> <delete><id>2</id></delete> <delete><id>3</id></delete>
>>>> =====================================
>>>>
>>>> Thanks!
>>>>
>>>>
>>>>
>>>>
>>
>>


AW: Re[2]: add and delete docs at same time

Posted by "Burkamp, Christian" <C....@Ceyoniq.com>.
Thierry,

If you always start from scratch you could even reset the index completely (i.e. delete the index directory). Solr will create a new index automatically at startup.
If you don't like to delete the files another approach would be to use a query that returns all documents. You do not need a dummy field for this. The range query [* TO *] returns all documents. (In newer versions of solr you can use *:* which is executing a bit faster.

-- Christian

-----Ursprüngliche Nachricht-----
Von: Thierry Collogne [mailto:thierry.collogne@gmail.com] 
Gesendet: Freitag, 25. Mai 2007 10:30
An: solr-user@lucene.apache.org; Jack L
Betreff: Re: Re[2]: add and delete docs at same time

We always do a full delete before indexing, this is because for us that is the only way to be sure that there are no documents in the index that don't exist anymore.

So delete all, than add all.

To use the delete all, we did the following. We added a field called dummyDelete. This field always contains the value delete.
Like this
                <field name="dummyDelete">delete</field>

Then to delete all documents we do a request containing:

                 <delete><query>dummyDelete:delete</query></delete>

That way all documents are deleted where the field dummyDelete contains delete => all the documents

Hope this is clear. I am not sure if this is a good solution, but it does work. :)

Greet,

Thierry

On 25/05/07, Jack L <jl...@yahoo.ca> wrote:
>
> Oh, is that the case? One document per request for delete?
> I'm about to implement delete. Just want to confirm.
>
> --
> Best regards,
> Jack
>
> Thursday, May 24, 2007, 12:47:21 PM, you wrote:
>
> > currently no.
>
> > Right now you even need a new request for each delete...
>
>
> > Patrick Givisiez wrote:
> >>
> >> can I add and delete docs at same post?
> >>
> >> Some thing like this:
> >>
> >> myDocs.xml
> >> =====================================
> >> <add>
> >> <doc><field name="mainId">4</field></doc> <doc><field 
> >> name="mainId">5</field></doc> <doc><field 
> >> name="mainId">6</field></doc> </add> <delete><id>1</id></delete> 
> >> <delete><id>2</id></delete> <delete><id>3</id></delete> 
> >> =====================================
> >>
> >> Thanks!
> >>
> >>
> >>
> >>
>
>


Re: Re[2]: add and delete docs at same time

Posted by Thierry Collogne <th...@gmail.com>.
We always do a full delete before indexing, this is because for us that is
the only way to be sure that there are no documents in the index that don't
exist anymore.

So delete all, than add all.

To use the delete all, we did the following. We added a field called
dummyDelete. This field always contains the value delete.
Like this
                <field name="dummyDelete">delete</field>

Then to delete all documents we do a request containing:

                 <delete><query>dummyDelete:delete</query></delete>

That way all documents are deleted where the field dummyDelete contains
delete => all the documents

Hope this is clear. I am not sure if this is a good solution, but it does
work. :)

Greet,

Thierry

On 25/05/07, Jack L <jl...@yahoo.ca> wrote:
>
> Oh, is that the case? One document per request for delete?
> I'm about to implement delete. Just want to confirm.
>
> --
> Best regards,
> Jack
>
> Thursday, May 24, 2007, 12:47:21 PM, you wrote:
>
> > currently no.
>
> > Right now you even need a new request for each delete...
>
>
> > Patrick Givisiez wrote:
> >>
> >> can I add and delete docs at same post?
> >>
> >> Some thing like this:
> >>
> >> myDocs.xml
> >> =====================================
> >> <add>
> >> <doc><field name="mainId">4</field></doc>
> >> <doc><field name="mainId">5</field></doc>
> >> <doc><field name="mainId">6</field></doc>
> >> </add>
> >> <delete><id>1</id></delete>
> >> <delete><id>2</id></delete>
> >> <delete><id>3</id></delete>
> >> =====================================
> >>
> >> Thanks!
> >>
> >>
> >>
> >>
>
>