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 vighnesh <sv...@gmail.com> on 2011/08/26 11:41:59 UTC

how to differentiate multiple datasources when building solr query....

hi all

I have a two data sources in data-config file and i need data from first
datasource , second datasource and from both .how can acheive this in solr
query.

example like: first datasource:

http://localhost:8983/solr/db/select/?q=newthread&version=2.2&start=0&rows=200&indent=on&datasource=datasource-1

example like: second datasource:

http://localhost:8983/solr/db/select/?q=newthread&version=2.2&start=0&rows=200&indent=on&datasource=datasource-1

example like: both datasources:

http://localhost:8983/solr/db/select/?q=newthread&version=2.2&start=0&rows=200&indent=on&datasource=datasource-1&datasource=datasource-1

is this querys are correct or not ? plese let me know that.


thanks in advance.

--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-differentiate-multiple-datasources-when-building-solr-query-tp3286309p3286309.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to differentiate multiple datasources when building solr query....

Posted by vighnesh <sv...@gmail.com>.
yes those are two data-sources name .
how can i get the data from only datasource-1 or from data source-2 or from
both

--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-differentiate-multiple-datasources-when-building-solr-query-tp3286309p3286325.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to differentiate multiple datasources when building solr query....

Posted by Lance Norskog <go...@gmail.com>.
Did you mean datasource-1 and datasource-2 ?

On Fri, Aug 26, 2011 at 2:41 AM, vighnesh <sv...@gmail.com> wrote:

> hi all
>
> I have a two data sources in data-config file and i need data from first
> datasource , second datasource and from both .how can acheive this in solr
> query.
>
> example like: first datasource:
>
>
> http://localhost:8983/solr/db/select/?q=newthread&version=2.2&start=0&rows=200&indent=on&datasource=datasource-1
>
> example like: second datasource:
>
>
> http://localhost:8983/solr/db/select/?q=newthread&version=2.2&start=0&rows=200&indent=on&datasource=datasource-1
>
> example like: both datasources:
>
>
> http://localhost:8983/solr/db/select/?q=newthread&version=2.2&start=0&rows=200&indent=on&datasource=datasource-1&datasource=datasource-1
>
> is this querys are correct or not ? plese let me know that.
>
>
> thanks in advance.
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/how-to-differentiate-multiple-datasources-when-building-solr-query-tp3286309p3286309.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Lance Norskog
goksron@gmail.com

Re: how to differentiate multiple datasources when building solr query....

Posted by vighnesh <sv...@gmail.com>.
thanx for giving response 

i am unable to configure this please provide any samples code for how to use
template transformer

--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-differentiate-multiple-datasources-when-building-solr-query-tp3286309p3286816.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to differentiate multiple datasources when building solr query....

Posted by Erick Erickson <er...@gmail.com>.
Although I'd really recommend using underscore rather than hyphen,
since '-' is a query operator and it'll mess you up *sometime* <G>...

 Best
Erick

On Fri, Aug 26, 2011 at 8:43 AM, Erik Hatcher <er...@gmail.com> wrote:
> Vighnesh -
>
> What you're looking for is DataImportHandler's TemplateTransformer.  Docs here: <http://wiki.apache.org/solr/DataImportHandler#TemplateTransformer>
>
> Basically just enable the TemplateTransformer in each of your DIH configs then set a literal field value like this differently for each source:
>
>   <field column="datasource" template="datasource-1" />
>
> Be sure you have a datasource (string field type) field in your schema.  Reindex.
>
> Then you can fq=datasource:datasource-1 and facet on it and so on since it is a normal field on all documents.
>
>        Erik
>
> On Aug 26, 2011, at 05:41 , vighnesh wrote:
>
>> hi all
>>
>> I have a two data sources in data-config file and i need data from first
>> datasource , second datasource and from both .how can acheive this in solr
>> query.
>>
>> example like: first datasource:
>>
>> http://localhost:8983/solr/db/select/?q=newthread&version=2.2&start=0&rows=200&indent=on&datasource=datasource-1
>>
>> example like: second datasource:
>>
>> http://localhost:8983/solr/db/select/?q=newthread&version=2.2&start=0&rows=200&indent=on&datasource=datasource-1
>>
>> example like: both datasources:
>>
>> http://localhost:8983/solr/db/select/?q=newthread&version=2.2&start=0&rows=200&indent=on&datasource=datasource-1&datasource=datasource-1
>>
>> is this querys are correct or not ? plese let me know that.
>>
>>
>> thanks in advance.
>>
>> --
>> View this message in context: http://lucene.472066.n3.nabble.com/how-to-differentiate-multiple-datasources-when-building-solr-query-tp3286309p3286309.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>
>

Re: how to differentiate multiple datasources when building solr query....

Posted by Erik Hatcher <er...@gmail.com>.
Vighnesh -

What you're looking for is DataImportHandler's TemplateTransformer.  Docs here: <http://wiki.apache.org/solr/DataImportHandler#TemplateTransformer>

Basically just enable the TemplateTransformer in each of your DIH configs then set a literal field value like this differently for each source:

   <field column="datasource" template="datasource-1" />

Be sure you have a datasource (string field type) field in your schema.  Reindex.

Then you can fq=datasource:datasource-1 and facet on it and so on since it is a normal field on all documents.

	Erik

On Aug 26, 2011, at 05:41 , vighnesh wrote:

> hi all
> 
> I have a two data sources in data-config file and i need data from first
> datasource , second datasource and from both .how can acheive this in solr
> query.
> 
> example like: first datasource:
> 
> http://localhost:8983/solr/db/select/?q=newthread&version=2.2&start=0&rows=200&indent=on&datasource=datasource-1
> 
> example like: second datasource:
> 
> http://localhost:8983/solr/db/select/?q=newthread&version=2.2&start=0&rows=200&indent=on&datasource=datasource-1
> 
> example like: both datasources:
> 
> http://localhost:8983/solr/db/select/?q=newthread&version=2.2&start=0&rows=200&indent=on&datasource=datasource-1&datasource=datasource-1
> 
> is this querys are correct or not ? plese let me know that.
> 
> 
> thanks in advance.
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/how-to-differentiate-multiple-datasources-when-building-solr-query-tp3286309p3286309.html
> Sent from the Solr - User mailing list archive at Nabble.com.