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 Ashish P <as...@gmail.com> on 2009/03/10 06:01:19 UTC

Querying DB indexed data

Hi,
I performed steps given in http://wiki.apache.org/solr/DataImportHandler to
index data from database.

the data-config.xml is 
<dataConfig>
	<dataSource driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
	url="jdbc:sqlserver://192.168.1.120:1433;DatabaseName=g2" user="sa"
password="mima1234@" />
<document name="user">
	<entity name="t_user_principle" query="select * from t_user_principle">
		<field column="user_name" name="user_name" />
		<field column="is_logged_in" name="is_logged_in"/>
		<field column="distinguished_name" name="distinguished_name"/>
	</entity>
</document>
</dataConfig>

now I am able to view data that is indexed using URL
http://localhost:8080/solr/admin/dataimport.jsp to see the data as
<arr>
- <arr>
  <str>user1</str> 
  </arr>
- <arr>
  <str>0</str> 
  </arr>
- <arr>
  <str>CN=user1,OU=R&D</str> 
  </arr>
  </arr>

But when I search user_name:user1 then the result is not returned at all.
Am I missing something here??? Please help.
Thanks,
Ashish


-- 
View this message in context: http://www.nabble.com/Querying-DB-indexed-data-tp22428120p22428120.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Querying DB indexed data

Posted by Ashish P <as...@gmail.com>.
Hi Shalin,
Got the answer. I had uniquekey defined in schema.xml but that was not
present in any columns hence problem for indexing.
Thanks a lot for your help buddy.
Cheers,
Ashish

Ashish P wrote:
> 
> yes I did full import. so previous docs are gone as you said.
> But when I do  http://localhost:8080/solr/dataimport I get following
> 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">my-dataConfig.xml</str> 
>   </lst>
>   </lst>
>   <str name="status">idle</str> 
>   <str name="importResponse" /> 
> - <lst name="statusMessages">
>   <str name="Total Requests made to DataSource">1</str> 
>   <str name="Total Rows Fetched">119</str> 
>   <str name="Total Documents Skipped">0</str> 
>   <str name="Full Dump Started">2009-03-10 14:49:58</str> 
>   <str name="">Indexing completed. Added/Updated: 0 documents. Deleted 0
> documents.</str> 
>   <str name="Committed">2009-03-10 14:49:58</str> 
>   <str name="Optimized">2009-03-10 14:49:58</str> 
>   <str name="Time taken">0:0:0.141</str> 
>   </lst>
>   <str name="WARNING">This response format is experimental. It is likely
> to change in the future.</str> 
>   </response>
> 
> I shows imported row numbers, indexing complete buts adds 0 documents.
> Does that suggest anything..
> 
> 
> Shalin Shekhar Mangar wrote:
>> 
>> On Tue, Mar 10, 2009 at 11:01 AM, Ashish P <as...@gmail.com>
>> wrote:
>> 
>>>
>>> Oh looks like some other big problem, Now I am not able to see other
>>> text
>>> data I indexed before adding DB data to index...
>>> Can not search any data...But I am sure I was able to search before
>>> adding
>>> DB to index
>>> Any pointers???
>>>
>>>
>> So you added some documents before running a full-import with
>> DataImportHandler? When you do a full-import, all previous documents are
>> deleted. That may be a reason.
>> 
>> However, there should be some documents which DataImportHandler created.
>> 
>> -- 
>> Regards,
>> Shalin Shekhar Mangar.
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Querying-DB-indexed-data-tp22428120p22428615.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Querying DB indexed data

Posted by Ashish P <as...@gmail.com>.
yes I did full import. so previous docs are gone as you said.
But when I do  http://localhost:8080/solr/dataimport I get following
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">my-dataConfig.xml</str> 
  </lst>
  </lst>
  <str name="status">idle</str> 
  <str name="importResponse" /> 
- <lst name="statusMessages">
  <str name="Total Requests made to DataSource">1</str> 
  <str name="Total Rows Fetched">119</str> 
  <str name="Total Documents Skipped">0</str> 
  <str name="Full Dump Started">2009-03-10 14:49:58</str> 
  <str name="">Indexing completed. Added/Updated: 0 documents. Deleted 0
documents.</str> 
  <str name="Committed">2009-03-10 14:49:58</str> 
  <str name="Optimized">2009-03-10 14:49:58</str> 
  <str name="Time taken">0:0:0.141</str> 
  </lst>
  <str name="WARNING">This response format is experimental. It is likely to
change in the future.</str> 
  </response>

I shows imported row numbers, indexing complete buts adds 0 documents. Does
that suggest anything..


Shalin Shekhar Mangar wrote:
> 
> On Tue, Mar 10, 2009 at 11:01 AM, Ashish P <as...@gmail.com>
> wrote:
> 
>>
>> Oh looks like some other big problem, Now I am not able to see other text
>> data I indexed before adding DB data to index...
>> Can not search any data...But I am sure I was able to search before
>> adding
>> DB to index
>> Any pointers???
>>
>>
> So you added some documents before running a full-import with
> DataImportHandler? When you do a full-import, all previous documents are
> deleted. That may be a reason.
> 
> However, there should be some documents which DataImportHandler created.
> 
> -- 
> Regards,
> Shalin Shekhar Mangar.
> 
> 

-- 
View this message in context: http://www.nabble.com/Querying-DB-indexed-data-tp22428120p22428518.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Querying DB indexed data

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Tue, Mar 10, 2009 at 11:01 AM, Ashish P <as...@gmail.com> wrote:

>
> Oh looks like some other big problem, Now I am not able to see other text
> data I indexed before adding DB data to index...
> Can not search any data...But I am sure I was able to search before adding
> DB to index
> Any pointers???
>
>
So you added some documents before running a full-import with
DataImportHandler? When you do a full-import, all previous documents are
deleted. That may be a reason.

However, there should be some documents which DataImportHandler created.

-- 
Regards,
Shalin Shekhar Mangar.

Re: Querying DB indexed data

Posted by Ashish P <as...@gmail.com>.
Oh looks like some other big problem, Now I am not able to see other text
data I indexed before adding DB data to index...
Can not search any data...But I am sure I was able to search before adding
DB to index
Any pointers???



Shalin Shekhar Mangar wrote:
> 
> On Tue, Mar 10, 2009 at 10:48 AM, Ashish P <as...@gmail.com>
> wrote:
> 
>>
>>
>> In schema xml, I have defined following...
>> <field name="user_name" type="string" indexed="true" stored="true"/>
>>        <field name="is_logged_in" type="string" indexed="true"
>> stored="true" />
>>        <field name="distinguished_name" type="string" indexed="true"
>> stored="true" />
>> Thanks,
>> Ashish
>>
>>
> If you search for *:* from the admin, do you see documents with user_name
> name1 present?
> 
> -- 
> Regards,
> Shalin Shekhar Mangar.
> 
> 

-- 
View this message in context: http://www.nabble.com/Querying-DB-indexed-data-tp22428120p22428364.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Querying DB indexed data

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Tue, Mar 10, 2009 at 10:48 AM, Ashish P <as...@gmail.com> wrote:

>
>
> In schema xml, I have defined following...
> <field name="user_name" type="string" indexed="true" stored="true"/>
>        <field name="is_logged_in" type="string" indexed="true"
> stored="true" />
>        <field name="distinguished_name" type="string" indexed="true"
> stored="true" />
> Thanks,
> Ashish
>
>
If you search for *:* from the admin, do you see documents with user_name
name1 present?

-- 
Regards,
Shalin Shekhar Mangar.

Re: Querying DB indexed data

Posted by Ashish P <as...@gmail.com>.

In schema xml, I have defined following...
<field name="user_name" type="string" indexed="true" stored="true"/>
        <field name="is_logged_in" type="string" indexed="true"
stored="true" />
        <field name="distinguished_name" type="string" indexed="true"
stored="true" />
Thanks,
Ashish


Shalin Shekhar Mangar wrote:
> 
> On Tue, Mar 10, 2009 at 10:31 AM, Ashish P <as...@gmail.com>
> wrote:
> 
>> now I am able to view data that is indexed using URL
>> http://localhost:8080/solr/admin/dataimport.jsp to see the data as
>> <arr>
>> - <arr>
>>  <str>user1</str>
>>  </arr>
>> - <arr>
>>  <str>0</str>
>>  </arr>
>> - <arr>
>>  <str>CN=user1,OU=R&D</str>
>>  </arr>
>>  </arr>
>>
>> But when I search user_name:user1 then the result is not returned at all.
>>
> 
> What is the type of the user_name field as defined in schema.xml?
> 
> -- 
> Regards,
> Shalin Shekhar Mangar.
> 
> 

-- 
View this message in context: http://www.nabble.com/Querying-DB-indexed-data-tp22428120p22428239.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Querying DB indexed data

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Tue, Mar 10, 2009 at 10:31 AM, Ashish P <as...@gmail.com> wrote:

> now I am able to view data that is indexed using URL
> http://localhost:8080/solr/admin/dataimport.jsp to see the data as
> <arr>
> - <arr>
>  <str>user1</str>
>  </arr>
> - <arr>
>  <str>0</str>
>  </arr>
> - <arr>
>  <str>CN=user1,OU=R&D</str>
>  </arr>
>  </arr>
>
> But when I search user_name:user1 then the result is not returned at all.
>

What is the type of the user_name field as defined in schema.xml?

-- 
Regards,
Shalin Shekhar Mangar.