On Nov 19, 2009, at 7:02 AM, Andrea Campi wrote:
> Hi,
>
> I'm trying to wrap my head around nested queries and I'm having some trouble
> figuring out how far can I go with them. I have to say documentation is still
> a bit sparse... :/
>
>
> I'm trying to build a query that would search the same term(s) on different
> fields with different boosts, like:
>
> text:something OR ftext:something^1000
>
> In addition I am adding a function query to manipulate the score further.
>
>
> To make things easier and more maintainable, I'd like to use nested queries
> for that; I'd like to be able to write:
>
> q={!boost b=$dateboost v=ftext:$terms^1000 OR
> text:$terms}&dateboost=product(...etc.)&terms=something
>
> Or even better:
>
> q={!boost b=$dateboost v=$qq}&qq={!query v=ftext:$terms^1000 OR
> text:$terms}&dateboost=product(...etc.)&terms=something
>
>
> I tried both of the above (and some other variations, with parenthesis etc)
> but it looks like variables are replaced only if they are the only thing that
> appears after a v=.
> For instance, this works perfectly:
>
> q={!boost b=$dateboost v=$qq}&qq={!query
> v=$terms}&dateboost=product(...etc.)&terms=something
>
> whereas even this fails:
>
> q={!boost b=$dateboost v=$qq}&qq={!query
> v=text:$terms}&dateboost=product(...etc.)&terms=something
>
>
> Do you guys see any way to obtain what I want--or to do it better?
Sounds like you might benefit from using the Dismax Parser. You can specify
the field boosting thing in your config and also add the bf (boost function)
capability.