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 Ninad Raut <hb...@gmail.com> on 2009/08/11 06:59:12 UTC

Querying Dynamic Fields.. simple query not working

Hi,
when I do a *:* query I can see the dynamic field as show below:
<str name="ne_.*">{Germinait=0.7}</str>
but when I try to query for the same like ne_Germinait:0.7 I get zero
records.
All the other field which are not dynamic can be easily queried.
Can some one please tell me how to query for dynamic fields?
Thanks.
Ninad.

Re: Querying Dynamic Fields.. simple query not working

Posted by Avlesh Singh <av...@gmail.com>.
Well there are multiple ways to do it.
Instead of using your own class (with annotated fields), you can directly
use an instance of SolrInputDocument for each document and call a
SolrServer.add(SolrInputDocument doc). For each SolrInputDocument, you can
use the addField(String name, Object value) to add data per field. For
dynamic fields, just pass in the full field name, "Germinait_ne" in your
case, as the first argument and 0.7 as the second one.

Search the way you were doing earlier.

Cheers
Avlesh

On Tue, Aug 11, 2009 at 11:20 AM, Ninad Raut <hb...@gmail.com>wrote:

> Hi Avlesh,
> Can you tell me a work around to this problem?? Till you have this
> resolved.:)
> Regards,
> Ninad.
>
> On Tue, Aug 11, 2009 at 11:16 AM, Avlesh Singh <av...@gmail.com> wrote:
>
> > Ah! I guessed you were using it this way.
> >
> > I would need to reconfirm this, but there seems to be an inconsistency in
> > fetching data versus adding data via SolrJ w.r.t dynamic fields.
> > SOLR-1129<https://issues.apache.org/jira/browse/SOLR-1129>is
> > essentially about binding the response into a bean with a "Map" type
> > property. My guess is that SolrInputDocument is yet to "understand" the
> map
> > type property while firing update requests. I don't think it works in the
> > way you have used it :(
> >
> > Noble, can you please confirm this? If my guess turns out to be true,
> lets
> > open a JIRA issue asap.
> >
> > Cheers
> > Avlesh
> >
> > On Tue, Aug 11, 2009 at 10:45 AM, Ninad Raut <hbase.user.ninad@gmail.com
> > >wrote:
> >
> > > This is the POJO field mapping:
> > > @Field("*_ne")
> > > Map<String,String> ne = new HashMap<String,String>();
> > > this is how I set the value:
> > > Map<String,String> namedEntity = new HashMap<String,String>();
> > >  namedEntity.put("Germinait", "0.7");
> > >  ithursDocument.setNe(namedEntity);
> > >  server.addBean(ithursDocument);
> > >  server.commit();
> > > The schema had this dynamic field:
> > >  <dynamicField name="ne_*" type="string" indexed="true" stored="true"/>
> > > Let me know if something is missing. Thanks Avlesh.
> > > On Tue, Aug 11, 2009 at 10:34 AM, Avlesh Singh <av...@gmail.com>
> wrote:
> > >
> > > > Weird that you get to see a field name like "ne_.*" in the response.
> I
> > am
> > > > afraid that you might be using the field in an incorrect way.
> > > > Can you share the field definition please? And a peek into how are
> you
> > > > populating these fields?
> > > >
> > > > Cheers
> > > > Avlesh
> > > >
> > > > On Tue, Aug 11, 2009 at 10:29 AM, Ninad Raut <
> > hbase.user.ninad@gmail.com
> > > > >wrote:
> > > >
> > > > > Hi,
> > > > > when I do a *:* query I can see the dynamic field as show below:
> > > > > <str name="ne_.*">{Germinait=0.7}</str>
> > > > > but when I try to query for the same like ne_Germinait:0.7 I get
> zero
> > > > > records.
> > > > > All the other field which are not dynamic can be easily queried.
> > > > > Can some one please tell me how to query for dynamic fields?
> > > > > Thanks.
> > > > > Ninad.
> > > > >
> > > >
> > >
> >
>

Re: Querying Dynamic Fields.. simple query not working

Posted by Ninad Raut <hb...@gmail.com>.
Hi Avlesh,
Can you tell me a work around to this problem?? Till you have this
resolved.:)
Regards,
Ninad.

On Tue, Aug 11, 2009 at 11:16 AM, Avlesh Singh <av...@gmail.com> wrote:

> Ah! I guessed you were using it this way.
>
> I would need to reconfirm this, but there seems to be an inconsistency in
> fetching data versus adding data via SolrJ w.r.t dynamic fields.
> SOLR-1129<https://issues.apache.org/jira/browse/SOLR-1129>is
> essentially about binding the response into a bean with a "Map" type
> property. My guess is that SolrInputDocument is yet to "understand" the map
> type property while firing update requests. I don't think it works in the
> way you have used it :(
>
> Noble, can you please confirm this? If my guess turns out to be true, lets
> open a JIRA issue asap.
>
> Cheers
> Avlesh
>
> On Tue, Aug 11, 2009 at 10:45 AM, Ninad Raut <hbase.user.ninad@gmail.com
> >wrote:
>
> > This is the POJO field mapping:
> > @Field("*_ne")
> > Map<String,String> ne = new HashMap<String,String>();
> > this is how I set the value:
> > Map<String,String> namedEntity = new HashMap<String,String>();
> >  namedEntity.put("Germinait", "0.7");
> >  ithursDocument.setNe(namedEntity);
> >  server.addBean(ithursDocument);
> >  server.commit();
> > The schema had this dynamic field:
> >  <dynamicField name="ne_*" type="string" indexed="true" stored="true"/>
> > Let me know if something is missing. Thanks Avlesh.
> > On Tue, Aug 11, 2009 at 10:34 AM, Avlesh Singh <av...@gmail.com> wrote:
> >
> > > Weird that you get to see a field name like "ne_.*" in the response. I
> am
> > > afraid that you might be using the field in an incorrect way.
> > > Can you share the field definition please? And a peek into how are you
> > > populating these fields?
> > >
> > > Cheers
> > > Avlesh
> > >
> > > On Tue, Aug 11, 2009 at 10:29 AM, Ninad Raut <
> hbase.user.ninad@gmail.com
> > > >wrote:
> > >
> > > > Hi,
> > > > when I do a *:* query I can see the dynamic field as show below:
> > > > <str name="ne_.*">{Germinait=0.7}</str>
> > > > but when I try to query for the same like ne_Germinait:0.7 I get zero
> > > > records.
> > > > All the other field which are not dynamic can be easily queried.
> > > > Can some one please tell me how to query for dynamic fields?
> > > > Thanks.
> > > > Ninad.
> > > >
> > >
> >
>

Re: Querying Dynamic Fields.. simple query not working

Posted by Avlesh Singh <av...@gmail.com>.
SOLR-1129 was for a different use case, Ninad.
I have created an issue for this enhancement -
https://issues.apache.org/jira/browse/SOLR-1357

Cheers
Avlesh

On Tue, Aug 11, 2009 at 12:09 PM, Ninad Raut <hb...@gmail.com>wrote:

> Hi,
> SOLR-1129<https://issues.apache.org/jira/browse/SOLR-1129> seems to have
> been solved . Can I apply the patch?
>
> 2009/8/11 Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>
>
> > On Tue, Aug 11, 2009 at 11:16 AM, Avlesh Singh<av...@gmail.com> wrote:
> > > Ah! I guessed you were using it this way.
> > >
> > > I would need to reconfirm this, but there seems to be an inconsistency
> in
> > > fetching data versus adding data via SolrJ w.r.t dynamic fields.
> > > SOLR-1129<https://issues.apache.org/jira/browse/SOLR-1129>is
> > > essentially about binding the response into a bean with a "Map" type
> > > property. My guess is that SolrInputDocument is yet to "understand" the
> > map
> > > type property while firing update requests. I don't think it works in
> the
> > > way you have used it :(
> > >
> > > Noble, can you please confirm this? If my guess turns out to be true,
> > lets
> > > open a JIRA issue asap.
> > I checked the code . it is not yet supported Object->SolrInputDocument
> > is not yet for supported for dynamic fields
> > >
> > > Cheers
> > > Avlesh
> > >
> > > On Tue, Aug 11, 2009 at 10:45 AM, Ninad Raut <
> hbase.user.ninad@gmail.com
> > >wrote:
> > >
> > >> This is the POJO field mapping:
> > >> @Field("*_ne")
> > >> Map<String,String> ne = new HashMap<String,String>();
> > >> this is how I set the value:
> > >> Map<String,String> namedEntity = new HashMap<String,String>();
> > >>  namedEntity.put("Germinait", "0.7");
> > >>  ithursDocument.setNe(namedEntity);
> > >>  server.addBean(ithursDocument);
> > >>  server.commit();
> > >> The schema had this dynamic field:
> > >>  <dynamicField name="ne_*" type="string" indexed="true"
> stored="true"/>
> > >> Let me know if something is missing. Thanks Avlesh.
> > >> On Tue, Aug 11, 2009 at 10:34 AM, Avlesh Singh <av...@gmail.com>
> > wrote:
> > >>
> > >> > Weird that you get to see a field name like "ne_.*" in the response.
> I
> > am
> > >> > afraid that you might be using the field in an incorrect way.
> > >> > Can you share the field definition please? And a peek into how are
> you
> > >> > populating these fields?
> > >> >
> > >> > Cheers
> > >> > Avlesh
> > >> >
> > >> > On Tue, Aug 11, 2009 at 10:29 AM, Ninad Raut <
> > hbase.user.ninad@gmail.com
> > >> > >wrote:
> > >> >
> > >> > > Hi,
> > >> > > when I do a *:* query I can see the dynamic field as show below:
> > >> > > <str name="ne_.*">{Germinait=0.7}</str>
> > >> > > but when I try to query for the same like ne_Germinait:0.7 I get
> > zero
> > >> > > records.
> > >> > > All the other field which are not dynamic can be easily queried.
> > >> > > Can some one please tell me how to query for dynamic fields?
> > >> > > Thanks.
> > >> > > Ninad.
> > >> > >
> > >> >
> > >>
> > >
> >
> >
> >
> > --
> > -----------------------------------------------------
> > Noble Paul | Principal Engineer| AOL | http://aol.com
> >
>

Re: Querying Dynamic Fields.. simple query not working

Posted by Ninad Raut <hb...@gmail.com>.
Hi,
SOLR-1129<https://issues.apache.org/jira/browse/SOLR-1129> seems to have
been solved . Can I apply the patch?

2009/8/11 Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>

> On Tue, Aug 11, 2009 at 11:16 AM, Avlesh Singh<av...@gmail.com> wrote:
> > Ah! I guessed you were using it this way.
> >
> > I would need to reconfirm this, but there seems to be an inconsistency in
> > fetching data versus adding data via SolrJ w.r.t dynamic fields.
> > SOLR-1129<https://issues.apache.org/jira/browse/SOLR-1129>is
> > essentially about binding the response into a bean with a "Map" type
> > property. My guess is that SolrInputDocument is yet to "understand" the
> map
> > type property while firing update requests. I don't think it works in the
> > way you have used it :(
> >
> > Noble, can you please confirm this? If my guess turns out to be true,
> lets
> > open a JIRA issue asap.
> I checked the code . it is not yet supported Object->SolrInputDocument
> is not yet for supported for dynamic fields
> >
> > Cheers
> > Avlesh
> >
> > On Tue, Aug 11, 2009 at 10:45 AM, Ninad Raut <hbase.user.ninad@gmail.com
> >wrote:
> >
> >> This is the POJO field mapping:
> >> @Field("*_ne")
> >> Map<String,String> ne = new HashMap<String,String>();
> >> this is how I set the value:
> >> Map<String,String> namedEntity = new HashMap<String,String>();
> >>  namedEntity.put("Germinait", "0.7");
> >>  ithursDocument.setNe(namedEntity);
> >>  server.addBean(ithursDocument);
> >>  server.commit();
> >> The schema had this dynamic field:
> >>  <dynamicField name="ne_*" type="string" indexed="true" stored="true"/>
> >> Let me know if something is missing. Thanks Avlesh.
> >> On Tue, Aug 11, 2009 at 10:34 AM, Avlesh Singh <av...@gmail.com>
> wrote:
> >>
> >> > Weird that you get to see a field name like "ne_.*" in the response. I
> am
> >> > afraid that you might be using the field in an incorrect way.
> >> > Can you share the field definition please? And a peek into how are you
> >> > populating these fields?
> >> >
> >> > Cheers
> >> > Avlesh
> >> >
> >> > On Tue, Aug 11, 2009 at 10:29 AM, Ninad Raut <
> hbase.user.ninad@gmail.com
> >> > >wrote:
> >> >
> >> > > Hi,
> >> > > when I do a *:* query I can see the dynamic field as show below:
> >> > > <str name="ne_.*">{Germinait=0.7}</str>
> >> > > but when I try to query for the same like ne_Germinait:0.7 I get
> zero
> >> > > records.
> >> > > All the other field which are not dynamic can be easily queried.
> >> > > Can some one please tell me how to query for dynamic fields?
> >> > > Thanks.
> >> > > Ninad.
> >> > >
> >> >
> >>
> >
>
>
>
> --
> -----------------------------------------------------
> Noble Paul | Principal Engineer| AOL | http://aol.com
>

Re: Querying Dynamic Fields.. simple query not working

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
On Tue, Aug 11, 2009 at 11:16 AM, Avlesh Singh<av...@gmail.com> wrote:
> Ah! I guessed you were using it this way.
>
> I would need to reconfirm this, but there seems to be an inconsistency in
> fetching data versus adding data via SolrJ w.r.t dynamic fields.
> SOLR-1129<https://issues.apache.org/jira/browse/SOLR-1129>is
> essentially about binding the response into a bean with a "Map" type
> property. My guess is that SolrInputDocument is yet to "understand" the map
> type property while firing update requests. I don't think it works in the
> way you have used it :(
>
> Noble, can you please confirm this? If my guess turns out to be true, lets
> open a JIRA issue asap.
I checked the code . it is not yet supported Object->SolrInputDocument
is not yet for supported for dynamic fields
>
> Cheers
> Avlesh
>
> On Tue, Aug 11, 2009 at 10:45 AM, Ninad Raut <hb...@gmail.com>wrote:
>
>> This is the POJO field mapping:
>> @Field("*_ne")
>> Map<String,String> ne = new HashMap<String,String>();
>> this is how I set the value:
>> Map<String,String> namedEntity = new HashMap<String,String>();
>>  namedEntity.put("Germinait", "0.7");
>>  ithursDocument.setNe(namedEntity);
>>  server.addBean(ithursDocument);
>>  server.commit();
>> The schema had this dynamic field:
>>  <dynamicField name="ne_*" type="string" indexed="true" stored="true"/>
>> Let me know if something is missing. Thanks Avlesh.
>> On Tue, Aug 11, 2009 at 10:34 AM, Avlesh Singh <av...@gmail.com> wrote:
>>
>> > Weird that you get to see a field name like "ne_.*" in the response. I am
>> > afraid that you might be using the field in an incorrect way.
>> > Can you share the field definition please? And a peek into how are you
>> > populating these fields?
>> >
>> > Cheers
>> > Avlesh
>> >
>> > On Tue, Aug 11, 2009 at 10:29 AM, Ninad Raut <hbase.user.ninad@gmail.com
>> > >wrote:
>> >
>> > > Hi,
>> > > when I do a *:* query I can see the dynamic field as show below:
>> > > <str name="ne_.*">{Germinait=0.7}</str>
>> > > but when I try to query for the same like ne_Germinait:0.7 I get zero
>> > > records.
>> > > All the other field which are not dynamic can be easily queried.
>> > > Can some one please tell me how to query for dynamic fields?
>> > > Thanks.
>> > > Ninad.
>> > >
>> >
>>
>



-- 
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com

Re: Querying Dynamic Fields.. simple query not working

Posted by Avlesh Singh <av...@gmail.com>.
Ah! I guessed you were using it this way.

I would need to reconfirm this, but there seems to be an inconsistency in
fetching data versus adding data via SolrJ w.r.t dynamic fields.
SOLR-1129<https://issues.apache.org/jira/browse/SOLR-1129>is
essentially about binding the response into a bean with a "Map" type
property. My guess is that SolrInputDocument is yet to "understand" the map
type property while firing update requests. I don't think it works in the
way you have used it :(

Noble, can you please confirm this? If my guess turns out to be true, lets
open a JIRA issue asap.

Cheers
Avlesh

On Tue, Aug 11, 2009 at 10:45 AM, Ninad Raut <hb...@gmail.com>wrote:

> This is the POJO field mapping:
> @Field("*_ne")
> Map<String,String> ne = new HashMap<String,String>();
> this is how I set the value:
> Map<String,String> namedEntity = new HashMap<String,String>();
>  namedEntity.put("Germinait", "0.7");
>  ithursDocument.setNe(namedEntity);
>  server.addBean(ithursDocument);
>  server.commit();
> The schema had this dynamic field:
>  <dynamicField name="ne_*" type="string" indexed="true" stored="true"/>
> Let me know if something is missing. Thanks Avlesh.
> On Tue, Aug 11, 2009 at 10:34 AM, Avlesh Singh <av...@gmail.com> wrote:
>
> > Weird that you get to see a field name like "ne_.*" in the response. I am
> > afraid that you might be using the field in an incorrect way.
> > Can you share the field definition please? And a peek into how are you
> > populating these fields?
> >
> > Cheers
> > Avlesh
> >
> > On Tue, Aug 11, 2009 at 10:29 AM, Ninad Raut <hbase.user.ninad@gmail.com
> > >wrote:
> >
> > > Hi,
> > > when I do a *:* query I can see the dynamic field as show below:
> > > <str name="ne_.*">{Germinait=0.7}</str>
> > > but when I try to query for the same like ne_Germinait:0.7 I get zero
> > > records.
> > > All the other field which are not dynamic can be easily queried.
> > > Can some one please tell me how to query for dynamic fields?
> > > Thanks.
> > > Ninad.
> > >
> >
>

Re: Querying Dynamic Fields.. simple query not working

Posted by Ninad Raut <hb...@gmail.com>.
This is the POJO field mapping:
@Field("*_ne")
Map<String,String> ne = new HashMap<String,String>();
this is how I set the value:
Map<String,String> namedEntity = new HashMap<String,String>();
  namedEntity.put("Germinait", "0.7");
  ithursDocument.setNe(namedEntity);
  server.addBean(ithursDocument);
  server.commit();
The schema had this dynamic field:
 <dynamicField name="ne_*" type="string" indexed="true" stored="true"/>
Let me know if something is missing. Thanks Avlesh.
On Tue, Aug 11, 2009 at 10:34 AM, Avlesh Singh <av...@gmail.com> wrote:

> Weird that you get to see a field name like "ne_.*" in the response. I am
> afraid that you might be using the field in an incorrect way.
> Can you share the field definition please? And a peek into how are you
> populating these fields?
>
> Cheers
> Avlesh
>
> On Tue, Aug 11, 2009 at 10:29 AM, Ninad Raut <hbase.user.ninad@gmail.com
> >wrote:
>
> > Hi,
> > when I do a *:* query I can see the dynamic field as show below:
> > <str name="ne_.*">{Germinait=0.7}</str>
> > but when I try to query for the same like ne_Germinait:0.7 I get zero
> > records.
> > All the other field which are not dynamic can be easily queried.
> > Can some one please tell me how to query for dynamic fields?
> > Thanks.
> > Ninad.
> >
>

Re: Querying Dynamic Fields.. simple query not working

Posted by Avlesh Singh <av...@gmail.com>.
Weird that you get to see a field name like "ne_.*" in the response. I am
afraid that you might be using the field in an incorrect way.
Can you share the field definition please? And a peek into how are you
populating these fields?

Cheers
Avlesh

On Tue, Aug 11, 2009 at 10:29 AM, Ninad Raut <hb...@gmail.com>wrote:

> Hi,
> when I do a *:* query I can see the dynamic field as show below:
> <str name="ne_.*">{Germinait=0.7}</str>
> but when I try to query for the same like ne_Germinait:0.7 I get zero
> records.
> All the other field which are not dynamic can be easily queried.
> Can some one please tell me how to query for dynamic fields?
> Thanks.
> Ninad.
>