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 kostali hassan <me...@gmail.com> on 2016/07/13 09:16:56 UTC

Update index

I am using solr 5.4 1 to index sql database with data import handler.
I am looking for update index automatically when the database is modified
or insert in it new value.

Re: Update index

Posted by Erick Erickson <er...@gmail.com>.
bq: dont have attribute modified  just date_creation

Well, assuming that your date_creation is set whenever
you insert a record, just change the WHERE clause to
WHERE date_creation > .......

But that doesn't help with updated records unless the
date_creation is updated every time a field
in an existing record is changed. I'd add a modified
field to the database that's auto-updated whenever
the row changes.

And even _that_ doesn't help with deleted rows, since
there's no record in the main table after the row is gone.
People sometimes put triggers on the main table to
insert a row in yet another table with a structure like
timestamp, id, operation

where id is a foreign key and the operation is something
like add/delete/modify then the delta query actually
goes against that table for figuring out what docs to
update.

Best,
Erick

On Wed, Jul 13, 2016 at 6:30 AM, kostali hassan
<me...@gmail.com> wrote:
> I try to set deltaquery
>
>> deltaImportQuery="SELECT * from users WHERE id='${dih.delta.id}'"
>> deltaQuery="SELECT id FROM users  WHERE modified >
>> '${dataimporter.last_index_time}'"
>
> But the database who i try to index dont have attribute modified   just
> date_creation
>
> 2016-07-13 14:11 GMT+01:00 Jamal, Sarfaraz <
> Sarfaraz.Jamal@verizonwireless.com.invalid>:
>
>> Hi Kostali,
>>
>> I would look at the Delta Queries -
>>
>> Sas
>>
>> -----Original Message-----
>> From: kostali hassan [mailto:med.has.kostali@gmail.com]
>> Sent: Wednesday, July 13, 2016 5:17 AM
>> To: solr-user@lucene.apache.org
>> Subject: Update index
>>
>> I am using solr 5.4 1 to index sql database with data import handler.
>> I am looking for update index automatically when the database is modified
>> or insert in it new value.
>>

Re: Update index

Posted by kostali hassan <me...@gmail.com>.
I try to set deltaquery

> deltaImportQuery="SELECT * from users WHERE id='${dih.delta.id}'"
> deltaQuery="SELECT id FROM users  WHERE modified >
> '${dataimporter.last_index_time}'"

But the database who i try to index dont have attribute modified   just
date_creation

2016-07-13 14:11 GMT+01:00 Jamal, Sarfaraz <
Sarfaraz.Jamal@verizonwireless.com.invalid>:

> Hi Kostali,
>
> I would look at the Delta Queries -
>
> Sas
>
> -----Original Message-----
> From: kostali hassan [mailto:med.has.kostali@gmail.com]
> Sent: Wednesday, July 13, 2016 5:17 AM
> To: solr-user@lucene.apache.org
> Subject: Update index
>
> I am using solr 5.4 1 to index sql database with data import handler.
> I am looking for update index automatically when the database is modified
> or insert in it new value.
>

RE: Update index

Posted by "Jamal, Sarfaraz" <Sa...@VerizonWireless.com.INVALID>.
Hi Kostali,

I would look at the Delta Queries -

Sas

-----Original Message-----
From: kostali hassan [mailto:med.has.kostali@gmail.com] 
Sent: Wednesday, July 13, 2016 5:17 AM
To: solr-user@lucene.apache.org
Subject: Update index

I am using solr 5.4 1 to index sql database with data import handler.
I am looking for update index automatically when the database is modified or insert in it new value.