Deleting indices

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Deleting indices

Raghunandan Rao
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

Reply | Threaded
Open this post in threaded view
|

Re: Deleting indices

Noble Paul നോബിള്‍  नोब्ळ्
yes

On Wed, Nov 26, 2008 at 3:19 PM, Raghunandan Rao
<[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

RE: Deleting indices

Raghunandan Rao
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:[hidden email]]
Sent: Wednesday, November 26, 2008 3:56 PM
To: [hidden email]
Subject: Re: Deleting indices

yes

On Wed, Nov 26, 2008 at 3:19 PM, Raghunandan Rao
<[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: Deleting indices

Noble Paul നോബിള്‍  नोब्ळ्
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
<[hidden email]> 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:[hidden email]]
> Sent: Wednesday, November 26, 2008 3:56 PM
> To: [hidden email]
> Subject: Re: Deleting indices
>
> yes
>
> On Wed, Nov 26, 2008 at 3:19 PM, Raghunandan Rao
> <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

RE: Deleting indices

Raghunandan Rao
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:[hidden email]]
Sent: Wednesday, November 26, 2008 4:20 PM
To: [hidden email]
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
<[hidden email]> 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:[hidden email]]
> Sent: Wednesday, November 26, 2008 3:56 PM
> To: [hidden email]
> Subject: Re: Deleting indices
>
> yes
>
> On Wed, Nov 26, 2008 at 3:19 PM, Raghunandan Rao
> <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: Deleting indices

Shalin Shekhar Mangar
On Wed, Nov 26, 2008 at 5:01 PM, Raghunandan Rao <
[hidden email]> 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.
Reply | Threaded
Open this post in threaded view
|

RE: Deleting indices

Raghunandan Rao
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:[hidden email]]
Sent: Wednesday, November 26, 2008 5:47 PM
To: [hidden email]
Subject: Re: Deleting indices

On Wed, Nov 26, 2008 at 5:01 PM, Raghunandan Rao <
[hidden email]> 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.
Reply | Threaded
Open this post in threaded view
|

Re: Deleting indices

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

On Wed, Nov 26, 2008 at 6:08 PM, Raghunandan Rao <
[hidden email]> 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:[hidden email]]
> Sent: Wednesday, November 26, 2008 5:47 PM
> To: [hidden email]
> Subject: Re: Deleting indices
>
> On Wed, Nov 26, 2008 at 5:01 PM, Raghunandan Rao <
> [hidden email]> 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.
Reply | Threaded
Open this post in threaded view
|

RE: Deleting indices

Raghunandan Rao
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:[hidden email]]
Sent: Wednesday, November 26, 2008 6:14 PM
To: [hidden email]
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 <
[hidden email]> 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:[hidden email]]
> Sent: Wednesday, November 26, 2008 5:47 PM
> To: [hidden email]
> Subject: Re: Deleting indices
>
> On Wed, Nov 26, 2008 at 5:01 PM, Raghunandan Rao <
> [hidden email]> 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.
Reply | Threaded
Open this post in threaded view
|

RE: Deleting indices

Raghunandan Rao
In reply to this post by Raghunandan Rao
Can anybody please let me know why is this happening? I have also tried
giving indexed="false" for name field in the xml.

-----Original Message-----
From: Raghunandan Rao [mailto:[hidden email]]
Sent: Wednesday, November 26, 2008 6:18 PM
To: [hidden email]
Subject: RE: Deleting indices

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:[hidden email]]
Sent: Wednesday, November 26, 2008 6:14 PM
To: [hidden email]
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 <
[hidden email]> 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:[hidden email]]
> Sent: Wednesday, November 26, 2008 5:47 PM
> To: [hidden email]
> Subject: Re: Deleting indices
>
> On Wed, Nov 26, 2008 at 5:01 PM, Raghunandan Rao <
> [hidden email]> 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.
Reply | Threaded
Open this post in threaded view
|

Re: Deleting indices

Mike Klaas
In reply to this post by Raghunandan Rao

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
Reply | Threaded
Open this post in threaded view
|

RE: Deleting indices

Raghunandan Rao
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:[hidden email]]
Sent: Friday, November 28, 2008 4:30 AM
To: [hidden email]
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