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 zakaria benzidalmal <za...@gmail.com> on 2012/11/20 11:40:15 UTC

[Solrj] How can I get unique field name?

Hi all,

I am writing a custom query response writer and I would like to handle the
unique key field without knowing his actual name to stay generic.

My question is: how can I get the uniqueKey fieldname of a result document?


Regards.
______________________
Zakaria BENZIDALMAL

Re: [Solrj] How can I get unique field name?

Posted by zakaria benzidalmal <za...@gmail.com>.
That's right.
Thank you Jack.

Cordialement.
______________________
Zakaria BENZIDALMAL
mobile: 06 31 40 04 33


2012/11/20 Jack Krupansky <ja...@basetechnology.com>

> There is no absolute requirement that a Solr schema have a unique key
> field, so you could get a null value for the field.
>
> -- Jack Krupansky
>
> -----Original Message----- From: zakaria benzidalmal
> Sent: Tuesday, November 20, 2012 6:02 AM
> To: solr-user@lucene.apache.org
> Subject: Re: [Solrj] How can I get unique field name?
>
>
> Thank you Mikhail,
>
> Yes it does.
> I can access it throu the SolrQueryRequest object.
>
> this.uniqueKeyFieldName = req.getSchema().**getUniqueKeyField().getName();
>
>
>
> 2012/11/20 Mikhail Khludnev <mk...@griddynamics.com>
>
>  Hello Zakharia,
>>
>> org.apache.solr.schema.**IndexSchema.getUniqueKeyField(**)
>> Does it help?
>>
>>
>>
>> On Tue, Nov 20, 2012 at 2:40 PM, zakaria benzidalmal <zakibenz@gmail.com
>> >wrote:
>>
>> > Hi all,
>> >
>> > I am writing a custom query response writer and I would like to handle
>> the
>> > unique key field without knowing his actual name to stay generic.
>> >
>> > My question is: how can I get the uniqueKey fieldname of a result
>> document?
>> >
>> >
>> > Regards.
>> > ______________________
>> > Zakaria BENZIDALMAL
>> >
>>
>>
>>
>> --
>> Sincerely yours
>> Mikhail Khludnev
>> Principal Engineer,
>> Grid Dynamics
>>
>> <http://www.griddynamics.com>
>>  <mk...@griddynamics.com>
>>
>>
>

Re: [Solrj] How can I get unique field name?

Posted by Jack Krupansky <ja...@basetechnology.com>.
There is no absolute requirement that a Solr schema have a unique key field, 
so you could get a null value for the field.

-- Jack Krupansky

-----Original Message----- 
From: zakaria benzidalmal
Sent: Tuesday, November 20, 2012 6:02 AM
To: solr-user@lucene.apache.org
Subject: Re: [Solrj] How can I get unique field name?

Thank you Mikhail,

Yes it does.
I can access it throu the SolrQueryRequest object.

this.uniqueKeyFieldName = req.getSchema().getUniqueKeyField().getName();



2012/11/20 Mikhail Khludnev <mk...@griddynamics.com>

> Hello Zakharia,
>
> org.apache.solr.schema.IndexSchema.getUniqueKeyField()
> Does it help?
>
>
>
> On Tue, Nov 20, 2012 at 2:40 PM, zakaria benzidalmal <zakibenz@gmail.com
> >wrote:
>
> > Hi all,
> >
> > I am writing a custom query response writer and I would like to handle
> the
> > unique key field without knowing his actual name to stay generic.
> >
> > My question is: how can I get the uniqueKey fieldname of a result
> document?
> >
> >
> > Regards.
> > ______________________
> > Zakaria BENZIDALMAL
> >
>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
> Principal Engineer,
> Grid Dynamics
>
> <http://www.griddynamics.com>
>  <mk...@griddynamics.com>
> 


Re: [Solrj] How can I get unique field name?

Posted by zakaria benzidalmal <za...@gmail.com>.
Thank you Mikhail,

Yes it does.
I can access it throu the SolrQueryRequest object.

this.uniqueKeyFieldName = req.getSchema().getUniqueKeyField().getName();



2012/11/20 Mikhail Khludnev <mk...@griddynamics.com>

> Hello Zakharia,
>
> org.apache.solr.schema.IndexSchema.getUniqueKeyField()
> Does it help?
>
>
>
> On Tue, Nov 20, 2012 at 2:40 PM, zakaria benzidalmal <zakibenz@gmail.com
> >wrote:
>
> > Hi all,
> >
> > I am writing a custom query response writer and I would like to handle
> the
> > unique key field without knowing his actual name to stay generic.
> >
> > My question is: how can I get the uniqueKey fieldname of a result
> document?
> >
> >
> > Regards.
> > ______________________
> > Zakaria BENZIDALMAL
> >
>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
> Principal Engineer,
> Grid Dynamics
>
> <http://www.griddynamics.com>
>  <mk...@griddynamics.com>
>

Re: [Solrj] How can I get unique field name?

Posted by Mikhail Khludnev <mk...@griddynamics.com>.
Hello Zakharia,

org.apache.solr.schema.IndexSchema.getUniqueKeyField()
Does it help?



On Tue, Nov 20, 2012 at 2:40 PM, zakaria benzidalmal <za...@gmail.com>wrote:

> Hi all,
>
> I am writing a custom query response writer and I would like to handle the
> unique key field without knowing his actual name to stay generic.
>
> My question is: how can I get the uniqueKey fieldname of a result document?
>
>
> Regards.
> ______________________
> Zakaria BENZIDALMAL
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
 <mk...@griddynamics.com>