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 Xi Shen <da...@gmail.com> on 2013/04/24 03:33:02 UTC

How to get/set customized Solr data source properties?

Hi,

I am working on a DataSource implementation. I want to get some customized
properties when the *DataSource.init* method is called. I tried to add the
attributes in the *dataSource* element, but I cannot read it from the
*initProps* object. Either I added the attribute in a wrong element, or I
read the property using a wrong way.

    <dataConfig>
      <dataSource type="com.my.company.datasource"
        my="value" />
      <document>
        <entity name="bankdata" query="test">
          <field column="id" name="id" />
          <field column="col1" name="mycol1" />
...
        </entity>
      </document>
    </dataConfig>

But initProps.getProperty("my") == null.


-- 
Regards,
David Shen

http://about.me/davidshen
https://twitter.com/#!/davidshen84

Re: How to get/set customized Solr data source properties?

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
If the property has a full stop, it is probably going through the
scoped resolver which may be causing issues. I would start with very
basic property name format and see what happens.

Otherwise, it is probably a breakpoint and debug time.

Regards,
   Alex.
Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all
at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
book)


On Mon, May 13, 2013 at 6:08 PM, Chris Hostetter
<ho...@fucit.org> wrote:
>
> : learned it should work. And this is my actual code. I create this
> : DataSource for testing my ideas. I am blocked at the very beginning...sucks
> : :(
>
> but you only showed us one line of code w/o any context.  nothing in your
> email was reproducible for other people to try to compile/run themselves
> to see if htey can figure out why your code isn't working.
>
> : > : I am working on a DataSource implementation. I want to get some
> : > customized
> : > : properties when the *DataSource.init* method is called. I tried to add
> : > the
> : >         ...
> : > :     <dataConfig>
> : > :       <dataSource type="com.my.company.datasource"
> : > :         my="value" />
> : >
> : > My understanding from looking at other DataSources is that should work.
> : >
> : > : But initProps.getProperty("my") == null.
> : >
> : > can you show us some actual that fails with that dataConfig you mentioned?
>
>
> -Hoss

Re: How to get/set customized Solr data source properties?

Posted by Chris Hostetter <ho...@fucit.org>.
: learned it should work. And this is my actual code. I create this
: DataSource for testing my ideas. I am blocked at the very beginning...sucks
: :(

but you only showed us one line of code w/o any context.  nothing in your 
email was reproducible for other people to try to compile/run themselves 
to see if htey can figure out why your code isn't working.

: > : I am working on a DataSource implementation. I want to get some
: > customized
: > : properties when the *DataSource.init* method is called. I tried to add
: > the
: >         ...
: > :     <dataConfig>
: > :       <dataSource type="com.my.company.datasource"
: > :         my="value" />
: >
: > My understanding from looking at other DataSources is that should work.
: >
: > : But initProps.getProperty("my") == null.
: >
: > can you show us some actual that fails with that dataConfig you mentioned?


-Hoss

Re: How to get/set customized Solr data source properties?

Posted by Xi Shen <da...@gmail.com>.
Hi Hoss,

I reviewed the code from other DataSouce classes as well, that's how I
learned it should work. And this is my actual code. I create this
DataSource for testing my ideas. I am blocked at the very beginning...sucks
:(


On Saturday, April 27, 2013, Chris Hostetter wrote:

> :
> : I am working on a DataSource implementation. I want to get some
> customized
> : properties when the *DataSource.init* method is called. I tried to add
> the
>         ...
> :     <dataConfig>
> :       <dataSource type="com.my.company.datasource"
> :         my="value" />
>
> My understanding from looking at other DataSources is that should work.
>
> : But initProps.getProperty("my") == null.
>
> can you show us some actual that fails with that dataConfig you mentioned?
>
>
> -Hoss
>


-- 
Regards,
David Shen

http://about.me/davidshen
https://twitter.com/#!/davidshen84

Re: How to get/set customized Solr data source properties?

Posted by Chris Hostetter <ho...@fucit.org>.
: 
: I am working on a DataSource implementation. I want to get some customized
: properties when the *DataSource.init* method is called. I tried to add the
	...
:     <dataConfig>
:       <dataSource type="com.my.company.datasource"
:         my="value" />

My understanding from looking at other DataSources is that should work.

: But initProps.getProperty("my") == null.

can you show us some actual that fails with that dataConfig you mentioned?


-Hoss