You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@lucene.apache.org by jawedshamshedi <ja...@gmail.com> on 2011/11/18 10:50:59 UTC
Create index on two unrelated table in Solr
Hi All,
I want to create index between two tables, stock and auction. Basically I am
working on a product site. So I have to create index on both tables. and
they are not related at all.
In data-config.xml, that I created to create index, I wrote the following
code
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/lc" user="root" password=""/>
<document name="content">
<entity name="stock" query="select
ST_StockID,ST_StockCode,ST_Name,ST_ItemDetail from stock where estatus =
'Active' limit 100">
<field column="ST_StockID" name="stock_ST_StockID" />
<field column="ST_StockCode" name="stock_ST_StockCode" />
<field column="ST_Name" name="stock_ST_Name" />
<field column="ST_ItemDetail" name="stock_ST_ItemDetail" />
</entity>
<entity name="auction" query="select
iauctionid,rad_number,vsku,auction_code from auction limit 100">
<field column="iauctionid" name="auction_iauctionid" />
<field column="rad_number" name="auction_rad_number" />
<field column="vsku" name="auction_vsku" />
<field column="auction_code" name="auction_auction_code" />
</entity>
</document>
</dataConfig>
and the schema.xml contains the fields are given below.
<fields>
<field name="stock_ST_StockID" type="string" indexed="true" stored="true"
required="true"/>
<field name="stock_ST_StockCode" type="string" indexed="true"
stored="true" required="true"/>
<field name="stock_ST_Name" type="string" indexed="true" stored="true"
required="true"/>
<field name="stock_ST_ItemDetail" type="text" indexed="true"
stored="true" required="true"/>
<field name="auction_iauctionid" type="string" indexed="true"
stored="true" required="true"/>
<field name="auction_rad_number" type="string" indexed="true"
stored="true" required="true"/>
<field name="auction_vsku" type="string" indexed="true" stored="true"
required="true"/>
<field name="auction_auction_code" type="text" indexed="true"
stored="true" required="true"/>
<fields>
<uniqueKey>stock_ST_StockID</uniqueKey>
<defaultSearchField>stock_ST_ItemDetail</defaultSearchField>
And when I hit this url :
http://192.168.1.48:8983/solr/dataimport?command=full-import
I get the below xml is response.
<response>
−
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
</lst>
−
<lst name="initArgs">
−
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</lst>
<str name="command">full-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">200</str>
<str name="Total Documents Skipped">0</str>
<str name="Full Dump Started">2011-11-18 15:14:55</str>
−
<str name="">
Indexing completed. Added/Updated: 0 documents. Deleted 0 documents.
</str>
<str name="Committed">2011-11-18 15:14:55</str>
<str name="Optimized">2011-11-18 15:14:55</str>
<str name="Total Documents Processed">0</str>
<str name="Time taken ">0:0:0.47</str>
</lst>
−
<str name="WARNING">
This response format is experimental. It is likely to change in the future.
</str>
</response>
Any help will be appreciated .
Thanks
--
View this message in context: http://lucene.472066.n3.nabble.com/Create-index-on-two-unrelated-table-in-Solr-tp3518202p3518202.html
Sent from the Lucene - General mailing list archive at Nabble.com.
Re: Create index on two unrelated table in Solr
Posted by Chris Hostetter <ho...@fucit.org>.
: I want to create index between two tables, stock and auction. Basically I am
: working on a product site. So I have to create index on both tables. and
: they are not related at all.
:
: In data-config.xml, that I created to create index, I wrote the following
: code
If you check your logs, you should see quite a few errors...
: <field name="stock_ST_StockCode" type="string" indexed="true"
: stored="true" required="true"/>
you've made many other "stock_*" fields required, but none of your
"auction" documents have those field, so they will all be rejected.
: <field name="auction_iauctionid" type="string" indexed="true"
: stored="true" required="true"/>
you've made several "auction_*" fields required, but none of your "stock"
documents have those field, so they will all be rejected.
: <uniqueKey>stock_ST_StockID</uniqueKey>
Since stock_ST_StockID is the uniqueKey field, all "auction" documents
will still be rejected for not having the uniqueKey field even if you
modify it's <field/> declaration to no longer be required.
FWIW: Future questions about Solr should be sent to the solr-user@lucene
mailing list (which has more subscribers and is more likeley to generate
responses). general@lucene is for discussions about the broader Lucene
project as a whole.
-Hoss