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 jhansiredrowthu <jr...@metanoiasolutions.net> on 2011/10/07 11:58:03 UTC

DeltaQuery for more than one table

Hi All,

    i am new to solr.I have to write a deltaQuery for retriving data from
two tables but i want to mention two tables in a single entity not in
different entites.Can anyone help me.

          Thanks in advance.





Regards,
Jhansi.

--
View this message in context: http://lucene.472066.n3.nabble.com/DeltaQuery-for-more-than-one-table-tp3402393p3402393.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: DeltaQuery for more than one table

Posted by jhansi <jr...@metanoiasolutions.net>.
This is my config file,
<dataConfig>

<dataSource type="JdbcDataSource" name="ds-1" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/sample1" user="root"/>
  <document>
	<entity name="deltaexample,deltafortwo" dataSource ="ds-1" pk="id"
	                query="select deltaexample.id,deltafortwo.id,name as
delname from deltaexample,deltafortwo where deltaexample.id=deltafortwo.id;"
					 deltaImportQuery="select deltaexample.id,name as delname from
deltaexample,deltafortwo where deltaexample.id='${dataimporter.delta.id}'
UNION select deltafortwo.id, keywords as secname from
deltaexample,deltafortwo where deltafortwo.id='${dataimporter.delta.id}';"
					 deltaQuery="select deltaexample.id,name as delname from
deltaexample,deltafortwo where (deltaexample.created_at
>'${dataimporter.last_index_time}' OR deltafortwo.date_created
>'${dataimporter.last_index_time}')AND deltaexample.id=deltafortwo.id;">
					 
					</entity> 	
	   
 </document>
</dataConfig>


and when i update a record in any one table i am getting this response

<?xml version="1.0" encoding="UTF-8" ?> 
- <response>
- <lst name="responseHeader">
  <int name="status">0</int> 
  <int name="QTime">0</int> 
  </lst>
- <lst name="initArgs">
- <lst name="defaults">
  <str name="config">db-data-configTwoTablej.xml</str> 
  </lst>
  </lst>
  <str name="command">delta-import</str> 
  <str name="status">idle</str> 
  <str name="importResponse" /> 
- <lst name="statusMessages">
  <str name="Total Requests made to DataSource">2</str> 
  <str name="Total Rows Fetched">3</str> 
  <str name="Total Documents Skipped">0</str> 
  <str name="Delta Dump started">2011-10-10 10:16:18</str> 
  <str name="Identifying Delta">2011-10-10 10:16:18</str> 
  <str name="Deltas Obtained">2011-10-10 10:16:18</str> 
  <str name="Building documents">2011-10-10 10:16:18</str> 
  <str name="Total Changed Documents">1</str> 
  <str name="">Indexing completed. Added/Updated: 2 documents. Deleted 0
documents.</str> 
  <str name="Committed">2011-10-10 10:16:18</str> 
  <str name="Optimized">2011-10-10 10:16:18</str> 
  <str name="Total Documents Processed">2</str> 
  <str name="Time taken">0:0:0.125</str> 
  </lst>
  <str name="WARNING">This response format is experimental. It is likely to
change in the future.</str> 
  </response>

Here even i updated a single record in database i am getting two documents
are proceessed instead of one document processed.


-----
Regards,
Jhansi.
--
View this message in context: http://lucene.472066.n3.nabble.com/DeltaQuery-for-more-than-one-table-tp3402393p3408680.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: DeltaQuery for more than one table

Posted by Gora Mohanty <go...@mimirtech.com>.
On Fri, Oct 7, 2011 at 3:28 PM, jhansiredrowthu
<jr...@metanoiasolutions.net> wrote:
> Hi All,
>
>    i am new to solr.I have to write a deltaQuery for retriving data from
> two tables but i want to mention two tables in a single entity not in
> different entites.Can anyone help me.

Do you mean a JOIN across two tables? Could you give an example
of the SELECT statement that you would use if you were querying the
database directly?

Regards,
Gora