Boost the results for filter value in a single query

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Boost the results for filter value in a single query

Vijay Khurana-2
Hi,
Here is the problem I am facing.
One of the field in my index is content_source which I use to filter my
results.
I want all the documents that have content_source value as ABC OR DEF
and all the documents having DEF
should appear before the documents that have content_source value as ABC. I
am using DisMaxRequestHandler and Solr 2.0.

Currently I am using below query:

q=test&qt=dismax&fq=contemt_source:("ABC" OR "DEF")

The above query doesn't guarantee the appearance of DEF documents before
ABC.
I want to do this in one query. is it possible?

Appreciate your help.

Thanks,
Vijay
Reply | Threaded
Open this post in threaded view
|

Re: Boost the results for filter value in a single query

Yonik Seeley-2
If content_source is single valued (maximum of one value per
document), then sort.
sort=content_source asc

-Yonik

On Tue, Feb 26, 2008 at 4:15 AM, Vijay Khurana <[hidden email]> wrote:

> Hi,
>  Here is the problem I am facing.
>  One of the field in my index is content_source which I use to filter my
>  results.
>  I want all the documents that have content_source value as ABC OR DEF
>  and all the documents having DEF
>  should appear before the documents that have content_source value as ABC. I
>  am using DisMaxRequestHandler and Solr 2.0.
>
>  Currently I am using below query:
>
>  q=test&qt=dismax&fq=contemt_source:("ABC" OR "DEF")
>
>  The above query doesn't guarantee the appearance of DEF documents before
>  ABC.
>  I want to do this in one query. is it possible?
>
>  Appreciate your help.
>
>  Thanks,
>  Vijay
>
Reply | Threaded
Open this post in threaded view
|

Re: Boost the results for filter value in a single query

Vijay Khurana-2
Thanks for the response Yonik.
The content source field is a single valued field. Sorting the results won't
work for me as the content source values are arbitrary strings and there is
no set pattern i.e it can be axd or xbc or abc def. All I know at time of
the query that results for content source axd should appear before
the results for other content sources.

Thanks,
Vijay


On 2/26/08, Yonik Seeley <[hidden email]> wrote:

>
> If content_source is single valued (maximum of one value per
> document), then sort.
> sort=content_source asc
>
> -Yonik
>
> On Tue, Feb 26, 2008 at 4:15 AM, Vijay Khurana <[hidden email]>
> wrote:
> > Hi,
> >  Here is the problem I am facing.
> >  One of the field in my index is content_source which I use to filter my
> >  results.
> >  I want all the documents that have content_source value as ABC OR DEF
> >  and all the documents having DEF
> >  should appear before the documents that have content_source value as
> ABC. I
> >  am using DisMaxRequestHandler and Solr 2.0.
> >
> >  Currently I am using below query:
> >
> >  q=test&qt=dismax&fq=contemt_source:("ABC" OR "DEF")
> >
> >  The above query doesn't guarantee the appearance of DEF documents
> before
> >  ABC.
> >  I want to do this in one query. is it possible?
> >
> >  Appreciate your help.
> >
> >  Thanks,
> >  Vijay
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Boost the results for filter value in a single query

Otis Gospodnetic-2
In reply to this post by Vijay Khurana-2
Hi Vijay,

Would index-time boosting work? (maybe not with filters)
If not, how about changing:
    q=test&qt=dismax&fq=contemt_source:("ABC" OR "DEF")
to
    q=test%20contemt_source:("ABC"^1.0 OR "DEF"^2.0)&qt=dismax&fq=contemt_source:("ABC" OR "DEF")
I'm not sure without trying, though.

Otis

--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch

----- Original Message ----

> From: Vijay Khurana <[hidden email]>
> To: [hidden email]
> Sent: Tuesday, February 26, 2008 11:24:10 PM
> Subject: Re: Boost the results for filter value in a single query
>
> Thanks for the response Yonik.
> The content source field is a single valued field. Sorting the results won't
> work for me as the content source values are arbitrary strings and there is
> no set pattern i.e it can be axd or xbc or abc def. All I know at time of
> the query that results for content source axd should appear before
> the results for other content sources.
>
> Thanks,
> Vijay
>
>
> On 2/26/08, Yonik Seeley  wrote:
> >
> > If content_source is single valued (maximum of one value per
> > document), then sort.
> > sort=content_source asc
> >
> > -Yonik
> >
> > On Tue, Feb 26, 2008 at 4:15 AM, Vijay Khurana
> > wrote:
> > > Hi,
> > >  Here is the problem I am facing.
> > >  One of the field in my index is content_source which I use to filter my
> > >  results.
> > >  I want all the documents that have content_source value as ABC OR DEF
> > >  and all the documents having DEF
> > >  should appear before the documents that have content_source value as
> > ABC. I
> > >  am using DisMaxRequestHandler and Solr 2.0.
> > >
> > >  Currently I am using below query:
> > >
> > >  q=test&qt=dismax&fq=contemt_source:("ABC" OR "DEF")
> > >
> > >  The above query doesn't guarantee the appearance of DEF documents
> > before
> > >  ABC.
> > >  I want to do this in one query. is it possible?
> > >
> > >  Appreciate your help.
> > >
> > >  Thanks,
> > >  Vijay
> > >
> >
>


Reply | Threaded
Open this post in threaded view
|

Re: Boost the results for filter value in a single query

Yonik Seeley-2
In reply to this post by Vijay Khurana-2
On Tue, Feb 26, 2008 at 11:24 PM, Vijay Khurana
<[hidden email]> wrote:
> Thanks for the response Yonik.
>  The content source field is a single valued field. Sorting the results won't
>  work for me as the content source values are arbitrary strings and there is
>  no set pattern i.e it can be axd or xbc or abc def. All I know at time of
>  the query that results for content source axd should appear before
>  the results for other content sources.

OK, then if you are sorting by score, you could manipulate it such
that anything with the content_source you are looking for will come
first.

qt=dismax&q=foo&fq=content_source:(ABC OR DEF)&bq=content_source:DEF^1000

bq is a boosting query... an optional part in lucene syntax that is
added to the generated dismax query.

-Yonik