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 Alvaro Cabrerizo <to...@gmail.com> on 2013/11/28 14:59:04 UTC

Expansion of fields in fl parameter

The question:

¿Is there a way to avoid field expansion when adding
fl<http://wiki.apache.org/solr/CommonQueryParameters#fl>parameter to
the request?

The environment:

Solr 4.4 using the next schema.xml

<field name="id" type="string" indexed="true" stored="true" required="true"
/>
<field name="01_text" type="string" indexed="true" stored="true" />
<field name="01text" type="string" indexed="true" stored="true" />
<field name="text" type="string" indexed="true" stored="true"  />

The test has been done importing the next data:

{"id": "1","text": "text","01text": "text","01_text": "text"}

The testing:

Query and response 1:

q=id:1&fl=id,01text

The response includes a field that doesnt exists "01" and an existing one
(text) that I dont want to return.

{"id":"1","text":"text","01text":"text","01":1}

I expect the next response

{"id":"1","01text":"text"}


Query and response 2

q=id:1&fl=id,01_text

 {"id":"1","01_text":"text","01":1}


I expect the next response:


 {"id":"1","01_text":"text"}


In both cases, I just want to return the fields included in fl.

Regards.

Re: Expansion of fields in fl parameter

Posted by Alvaro Cabrerizo <to...@gmail.com>.
Thanks for your answers. The problem with the use of the field function is
that it only works for non multivalued fields.

Regards.
El 28/11/2013 15:54, "Jack Krupansky" <ja...@basetechnology.com> escribió:

> If you have chosen to use improper field names, then in the fl parameter
> you need to reference them using the "field" function:
>
> fl=id,field(01text)
>
> The basic concept is that Solr doesn't ban improper field names, but that
> they don't work in all contexts.
>
> -- Jack Krupansky
>
> -----Original Message----- From: Ahmet Arslan
> Sent: Thursday, November 28, 2013 9:24 AM
> To: solr-user@lucene.apache.org
> Subject: Re: Expansion of fields in fl parameter
>
> Hi Alvaro,
>
> That's really weird. When choosing field names it is recommend to use java
> variable naming conventions.
>
> Can you change field names to text_01 , text01 and try again? Problem
> still exists?
>
> Do you have dynamicField definitions? What happens when you request all
> fields (fl=*)?
>
>
>
>
> On Thursday, November 28, 2013 3:59 PM, Alvaro Cabrerizo <
> toporniz@gmail.com> wrote:
> The question:
>
> ¿Is there a way to avoid field expansion when adding
> fl<http://wiki.apache.org/solr/CommonQueryParameters#fl>parameter to
> the request?
>
> The environment:
>
> Solr 4.4 using the next schema.xml
>
> <field name="id" type="string" indexed="true" stored="true" required="true"
> />
> <field name="01_text" type="string" indexed="true" stored="true" />
> <field name="01text" type="string" indexed="true" stored="true" />
> <field name="text" type="string" indexed="true" stored="true"  />
>
> The test has been done importing the next data:
>
> {"id": "1","text": "text","01text": "text","01_text": "text"}
>
> The testing:
>
> Query and response 1:
>
> q=id:1&fl=id,01text
>
> The response includes a field that doesnt exists "01" and an existing one
> (text) that I dont want to return.
>
> {"id":"1","text":"text","01text":"text","01":1}
>
> I expect the next response
>
> {"id":"1","01text":"text"}
>
>
> Query and response 2
>
> q=id:1&fl=id,01_text
>
> {"id":"1","01_text":"text","01":1}
>
>
> I expect the next response:
>
>
> {"id":"1","01_text":"text"}
>
>
> In both cases, I just want to return the fields included in fl.
>
> Regards.
>

Re: Expansion of fields in fl parameter

Posted by Jack Krupansky <ja...@basetechnology.com>.
If you have chosen to use improper field names, then in the fl parameter you 
need to reference them using the "field" function:

fl=id,field(01text)

The basic concept is that Solr doesn't ban improper field names, but that 
they don't work in all contexts.

-- Jack Krupansky

-----Original Message----- 
From: Ahmet Arslan
Sent: Thursday, November 28, 2013 9:24 AM
To: solr-user@lucene.apache.org
Subject: Re: Expansion of fields in fl parameter

Hi Alvaro,

That's really weird. When choosing field names it is recommend to use java 
variable naming conventions.

Can you change field names to text_01 , text01 and try again? Problem still 
exists?

Do you have dynamicField definitions? What happens when you request all 
fields (fl=*)?




On Thursday, November 28, 2013 3:59 PM, Alvaro Cabrerizo 
<to...@gmail.com> wrote:
The question:

¿Is there a way to avoid field expansion when adding
fl<http://wiki.apache.org/solr/CommonQueryParameters#fl>parameter to
the request?

The environment:

Solr 4.4 using the next schema.xml

<field name="id" type="string" indexed="true" stored="true" required="true"
/>
<field name="01_text" type="string" indexed="true" stored="true" />
<field name="01text" type="string" indexed="true" stored="true" />
<field name="text" type="string" indexed="true" stored="true"  />

The test has been done importing the next data:

{"id": "1","text": "text","01text": "text","01_text": "text"}

The testing:

Query and response 1:

q=id:1&fl=id,01text

The response includes a field that doesnt exists "01" and an existing one
(text) that I dont want to return.

{"id":"1","text":"text","01text":"text","01":1}

I expect the next response

{"id":"1","01text":"text"}


Query and response 2

q=id:1&fl=id,01_text

{"id":"1","01_text":"text","01":1}


I expect the next response:


{"id":"1","01_text":"text"}


In both cases, I just want to return the fields included in fl.

Regards. 


Re: Expansion of fields in fl parameter

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi Alvaro,

That's really weird. When choosing field names it is recommend to use java variable naming conventions.

Can you change field names to text_01 , text01 and try again? Problem still exists?

Do you have dynamicField definitions? What happens when you request all fields (fl=*)?




On Thursday, November 28, 2013 3:59 PM, Alvaro Cabrerizo <to...@gmail.com> wrote:
The question:

¿Is there a way to avoid field expansion when adding
fl<http://wiki.apache.org/solr/CommonQueryParameters#fl>parameter to
the request?

The environment:

Solr 4.4 using the next schema.xml

<field name="id" type="string" indexed="true" stored="true" required="true"
/>
<field name="01_text" type="string" indexed="true" stored="true" />
<field name="01text" type="string" indexed="true" stored="true" />
<field name="text" type="string" indexed="true" stored="true"  />

The test has been done importing the next data:

{"id": "1","text": "text","01text": "text","01_text": "text"}

The testing:

Query and response 1:

q=id:1&fl=id,01text

The response includes a field that doesnt exists "01" and an existing one
(text) that I dont want to return.

{"id":"1","text":"text","01text":"text","01":1}

I expect the next response

{"id":"1","01text":"text"}


Query and response 2

q=id:1&fl=id,01_text

{"id":"1","01_text":"text","01":1}


I expect the next response:


{"id":"1","01_text":"text"}


In both cases, I just want to return the fields included in fl.

Regards.