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 Antoine LE FLOC'H <le...@gmail.com> on 2014/06/06 23:56:41 UTC

Mapping a field name before queryParser

Hello,

I have a query like the following where "brand" is a field in my schema:

select?rows=1&start=0&sort=price+asc&q=brand:sony&qt=for-search&wt=xml


But I want to do this instead:

select?rows=1&start=0&sort=price+asc&q=brand_name:sony&qt=for-search&wt=xml

and define something like "brand_name:brand" in my Solr config to change
the field before or during the QueryParsing. Is there a way to do that ?


Ideally I would not want to do a copyField since it would grow my index and
would require re-indexing.


Thank you

Re: Mapping a field name before queryParser

Posted by Ahmet Arslan <io...@yahoo.com.INVALID>.
Field aliasing exists when retrieving fields via fl parameter. But not when querying.
Can you elaborate more your use case?





On Saturday, June 7, 2014 12:57 AM, Antoine LE FLOC'H <le...@gmail.com> wrote:
Hello,

I have a query like the following where "brand" is a field in my schema:

select?rows=1&start=0&sort=price+asc&q=brand:sony&qt=for-search&wt=xml


But I want to do this instead:

select?rows=1&start=0&sort=price+asc&q=brand_name:sony&qt=for-search&wt=xml

and define something like "brand_name:brand" in my Solr config to change
the field before or during the QueryParsing. Is there a way to do that ?


Ideally I would not want to do a copyField since it would grow my index and
would require re-indexing.


Thank you


Re: Mapping a field name before queryParser

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Could a custom Search Components chain be used to modify the request
before it hits the Query?

I never used them myself, but it seems like potentially the right place.

Regards,
   Alex.


Personal website: http://www.outerthoughts.com/
Current project: http://www.solr-start.com/ - Accelerating your Solr proficiency


On Sat, Jun 7, 2014 at 5:10 AM, Jack Krupansky <ja...@basetechnology.com> wrote:
> Edismax has field aliasing:
> http://wiki.apache.org/solr/ExtendedDisMax#Field_aliasing_.2F_renaming
>
> f.my_alias.qf=actual_field
>
> f.brand.qf=brand_name
>
> -- Jack Krupansky
>
> -----Original Message----- From: Antoine LE FLOC'H Sent: Friday, June 6,
> 2014 5:56 PM To: solr-user@lucene.apache.org Subject: Mapping a field name
> before queryParser
> Hello,
>
> I have a query like the following where "brand" is a field in my schema:
>
> select?rows=1&start=0&sort=price+asc&q=brand:sony&qt=for-search&wt=xml
>
>
> But I want to do this instead:
>
> select?rows=1&start=0&sort=price+asc&q=brand_name:sony&qt=for-search&wt=xml
>
> and define something like "brand_name:brand" in my Solr config to change
> the field before or during the QueryParsing. Is there a way to do that ?
>
>
> Ideally I would not want to do a copyField since it would grow my index and
> would require re-indexing.
>
>
> Thank you

Re: Mapping a field name before queryParser

Posted by Jack Krupansky <ja...@basetechnology.com>.
Oops... for your example it would be:

f.brand_name.qf=brand

-- Jack Krupansky

-----Original Message----- 
From: Antoine LE FLOC'H
Sent: Friday, June 6, 2014 6:54 PM
To: solr-user@lucene.apache.org
Subject: Re: Mapping a field name before queryParser

OK thank you.
I wanted to see what's possible if we want to change our Solr query
interface. It is used by client applications. I wanted to see if we can be
backward compatible.



On Sat, Jun 7, 2014 at 12:10 AM, Jack Krupansky <ja...@basetechnology.com>
wrote:

> Edismax has field aliasing:
> http://wiki.apache.org/solr/ExtendedDisMax#Field_aliasing_.2F_renaming
>
> f.my_alias.qf=actual_field
>
> f.brand.qf=brand_name
>
> -- Jack Krupansky
>
> -----Original Message----- From: Antoine LE FLOC'H Sent: Friday, June 6,
> 2014 5:56 PM To: solr-user@lucene.apache.org Subject: Mapping a field
> name before queryParser
> Hello,
>
> I have a query like the following where "brand" is a field in my schema:
>
> select?rows=1&start=0&sort=price+asc&q=brand:sony&qt=for-search&wt=xml
>
>
> But I want to do this instead:
>
> select?rows=1&start=0&sort=price+asc&q=brand_name:sony&
> qt=for-search&wt=xml
>
> and define something like "brand_name:brand" in my Solr config to change
> the field before or during the QueryParsing. Is there a way to do that ?
>
>
> Ideally I would not want to do a copyField since it would grow my index 
> and
> would require re-indexing.
>
>
> Thank you
> 


Re: Mapping a field name before queryParser

Posted by Antoine LE FLOC'H <le...@gmail.com>.
OK thank you.
I wanted to see what's possible if we want to change our Solr query
interface. It is used by client applications. I wanted to see if we can be
backward compatible.



On Sat, Jun 7, 2014 at 12:10 AM, Jack Krupansky <ja...@basetechnology.com>
wrote:

> Edismax has field aliasing:
> http://wiki.apache.org/solr/ExtendedDisMax#Field_aliasing_.2F_renaming
>
> f.my_alias.qf=actual_field
>
> f.brand.qf=brand_name
>
> -- Jack Krupansky
>
> -----Original Message----- From: Antoine LE FLOC'H Sent: Friday, June 6,
> 2014 5:56 PM To: solr-user@lucene.apache.org Subject: Mapping a field
> name before queryParser
> Hello,
>
> I have a query like the following where "brand" is a field in my schema:
>
> select?rows=1&start=0&sort=price+asc&q=brand:sony&qt=for-search&wt=xml
>
>
> But I want to do this instead:
>
> select?rows=1&start=0&sort=price+asc&q=brand_name:sony&
> qt=for-search&wt=xml
>
> and define something like "brand_name:brand" in my Solr config to change
> the field before or during the QueryParsing. Is there a way to do that ?
>
>
> Ideally I would not want to do a copyField since it would grow my index and
> would require re-indexing.
>
>
> Thank you
>

Re: Mapping a field name before queryParser

Posted by Jack Krupansky <ja...@basetechnology.com>.
Edismax has field aliasing:
http://wiki.apache.org/solr/ExtendedDisMax#Field_aliasing_.2F_renaming

f.my_alias.qf=actual_field

f.brand.qf=brand_name

-- Jack Krupansky

-----Original Message----- 
From: Antoine LE FLOC'H 
Sent: Friday, June 6, 2014 5:56 PM 
To: solr-user@lucene.apache.org 
Subject: Mapping a field name before queryParser 

Hello,

I have a query like the following where "brand" is a field in my schema:

select?rows=1&start=0&sort=price+asc&q=brand:sony&qt=for-search&wt=xml


But I want to do this instead:

select?rows=1&start=0&sort=price+asc&q=brand_name:sony&qt=for-search&wt=xml

and define something like "brand_name:brand" in my Solr config to change
the field before or during the QueryParsing. Is there a way to do that ?


Ideally I would not want to do a copyField since it would grow my index and
would require re-indexing.


Thank you