[ 
https://issues.apache.org/jira/browse/SOLR-2136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13070275#comment-13070275
 ] 

William Bell edited comment on SOLR-2136 at 7/24/11 11:24 PM:
--------------------------------------------------------------

How about on fq? I want to run 1 query and if the numFound > 0, then return 
that fq, otherwise skip it. This was inspired by your test case:

"{!frange l=1 u=1}if(exists("+f+"),1,0)" 

Ok,
f=specialties:Cardiologist

{code}
"fq=if(numfound(query("+f+")),f,*:*)" 
{code}

Will something like that work?



      was (Author: [email protected]):
    How about on fq? I want to run 1 query and if the numFound > 0, then return 
that fq, otherwise skip it. This was inspired by your test case:

"{!frange l=1 u=1}if(exists("+f+"),1,0)" 

Ok,
f=specialties:Cardiologist

"fq=if(numfound(query("+f+")),f,*:*)" 

Will something like that work?


  
> Function Queries: if() function
> -------------------------------
>
>                 Key: SOLR-2136
>                 URL: https://issues.apache.org/jira/browse/SOLR-2136
>             Project: Solr
>          Issue Type: New Feature
>          Components: search
>    Affects Versions: 1.4.1
>            Reporter: Jan Høydahl
>             Fix For: 4.0
>
>         Attachments: SOLR-2136.patch, SOLR-2136.patch
>
>
> Add an if() function which will enable conditional function queries.
> The function could be modeled after a spreadsheet if function (e.g: 
> http://wiki.services.openoffice.org/wiki/Documentation/How_Tos/Calc:_IF_function)
> IF(test; value1; value2) where:
>     test is or refers to a logical value or expression that returns a logical 
> value (TRUE or FALSE).
>     value1 is the value that is returned by the function if test yields TRUE.
>     value2 is the value that is returned by the function if test yields FALSE.
> If value2 is omitted it is assumed to be FALSE; if value1 is also omitted it 
> is assumed to be TRUE.
> Example use:
> if(color=="red"; 100; if(color=="green"; 50; 25))
> This function will check the document field "color", and if it is "red" 
> return 100, if it is "green" return 50, else return 25.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to