Reputation: 13
How can I pass dynamic values to Solr fields in a URL?
Example:
http://localhost:8983/solr/searching/select?q=*:*&fq=maths:25 AND science: 30
The 25 and 30 are dynamic values. How can I pass them as part of a Solr URL?
Upvotes: 1
Views: 1205
Reputation: 30067
May be what are you looking for is what in Solr is called Parameter Dereferencing.
Parameter dereferencing lets you use the value of another argument rather than specifying it directly. This can be used in conjunction with solrconfig.xml
simplifying the query call.
For example instead to write:
.../select?q=*:*&fq=maths:25 AND science:30
you can write:
.../select?q=*:*&fq={!qf=maths v=$q1}&fq={!qf=science v=$q2}&q1=25&q2=30
Upvotes: 2
Reputation: 1953
In suggest, you need to define exactly what concrete fields you want to search. You can't search in all dynamic fields by using wildcards in a field name in queries.
or
You can try this way
-copy the dynamic field into other destination field -query that destination field
something like this
<copyField source="dynamicfieldname_*" dest="dest_fieldname"/>
Now you can query solr with that field name like
select?q=dest_fieldname:"25"
Upvotes: 1