Actually, I _think_ you need to use a nested query for my idea, you can just use "LocalParams".

&q={!lucene} your query in lucene syntax

I think that'll work, I think you can use "LocalParams" directly in the 'q', no need for nested query. If it will, it avoids the escaping nightmares with nested queries.

Ravi Kiran wrote:
Awesome I also did not know about q.alt accepting lucene style...Thanks to
both of you, Mr. Ackermann and Mr. Rockkind, I learnt a lot in just this
thread than I have done in the last 6 months of reading and dealing with
solr.

As you folks pointed out q.alt and nested queries are both great options, I
shall pursue them...asking a question on a forum is fun when you have
knowledgeable people, isnt it??? That's true reuse of resources in software
terms :-) , reuse of knowledge in developer space !!!.

Ravi Kiran Bhaskar
Principal Software Engineer
The Washington Post

On Thu, Sep 16, 2010 at 9:25 AM, Jonathan Rochkind <rochk...@jhu.edu> wrote:

Nice, I didn't know about q.alt.  Or, alternately, yes, you could use a
nested query, good call.   Which, yes, I agree is kind of confusing at
first.

&qt=dismax     # use dismax for the overall query
&bq=whatever   # so we can use bq, since we're using dismax
&q=_query_:"{!lucene} solr-lucene syntax query" # but now make our entire
'q' a nested query, which is set to use lucene query parser.

What gets really confusing there is that the nested query expression needs
to be in quotes -- so if you need quotes within the actual query itself (say
for a phrase), you need to escape them. And the whole thing needs to be
URI-encoded, of course.  It does get confusing, but is quite powerful.

Jonathan
________________________________________
From: Chantal Ackermann [chantal.ackerm...@btelligent.de]
Sent: Thursday, September 16, 2010 4:10 AM
To: solr-user@lucene.apache.org
Subject: Re: Boosting specific field value

Hi Ravi,

with dismax, use the parameter "q.alt" which expects standard lucene
syntax (instead of "q"). If "q.alt" is present in the query, "q" is not
required. Add the parameter "qt=dismax".

Chantal

On Thu, 2010-09-16 at 06:22 +0200, Ravi Kiran wrote:
Hello Mr.Rochkind,
                           I am using StandardRequestHandler so I presume
I
cannot use bq param right ?? Is there a way we can mix dismax and
standardhandler i.e use lucene syntax for query and use dismax style for
bq
using localparams/nested queries? I remember seeing your post related to
localparams and nested queries and got thoroughly confused

On Wed, Sep 15, 2010 at 10:28 PM, Jonathan Rochkind <rochk...@jhu.edu
wrote:

Maybe you are looking for the 'bq' (boost query) parameter in dismax?

http://wiki.apache.org/solr/DisMaxQParserPlugin#bq_.28Boost_Query.29
________________________________________
From: Ravi Kiran [ravi.bhas...@gmail.com]
Sent: Wednesday, September 15, 2010 10:02 PM
To: solr-user@lucene.apache.org
Subject: Re: Boosting specific field value

Erick,
        I afraid you misinterpreted my issue....if I query like you
said
i.e q=source(bbc OR "associated press")^10  I will ONLY get documents
with
source BBC or Associated Press...what I am asking is - if my query
query
does not deal with source at all but uses some other field...since the
field
"source" will be in the result , is there a way to still boost such a
document

To re-iterate, If my query is as follows

q=primarysection:(Politics* OR Nation*)&fq=contenttype:("Blog" OR
"Photo
Gallery") pubdatetime:[NOW-3MONTHS TO NOW]

and say the resulting docs have "source" field, is there any way I can
boost
the resulting doc/docs that have either BBC/Associated Press as the
value
in
source field to be on top

Can a filter query (fq) have a boost ? if yes, then probably I could
rewrite
the query as follows in a round about way

q=primarysection:(Politics* OR Nation*)&fq=contenttype:("Blog" OR
"Photo
Gallery) pubdatetime:[NOW-3MONTHS TO NOW] (source:("BBC" OR "Associated
Press")^10 OR -source:("BBC" OR "Associated Press")^5)

Theoretically, I have to write source in the fq 2 times as I need docs
that
have source values too just that they will have a lower boost

Thanks,

Ravi Kiran Bhaskar

On Wed, Sep 15, 2010 at 1:34 PM, Erick Erickson <
erickerick...@gmail.com
wrote:
This seems like a simple query-time boost, although I may not be
understanding
your problem well. That is, q=source(bbc OR "associated press")^10

As for boosting more recent documents, see:


http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents
HTH
Erick


On Wed, Sep 15, 2010 at 12:44 PM, Ravi Kiran <ravi.bhas...@gmail.com
wrote:

Hello,
       I am currently querying solr for a "*primarysection*" which
will
return documents like - *q=primarysection:(Politics* OR
Nation*)&fq=contenttype:("Blog" OR "Photo Gallery)
pubdatetime:[NOW-3MONTHS
TO NOW]"*. Each document has several fields of which I am most
interested
in
single valued field called "*source*" ...I want to boost documents
which
contain "*source*" value say "Associated Press" OR "BBC" and also
by
newer
documents. The returned documents may have several other source
values
other
than "BBC" or "Associated Press". since I specifically don't query
on
these
source values I am not sure how I can boost them, Iam using *
StandardRequestHandler*




Reply via email to