Re: Nested queries with proximity/slop
https://issues.apache.org/jira/browse/SOLR-4625 -Yonik http://lucidworks.com On Tue, Mar 19, 2013 at 11:12 PM, Yonik Seeley yo...@lucidworks.com wrote: On Tue, Mar 19, 2013 at 8:52 PM, Michael Ryan mr...@moreover.com wrote: I was wondering if anyone is aware of an existing Jira for this bug... _query_:\a b\~2 ...is parsed as... PhraseQuery(someField:a b) ...instead of the expected... PhraseQuery(someField:a b~2) _query_:\a b\~2 ...is parsed as... PhraseQuery(someField:a b~2) _query_:\a b\~2~3 ...is parsed as... PhraseQuery(someField:a b~3) Basically, if a nested query produces a PhraseQuery with slop, the slop is overridden (or set to 0) by the slop on the magic _query_ field (of course, having slop on the _query_ field would make no sense). Looked around in Jira, but couldn't find this having been reported. I guess it is just a bit esoteric... Definitely looks like a bug that I haven't seen before. Could you open a JIRA issue for this? -Yonik http://lucidworks.com
Re: Nested queries with proximity/slop
On Tue, Mar 19, 2013 at 8:52 PM, Michael Ryan mr...@moreover.com wrote: I was wondering if anyone is aware of an existing Jira for this bug... _query_:\a b\~2 ...is parsed as... PhraseQuery(someField:a b) ...instead of the expected... PhraseQuery(someField:a b~2) _query_:\a b\~2 ...is parsed as... PhraseQuery(someField:a b~2) _query_:\a b\~2~3 ...is parsed as... PhraseQuery(someField:a b~3) Basically, if a nested query produces a PhraseQuery with slop, the slop is overridden (or set to 0) by the slop on the magic _query_ field (of course, having slop on the _query_ field would make no sense). Looked around in Jira, but couldn't find this having been reported. I guess it is just a bit esoteric... Definitely looks like a bug that I haven't seen before. Could you open a JIRA issue for this? -Yonik http://lucidworks.com
Re: nested queries
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.
Re: nested queries
Grant, Grant Ingersoll wrote: On Nov 19, 2009, at 7:02 AM, Andrea Campi wrote: 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 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. I tried that but the customer prefers the lucene syntax for the actual query. However, now that you mention this, I should probably be able to use Dismax but specify the lucene syntax for the actual search on the 'text' field, right? I will try that, thanks. Bye, Andrea
Re: nested queries
I don't think your queries are actually nested queries. Nested queries key off of the magic field name _query_. You're right however that there is very little in the way of documentation of examples of nested queries. If you haven't seen this blog about them yet you might find this a helpful overview of nested queries: http://www.lucidimagination.com/blog/2009/03/31/nested-queries-in-solr/ -Jay On Thu, Nov 19, 2009 at 6:15 AM, Andrea Campi andrea.ca...@zephirworks.comwrote: Grant, Grant Ingersoll wrote: On Nov 19, 2009, at 7:02 AM, Andrea Campi wrote: 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 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. I tried that but the customer prefers the lucene syntax for the actual query. However, now that you mention this, I should probably be able to use Dismax but specify the lucene syntax for the actual search on the 'text' field, right? I will try that, thanks. Bye, Andrea