Bob Yoplait
Bob Yoplait

Reputation: 2499

solr field replace in the query

I have a query like that where "brand" is 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. Is there a way to do that ? Thank you

Upvotes: 0

Views: 155

Answers (1)

bthomas9
bthomas9

Reputation: 21

You can use a copyField in the schema file. You would need to create a new field called "brand_name", and give it the appropriate type. Then add a copyField to transfer the value from "brand" to "brand_name".

<copyField source="brand" dest="brand_name"/>

Then you can reference the data in the brand_name field.

Hope that helps!

Upvotes: 2

Related Questions