There's a couple ways to accomplish this from easy to hard depending
on your database schema:
1) Use DB trigger
  -> I don't like triggers too much b/c to me they couple your
database layer with your application layer which leads to untestable
and sometimes unmaintainable code
  -> Also it gets difficult when you want to re-index a document based
on a change to an auxiliary table. Say you associate an image with the
main entity, you're not touching the main entity table so you then can
have triggers on a bunch of tables which could get messy?
2) Use a database table as a "queue" of records to index and write to
it from your application when the main entity changes
   -> This isn't too bad.. it's a replayable queue basically that you
can purge when you want, query to find all the main entities that
changed and construct your SQL queries accordingly to submit documents
for indexing
3) Use a real message queue and some receiver that will index the document
   -> This could be the best but also most complicated solution.. when
your application changes an entity, a message is sent on the queue
either with the actual document itself or maybe an ID where you can
re-construct the document for indexing.

There are probably other solutions too but those are the 3 that come
to my mind off hand and where I work, we use #2 with incremental index
processes that check for changes since some last known time and
indexes.

- Amit

On Tue, Sep 25, 2012 at 3:37 AM, Tom Mortimer <tom.m.f...@gmail.com> wrote:
> I'm afraid I don't have any DIH experience myself, but some googling suggests 
> that using a postgresql trigger to start a delta import might be one approach:
>
> http://wiki.apache.org/solr/DataImportHandler#Using_delta-import_command  and
> http://wiki.apache.org/solr/DataImportHandlerDeltaQueryViaFullImport
>
> Tom
>
> On 25 Sep 2012, at 11:28, darshan <dk...@dreamsoftech.com> wrote:
>
>> My Document is Database(yes RDBMS) and software for it is postgresql, where
>> any change in it's table should be reflected, without re-indexing. I am
>> indexing it via DIH process
>> Thanks,
>> Darshan
>>
>> -----Original Message-----
>> From: Tom Mortimer [mailto:tom.m.f...@gmail.com]
>> Sent: Tuesday, September 25, 2012 3:31 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: AutoIndexing
>>
>> Hi Darshan,
>>
>> Can you give us some more details, e.g. what do you mean by "database"? A
>> RDBMS? Which software? How are you indexing it (or intending to index it) to
>> Solr? etc...
>>
>> cheers,
>> Tom
>>
>>
>> On 25 Sep 2012, at 09:55, darshan <dk...@dreamsoftech.com> wrote:
>>
>>> Hi All,
>>>
>>>               Is there any way where I can auto-index whenever there
>>> is changes in my database.
>>>
>>> Thanks,
>>>
>>> Darshan
>>>
>>
>>
>

Reply via email to