简体   繁体   中英

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM