Thanks Chris! That worked!
I overengineered my query!

Thanks,
-Utkarsh


On Fri, Oct 18, 2013 at 12:02 PM, Chris Hostetter
<hossman_luc...@fucit.org>wrote:

>
> : I trying to do this:
> :
> : if (US_offers_i exists):
> :    fq=US_offers_i:[1 TO *]
> : else:
> :    fq=offers_count:[1 TO *]
>
> "if()" and "exist()" are functions, so you would have to explicitly use
> them
> in a function context (ie: {!func} parser, or {!frange} parser) and to use
> those nested queries inside of functions you'd need to use the "query()"
> function.
>
> but nothing about your problem description suggests that you really need
> to worry about this.
>
> If a document doesn't contain the "US_offers_i" then US_offers_i:[1 TO *]
> won't match that document, and neither will US_offers_i:[* TO *] -- so you
> can implement the logic you describe with a simple query...
>
> fq=(US_offers_i:[1 TO *] (offers_count:[1 TO *] -US_offers_i:[* TO *]))
>
> Which you can read as "Match does with 1 or more US offers, or: docs that
> have 1 or more offers but no US offer field at all"
>
> : Also, there is a heavy performance penalty for this condition? I am
> : planning to use this for all my queries.
>
> Any logic that you do at query time, which can be precomputed into a
> specific field in your index will *always* make the queries faster (at the
> expense of a little more time spent indexing and a little more disk used).
> If you know in advance that you are frequently going to want to ristrict
> on this type of logic, then unless you index docs more offten then you
> search docs, you should almost certainly index as "has_offers" boolean
> field that captures this logic.
>
>
> -Hoss
>



-- 
Thanks,
-Utkarsh

Reply via email to