You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Hoss Man (JIRA)" <ji...@apache.org> on 2013/02/21 02:40:11 UTC
[jira] [Updated] (SOLR-4481) SwitchQParserPlugin
[ https://issues.apache.org/jira/browse/SOLR-4481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hoss Man updated SOLR-4481:
---------------------------
Attachment: SOLR-4481.patch
Patch for review (includes docs & tests).
some example usages straight from javadocs...
{noformat}
In the examples below, the result of each query would be XXX....
q = {!switch s.foo=XXX s.bar=zzz s.yak=qqq}foo
q = {!switch s.foo=qqq s.bar=XXX s.yak=zzz} bar // extra whitespace
q = {!switch defSwitch=XXX s.foo=qqq s.bar=zzz}asdf // fallback on defSwitch
q = {!switch s=XXX s.bar=zzz s.yak=qqq} // blank input
{noformat}
{panel}
A practical usage of this QParsePlugin, is in specifying "appends" fq params in the configuration of a SearchHandler, to provide a fixed set of filter options for clients using custom parameter names. Using the example configuration below, clients can optionally specify the custom parameters in_stock and shipping to override the default filtering behavior, but are limited to the specific set of legal values (shipping=any|free, in_stock=yes|no|all).
{code}
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="in_stock">yes</str>
<str name="shipping">any</str>
</lst>
<lst name="appends">
<str name="fq">{!switch s.all='*:*'
s.yes='inStock:true'
s.no='inStock:false'
v=$in_stock}</str>
<str name="fq">{!switch s.any='*:*'
s.free='shipping_cost:0.0'
v=$shipping}</str>
</lst>
</requestHandler>
{code}
{panel}
> SwitchQParserPlugin
> -------------------
>
> Key: SOLR-4481
> URL: https://issues.apache.org/jira/browse/SOLR-4481
> Project: Solr
> Issue Type: New Feature
> Reporter: Hoss Man
> Assignee: Hoss Man
> Attachments: SOLR-4481.patch
>
>
> Inspired by a conversation i had with someone on IRC a while back about using "append" fq params + local params to create custom request params, it occurred to me that it would be handy to have a "switch" qparser that could be configured with some set of fixed "switch case" localparams that it would delegate too based on it's input string.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org