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 Raghunandan Rao <Ra...@newScale.com> on 2008/11/26 10:49:37 UTC

Deleting indices

Hi,

I need to update an index after I update data in the DB. I will first
update the DB and then call deleteByQuery in Solrj and then update
particular index. What happens to deleteByQuery method if there are
multiple ids found?

 

For eg, I am using deleteByQuery("12");

 

Can I specify field name here as in search and delete only those indices
belonging to a field. 

 

Like deleteByQuery("ID:12");

 

Is this allowed? 

 

Thanks

-Raghu


RE: Deleting indices

Posted by Raghunandan Rao <Ra...@newScale.com>.
Yes, I am sure. Everytime I re-index, I do deleteByQuery("*:*") and then
fetch the rows from DB and call server.addBeans(list). 

-----Original Message-----
From: Mike Klaas [mailto:mike.klaas@gmail.com] 
Sent: Friday, November 28, 2008 4:30 AM
To: solr-user@lucene.apache.org
Subject: Re: Deleting indices


On 26-Nov-08, at 4:48 AM, Raghunandan Rao wrote:

> I have restarted and re-indexed all the docs after the change in the
> schema.xml. I was able to search even after that.
>
> I hit browser with this url
>
> http://localhost:7001/solr/select?q=name:2124&fl=*&debugQuery=true

Are you sure all the old docs are gone?  Try wiping the index  
completely:

deleteByQuery *:*

(it is also more efficient to do this first if you are going to re- 
index everything).

-Mike

Re: Deleting indices

Posted by Mike Klaas <mi...@gmail.com>.
On 26-Nov-08, at 4:48 AM, Raghunandan Rao wrote:

> I have restarted and re-indexed all the docs after the change in the
> schema.xml. I was able to search even after that.
>
> I hit browser with this url
>
> http://localhost:7001/solr/select?q=name:2124&fl=*&debugQuery=true

Are you sure all the old docs are gone?  Try wiping the index  
completely:

deleteByQuery *:*

(it is also more efficient to do this first if you are going to re- 
index everything).

-Mike

RE: Deleting indices

Posted by Raghunandan Rao <Ra...@newScale.com>.
I have restarted and re-indexed all the docs after the change in the
schema.xml. I was able to search even after that. 

I hit browser with this url

http://localhost:7001/solr/select?q=name:2124&fl=*&debugQuery=true


-----Original Message-----
From: Shalin Shekhar Mangar [mailto:shalinmangar@gmail.com] 
Sent: Wednesday, November 26, 2008 6:14 PM
To: solr-user@lucene.apache.org
Subject: Re: Deleting indices

Did you change your schema.xml after you indexed the documents?

On Wed, Nov 26, 2008 at 6:08 PM, Raghunandan Rao <
Raghunandan.Rao@newscale.com> wrote:

> I am not sure. It is showing in the debug logs as below.
>
> 0.5967079 = (MATCH) fieldWeight(name:2124 in 0), product of: 1.4142135
=
> tf(termFreq(name:2124)=2) 1.1251632 = idf
>
> This is how I have done.
> I have a class NameDTO which contains all these variables. I have
@Field
> annotation to these fields. My schema.xml file contains as I have said
> below. Is that because I have @Field annotation it is indexing?
>
> -----Original Message-----
> From: Shalin Shekhar Mangar [mailto:shalinmangar@gmail.com]
> Sent: Wednesday, November 26, 2008 5:47 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Deleting indices
>
> On Wed, Nov 26, 2008 at 5:01 PM, Raghunandan Rao <
> Raghunandan.Rao@newscale.com> wrote:
>
> > Ok.
> > I have another query on search.
> >
> > I have given two fields to be indexed = true in xml.
> >
> > <field name="name" type="text" stored="true" />
> > <field name="id" type="integer" indexed="true" stored="true"
> > required="false"/>
> > <field name="deptid" type="integer" indexed="true" stored="true"
> > required="false"/>
> >
> > But when I try to search on non-indexed "name" field it is able to
> retrieve
> > records. How is this possible?
> >
>
> It is not possible. There must be an indexed field which contained
that
> value.
>
> Execute your query from the web interface and add debugQuery=true to
> your
> search request to see details on how it is being searched.
> --
> Regards,
> Shalin Shekhar Mangar.
>



-- 
Regards,
Shalin Shekhar Mangar.

Re: Deleting indices

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
Did you change your schema.xml after you indexed the documents?

On Wed, Nov 26, 2008 at 6:08 PM, Raghunandan Rao <
Raghunandan.Rao@newscale.com> wrote:

> I am not sure. It is showing in the debug logs as below.
>
> 0.5967079 = (MATCH) fieldWeight(name:2124 in 0), product of: 1.4142135 =
> tf(termFreq(name:2124)=2) 1.1251632 = idf
>
> This is how I have done.
> I have a class NameDTO which contains all these variables. I have @Field
> annotation to these fields. My schema.xml file contains as I have said
> below. Is that because I have @Field annotation it is indexing?
>
> -----Original Message-----
> From: Shalin Shekhar Mangar [mailto:shalinmangar@gmail.com]
> Sent: Wednesday, November 26, 2008 5:47 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Deleting indices
>
> On Wed, Nov 26, 2008 at 5:01 PM, Raghunandan Rao <
> Raghunandan.Rao@newscale.com> wrote:
>
> > Ok.
> > I have another query on search.
> >
> > I have given two fields to be indexed = true in xml.
> >
> > <field name="name" type="text" stored="true" />
> > <field name="id" type="integer" indexed="true" stored="true"
> > required="false"/>
> > <field name="deptid" type="integer" indexed="true" stored="true"
> > required="false"/>
> >
> > But when I try to search on non-indexed "name" field it is able to
> retrieve
> > records. How is this possible?
> >
>
> It is not possible. There must be an indexed field which contained that
> value.
>
> Execute your query from the web interface and add debugQuery=true to
> your
> search request to see details on how it is being searched.
> --
> Regards,
> Shalin Shekhar Mangar.
>



-- 
Regards,
Shalin Shekhar Mangar.

RE: Deleting indices

Posted by Raghunandan Rao <Ra...@newScale.com>.
I am not sure. It is showing in the debug logs as below. 

0.5967079 = (MATCH) fieldWeight(name:2124 in 0), product of: 1.4142135 =
tf(termFreq(name:2124)=2) 1.1251632 = idf

This is how I have done.
I have a class NameDTO which contains all these variables. I have @Field
annotation to these fields. My schema.xml file contains as I have said
below. Is that because I have @Field annotation it is indexing? 

-----Original Message-----
From: Shalin Shekhar Mangar [mailto:shalinmangar@gmail.com] 
Sent: Wednesday, November 26, 2008 5:47 PM
To: solr-user@lucene.apache.org
Subject: Re: Deleting indices

On Wed, Nov 26, 2008 at 5:01 PM, Raghunandan Rao <
Raghunandan.Rao@newscale.com> wrote:

> Ok.
> I have another query on search.
>
> I have given two fields to be indexed = true in xml.
>
> <field name="name" type="text" stored="true" />
> <field name="id" type="integer" indexed="true" stored="true"
> required="false"/>
> <field name="deptid" type="integer" indexed="true" stored="true"
> required="false"/>
>
> But when I try to search on non-indexed "name" field it is able to
retrieve
> records. How is this possible?
>

It is not possible. There must be an indexed field which contained that
value.

Execute your query from the web interface and add debugQuery=true to
your
search request to see details on how it is being searched.
-- 
Regards,
Shalin Shekhar Mangar.

Re: Deleting indices

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Wed, Nov 26, 2008 at 5:01 PM, Raghunandan Rao <
Raghunandan.Rao@newscale.com> wrote:

> Ok.
> I have another query on search.
>
> I have given two fields to be indexed = true in xml.
>
> <field name="name" type="text" stored="true" />
> <field name="id" type="integer" indexed="true" stored="true"
> required="false"/>
> <field name="deptid" type="integer" indexed="true" stored="true"
> required="false"/>
>
> But when I try to search on non-indexed "name" field it is able to retrieve
> records. How is this possible?
>

It is not possible. There must be an indexed field which contained that
value.

Execute your query from the web interface and add debugQuery=true to your
search request to see details on how it is being searched.
-- 
Regards,
Shalin Shekhar Mangar.

RE: Deleting indices

Posted by Raghunandan Rao <Ra...@newScale.com>.
Ok.
I have another query on search.

I have given two fields to be indexed = true in xml.

<field name="name" type="text" stored="true" />
<field name="id" type="integer" indexed="true" stored="true" required="false"/>
<field name="deptid" type="integer" indexed="true" stored="true" required="false"/>

But when I try to search on non-indexed "name" field it is able to retrieve records. How is this possible? 

-----Original Message-----
From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com] 
Sent: Wednesday, November 26, 2008 4:20 PM
To: solr-user@lucene.apache.org
Subject: Re: Deleting indices

nope . you cannot update a document in Solr.
You can only delete and add a new one



On Wed, Nov 26, 2008 at 4:11 PM, Raghunandan Rao
<Ra...@newscale.com> wrote:
> Ok. Can I update the index without deleting? I mean to update all names with a new name.
> In an index I have id, name, deptid as fields. I need to update name field = "new" where name="old".
>
> -----Original Message-----
> From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com]
> Sent: Wednesday, November 26, 2008 3:56 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Deleting indices
>
> yes
>
> On Wed, Nov 26, 2008 at 3:19 PM, Raghunandan Rao
> <Ra...@newscale.com> wrote:
>> Hi,
>>
>> I need to update an index after I update data in the DB. I will first
>> update the DB and then call deleteByQuery in Solrj and then update
>> particular index. What happens to deleteByQuery method if there are
>> multiple ids found?
>>
>>
>>
>> For eg, I am using deleteByQuery("12");
>>
>>
>>
>> Can I specify field name here as in search and delete only those indices
>> belonging to a field.
>>
>>
>>
>> Like deleteByQuery("ID:12");
>>
>>
>>
>> Is this allowed?
>>
>>
>>
>> Thanks
>>
>> -Raghu
>>
>>
>
>
>
> --
> --Noble Paul
>



-- 
--Noble Paul

Re: Deleting indices

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
nope . you cannot update a document in Solr.
You can only delete and add a new one



On Wed, Nov 26, 2008 at 4:11 PM, Raghunandan Rao
<Ra...@newscale.com> wrote:
> Ok. Can I update the index without deleting? I mean to update all names with a new name.
> In an index I have id, name, deptid as fields. I need to update name field = "new" where name="old".
>
> -----Original Message-----
> From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com]
> Sent: Wednesday, November 26, 2008 3:56 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Deleting indices
>
> yes
>
> On Wed, Nov 26, 2008 at 3:19 PM, Raghunandan Rao
> <Ra...@newscale.com> wrote:
>> Hi,
>>
>> I need to update an index after I update data in the DB. I will first
>> update the DB and then call deleteByQuery in Solrj and then update
>> particular index. What happens to deleteByQuery method if there are
>> multiple ids found?
>>
>>
>>
>> For eg, I am using deleteByQuery("12");
>>
>>
>>
>> Can I specify field name here as in search and delete only those indices
>> belonging to a field.
>>
>>
>>
>> Like deleteByQuery("ID:12");
>>
>>
>>
>> Is this allowed?
>>
>>
>>
>> Thanks
>>
>> -Raghu
>>
>>
>
>
>
> --
> --Noble Paul
>



-- 
--Noble Paul

RE: Deleting indices

Posted by Raghunandan Rao <Ra...@newScale.com>.
Ok. Can I update the index without deleting? I mean to update all names with a new name. 
In an index I have id, name, deptid as fields. I need to update name field = "new" where name="old". 

-----Original Message-----
From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com] 
Sent: Wednesday, November 26, 2008 3:56 PM
To: solr-user@lucene.apache.org
Subject: Re: Deleting indices

yes

On Wed, Nov 26, 2008 at 3:19 PM, Raghunandan Rao
<Ra...@newscale.com> wrote:
> Hi,
>
> I need to update an index after I update data in the DB. I will first
> update the DB and then call deleteByQuery in Solrj and then update
> particular index. What happens to deleteByQuery method if there are
> multiple ids found?
>
>
>
> For eg, I am using deleteByQuery("12");
>
>
>
> Can I specify field name here as in search and delete only those indices
> belonging to a field.
>
>
>
> Like deleteByQuery("ID:12");
>
>
>
> Is this allowed?
>
>
>
> Thanks
>
> -Raghu
>
>



-- 
--Noble Paul

Re: Deleting indices

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
yes

On Wed, Nov 26, 2008 at 3:19 PM, Raghunandan Rao
<Ra...@newscale.com> wrote:
> Hi,
>
> I need to update an index after I update data in the DB. I will first
> update the DB and then call deleteByQuery in Solrj and then update
> particular index. What happens to deleteByQuery method if there are
> multiple ids found?
>
>
>
> For eg, I am using deleteByQuery("12");
>
>
>
> Can I specify field name here as in search and delete only those indices
> belonging to a field.
>
>
>
> Like deleteByQuery("ID:12");
>
>
>
> Is this allowed?
>
>
>
> Thanks
>
> -Raghu
>
>



-- 
--Noble Paul