You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by bhaskar chandrasekar <ba...@yahoo.co.in> on 2009/10/11 18:26:47 UTC
Boosting of words
Hi,
I would like to know how can i give boosting to search input in Solr.
Where exactly should i make the changes?.
Regards
Bhaskar
Re: Boosting of words
Posted by Michel Bottan <fr...@gmail.com>.
Hi Bhaskar,
The parameter you're looking for is the Boost Query. Remember using Dismax
Query Handler.
http://wiki.apache.org/solr/DisMaxRequestHandler#bq_.28Boost_Query.29
http://localhost:8983/solr/select/?q=video&qt=dismax&bq=cat:electronics^5.0
Michel
On Thu, Oct 15, 2009 at 6:04 AM, bhaskar chandrasekar
<ba...@yahoo.co.in>wrote:
> Hi,
>
> I am able to see the results when i pass the values in the query browser.
>
> When i pass the below query i am able to see the difference in output.
>
> http://localhost:8983/solr/select/?q=java^100%20technology^1
>
> Each time user cannot pass the values in the query browser to see the
> output.
>
> But where exactly
>
> java^100 technology^1
>
> this value should be set.In which file and which location to be precise?.
>
> Please help me.
>
> Regards
> Bhaskar
>
>
> --- On Wed, 10/14/09, AHMET ARSLAN <io...@yahoo.com> wrote:
>
>
> From: AHMET ARSLAN <io...@yahoo.com>
> Subject: Re: Boosting of words
> To: solr-user@lucene.apache.org
> Date: Wednesday, October 14, 2009, 6:41 AM
>
>
>
> > Hi Clark,
> >
> > Thanks for your input. I have a query.
> >
> >
> > I have my XML which contains the following:
> >
> > <add>
> > <doc>
> > <field name="url">http://www.sun.com</field>
> > <field name="title">information</field>
> > <field name="description">java plays a important
> > role in computer industry for web users</field>
> > </doc>
> > <doc>
> > <field name="url">http://www.askguru.com</field>
> > <field name="title">homepage</field>
> > <field name="description">Information about
> > technology is stored in the web sites</field>
> > </doc>
> > <doc>
> > <field name="url">http://www.techie.com</field>
> > <field name="title">post queries</field>
> > <field name="description">This web site have more
> > java technology related to web</field>
> > </doc>
> > </add>
> >
> > When I give “java technology” as my input in Solr admin
> > page ,At present I get output as
> >
> > <doc>
> > <field name="url">http://www.techie.com</field>
> > <field name="title">post queries</field>
> > <field name="description">This web site have more
> > java technology related to web</field>
> > </doc>
> >
> > Now I need to get doc which has “technology” also
> >
> > When I give “java technology “
> >
> > I need to get output as,I need to give boosting to doc
> > which has “technology”. It should display in the below
> > order.The output should come as
> >
> > <doc>
> > <field name="url">http://www.techie.com</field>
> > <field name="title">post queries</field>
> > <field name="description">This web site have more
> > java technology related to web</field>
> > </doc>
> > <doc>
> > <field name="url">http://www.askguru.com</field>
> > <field name="title">homepage</field>
> > <field name="description">Information about
> > technology is stored in the web sites</field>
> > </doc>
> > <doc>
> > <field name="url">http://www.sun.com</field>
> > <field name="title">information</field>
> > <field name="description">java plays a important
> > role in computer industry for web users</field>
> > </doc>
> >
> > Let me know how to achieve the same?
>
> The query : java^1 OR technology^100 will do it. Results will be in this
> order:
>
> 1-)This web site have more java technology related to web
> 2-)Information about technology is stored in the web sites
> 3-)java plays a important role in computer industry for web users
>
> 1-) contains both java and technology
> 2-) contains only technology
> 3-) contains only java
>
> Is that what you want?
>
> Note that there is no "" quotes in the query above. And you can adjust
> boost factors (1 and 100) according to your needs. Use OR operator between
> terms. You set individual terms boost with ^ operator.
>
> hope this helps.
>
>
>
>
>
>
>
>
>
>
Re: Boosting of words
Posted by bhaskar chandrasekar <ba...@yahoo.co.in>.
Hi Arslan,
Yes,I am using Solr as an input to carrot.
Yes,I am using org.carrot2.source.solr.SolrDocumentSource just to cluster search results.
Currently we are focusing to Solr search results only.
In future we will focuse to clustered search results.
Now i am using Solr 1.3.
Regards
Bhaskar
--- On Sat, 10/17/09, AHMET ARSLAN <io...@yahoo.com> wrote:
From: AHMET ARSLAN <io...@yahoo.com>
Subject: Re: Boosting of words
To: solr-user@lucene.apache.org
Date: Saturday, October 17, 2009, 1:55 PM
> I am using Solr 1.3.
> I access Solr through carrot and use Java.
What is the meaning of accessing solr through carrot?
Are you using solr as an input to carrot? Using org.carrot2.source.solr.SolrDocumentSource just to cluster search results?
Can we say that you are interested in clustered search results rather than search results them selfs? If yes solr 1.4 will have Grant Ingersoll's ClusteringComponent [1] which uses carrot2 to cluster search results.
[1] http://wiki.apache.org/solr/ClusteringComponent
Re: Boosting of words
Posted by AHMET ARSLAN <io...@yahoo.com>.
> I am using Solr 1.3.
> I access Solr through carrot and use Java.
What is the meaning of accessing solr through carrot?
Are you using solr as an input to carrot? Using org.carrot2.source.solr.SolrDocumentSource just to cluster search results?
Can we say that you are interested in clustered search results rather than search results them selfs? If yes solr 1.4 will have Grant Ingersoll's ClusteringComponent [1] which uses carrot2 to cluster search results.
[1] http://wiki.apache.org/solr/ClusteringComponent
Re: Boosting of words
Posted by bhaskar chandrasekar <ba...@yahoo.co.in>.
Hi,
I am using Solr 1.3.
I access Solr through carrot and use Java.
Regards
Bhaskar
--- On Thu, 10/15/09, AHMET ARSLAN <io...@yahoo.com> wrote:
From: AHMET ARSLAN <io...@yahoo.com>
Subject: Re: Boosting of words
To: solr-user@lucene.apache.org
Date: Thursday, October 15, 2009, 8:58 AM
> Hi,
>
> I am able to see the results when i pass the values in the
> query browser.
>
> When i pass the below query i am able to see the difference
> in output.
>
> http://localhost:8983/solr/select/?q=java^100%20technology^1
>
> Each time user cannot pass the values in the query browser
> to see the output.
>
> But where exactly
>
> java^100 technology^1
>
> this value should be set. In which file and which location
> to be precise?.
>
> Please help me.
Althought I do not understand you, you need to URL encode your parameter values before you invoke a HTTP GET. ¶mater=urlencode(value,"UTF-8")
Try this url :
/select/?q=java%5E100+OR+technology%5E1&version=2.2
Note that space is encoded into +.
Also ^ is encoded into %5E.
What kind of solr client are you using? How are you accessing to solr? From java, php, rubby?
Re: Boosting of words
Posted by AHMET ARSLAN <io...@yahoo.com>.
> Hi,
>
> I am able to see the results when i pass the values in the
> query browser.
>
> When i pass the below query i am able to see the difference
> in output.
>
> http://localhost:8983/solr/select/?q=java^100%20technology^1
>
> Each time user cannot pass the values in the query browser
> to see the output.
>
> But where exactly
>
> java^100 technology^1
>
> this value should be set. In which file and which location
> to be precise?.
>
> Please help me.
Althought I do not understand you, you need to URL encode your parameter values before you invoke a HTTP GET. ¶mater=urlencode(value,"UTF-8")
Try this url :
/select/?q=java%5E100+OR+technology%5E1&version=2.2
Note that space is encoded into +.
Also ^ is encoded into %5E.
What kind of solr client are you using? How are you accessing to solr? From java, php, rubby?
Re: Boosting of words
Posted by bhaskar chandrasekar <ba...@yahoo.co.in>.
Hi,
I am able to see the results when i pass the values in the query browser.
When i pass the below query i am able to see the difference in output.
http://localhost:8983/solr/select/?q=java^100%20technology^1
Each time user cannot pass the values in the query browser to see the output.
But where exactly
java^100 technology^1
this value should be set.In which file and which location to be precise?.
Please help me.
Regards
Bhaskar
--- On Wed, 10/14/09, AHMET ARSLAN <io...@yahoo.com> wrote:
From: AHMET ARSLAN <io...@yahoo.com>
Subject: Re: Boosting of words
To: solr-user@lucene.apache.org
Date: Wednesday, October 14, 2009, 6:41 AM
> Hi Clark,
>
> Thanks for your input. I have a query.
>
>
> I have my XML which contains the following:
>
> <add>
> <doc>
> <field name="url">http://www.sun.com</field>
> <field name="title">information</field>
> <field name="description">java plays a important
> role in computer industry for web users</field>
> </doc>
> <doc>
> <field name="url">http://www.askguru.com</field>
> <field name="title">homepage</field>
> <field name="description">Information about
> technology is stored in the web sites</field>
> </doc>
> <doc>
> <field name="url">http://www.techie.com</field>
> <field name="title">post queries</field>
> <field name="description">This web site have more
> java technology related to web</field>
> </doc>
> </add>
>
> When I give “java technology” as my input in Solr admin
> page ,At present I get output as
>
> <doc>
> <field name="url">http://www.techie.com</field>
> <field name="title">post queries</field>
> <field name="description">This web site have more
> java technology related to web</field>
> </doc>
>
> Now I need to get doc which has “technology” also
>
> When I give “java technology “
>
> I need to get output as,I need to give boosting to doc
> which has “technology”. It should display in the below
> order.The output should come as
>
> <doc>
> <field name="url">http://www.techie.com</field>
> <field name="title">post queries</field>
> <field name="description">This web site have more
> java technology related to web</field>
> </doc>
> <doc>
> <field name="url">http://www.askguru.com</field>
> <field name="title">homepage</field>
> <field name="description">Information about
> technology is stored in the web sites</field>
> </doc>
> <doc>
> <field name="url">http://www.sun.com</field>
> <field name="title">information</field>
> <field name="description">java plays a important
> role in computer industry for web users</field>
> </doc>
>
> Let me know how to achieve the same?
The query : java^1 OR technology^100 will do it. Results will be in this order:
1-)This web site have more java technology related to web
2-)Information about technology is stored in the web sites
3-)java plays a important role in computer industry for web users
1-) contains both java and technology
2-) contains only technology
3-) contains only java
Is that what you want?
Note that there is no "" quotes in the query above. And you can adjust boost factors (1 and 100) according to your needs. Use OR operator between terms. You set individual terms boost with ^ operator.
hope this helps.
Re: Boosting of words
Posted by AHMET ARSLAN <io...@yahoo.com>.
> Hi Clark,
>
> Thanks for your input. I have a query.
>
>
> I have my XML which contains the following:
>
> <add>
> <doc>
> <field name="url">http://www.sun.com</field>
> <field name="title">information</field>
> <field name="description">java plays a important
> role in computer industry for web users</field>
> </doc>
> <doc>
> <field name="url">http://www.askguru.com</field>
> <field name="title">homepage</field>
> <field name="description">Information about
> technology is stored in the web sites</field>
> </doc>
> <doc>
> <field name="url">http://www.techie.com</field>
> <field name="title">post queries</field>
> <field name="description">This web site have more
> java technology related to web</field>
> </doc>
> </add>
>
> When I give “java technology” as my input in Solr admin
> page ,At present I get output as
>
> <doc>
> <field name="url">http://www.techie.com</field>
> <field name="title">post queries</field>
> <field name="description">This web site have more
> java technology related to web</field>
> </doc>
>
> Now I need to get doc which has “technology” also
>
> When I give “java technology “
>
> I need to get output as,I need to give boosting to doc
> which has “technology”. It should display in the below
> order.The output should come as
>
> <doc>
> <field name="url">http://www.techie.com</field>
> <field name="title">post queries</field>
> <field name="description">This web site have more
> java technology related to web</field>
> </doc>
> <doc>
> <field name="url">http://www.askguru.com</field>
> <field name="title">homepage</field>
> <field name="description">Information about
> technology is stored in the web sites</field>
> </doc>
> <doc>
> <field name="url">http://www.sun.com</field>
> <field name="title">information</field>
> <field name="description">java plays a important
> role in computer industry for web users</field>
> </doc>
>
> Let me know how to achieve the same?
The query : java^1 OR technology^100 will do it. Results will be in this order:
1-)This web site have more java technology related to web
2-)Information about technology is stored in the web sites
3-)java plays a important role in computer industry for web users
1-) contains both java and technology
2-) contains only technology
3-) contains only java
Is that what you want?
Note that there is no "" quotes in the query above. And you can adjust boost factors (1 and 100) according to your needs. Use OR operator between terms. You set individual terms boost with ^ operator.
hope this helps.
Re: Boosting of words
Posted by bhaskar chandrasekar <ba...@yahoo.co.in>.
Hi Clark,
Thanks for your input.I have a query.
I have my XML which contains the following:
<add>
<doc>
<field name="url">http://www.sun.com</field>
<field name="title">information</field>
<field name="description">java plays a important role in computer industry for web users</field>
</doc>
<doc>
<field name="url">http://www.askguru.com</field>
<field name="title">homepage</field>
<field name="description">Information about technology is stored in the web sites</field>
</doc>
<doc>
<field name="url">http://www.techie.com</field>
<field name="title">post queries</field>
<field name="description">This web site have more java technology related to web</field>
</doc>
</add>
When I give “java technology” as my input in Solr admin page ,At present I get output as
<doc>
<field name="url">http://www.techie.com</field>
<field name="title">post queries</field>
<field name="description">This web site have more java technology related to web</field>
</doc>
Now I need to get doc which has “technology” also
When I give “java technology “
I need to get output as,I need to give boosting to doc which has “technology”. It should display in the below order.The output should come as
<doc>
<field name="url">http://www.techie.com</field>
<field name="title">post queries</field>
<field name="description">This web site have more java technology related to web</field>
</doc>
<doc>
<field name="url">http://www.askguru.com</field>
<field name="title">homepage</field>
<field name="description">Information about technology is stored in the web sites</field>
</doc>
<doc>
<field name="url">http://www.sun.com</field>
<field name="title">information</field>
<field name="description">java plays a important role in computer industry for web users</field>
</doc>
Let me know how to achieve the same?
Regards
Bhaskar
--- On Tue, 10/13/09, Nicholas Clark <cl...@gmail.com> wrote:
From: Nicholas Clark <cl...@gmail.com>
Subject: Re: Boosting of words
To: solr-user@lucene.apache.org
Date: Tuesday, October 13, 2009, 1:01 PM
Bhaskar,
Read this page, specifically how to query data.
http://lucene.apache.org/solr/tutorial.html#Querying+Data
It sounds like you are very new to Solr, so I would also suggest reading the
wiki.
http://wiki.apache.org/solr/
-Nick
On Mon, Oct 12, 2009 at 10:02 PM, bhaskar chandrasekar <bas_sree@yahoo.co.in
> wrote:
>
> Hi Nicholas,
>
> Thanks for your input.Where exactly the query
>
> q=product:red color:red^10
>
> should be used and defined?.
> Help me.
>
> Regards
> Bhaskar
>
> --- On Mon, 10/12/09, Nicholas Clark <cl...@gmail.com> wrote:
>
>
> From: Nicholas Clark <cl...@gmail.com>
> Subject: Re: Boosting of words
> To: solr-user@lucene.apache.org
> Date: Monday, October 12, 2009, 2:13 PM
>
>
> The easiest way to boost your query is to modify your query string.
>
> q=product:red color:red^10
>
> In the above example, I have boosted the color field. If "red" is found in
> that field, it will get a boost of 10. If it is only found in the product
> field, then there will be no boost.
>
> Here's more information:
>
> http://wiki.apache.org/solr/SolrRelevancyCookbook#Boosting_Ranking_Terms
>
> Once you're comfortable with that, I suggest that you look into using the
> DisMax request handler. It will allow you to easily search across multiple
> fields with custom boost values.
>
> http://wiki.apache.org/solr/DisMaxRequestHandler
>
> -Nick
>
>
> On Sun, Oct 11, 2009 at 12:26 PM, bhaskar chandrasekar <
> bas_sree@yahoo.co.in
> > wrote:
>
> > Hi,
> >
> > I would like to know how can i give boosting to search input in Solr.
> > Where exactly should i make the changes?.
> >
> > Regards
> > Bhaskar
> >
> >
> >
>
>
>
>
>
Re: Boosting of words
Posted by Nicholas Clark <cl...@gmail.com>.
Bhaskar,
Read this page, specifically how to query data.
http://lucene.apache.org/solr/tutorial.html#Querying+Data
It sounds like you are very new to Solr, so I would also suggest reading the
wiki.
http://wiki.apache.org/solr/
-Nick
On Mon, Oct 12, 2009 at 10:02 PM, bhaskar chandrasekar <bas_sree@yahoo.co.in
> wrote:
>
> Hi Nicholas,
>
> Thanks for your input.Where exactly the query
>
> q=product:red color:red^10
>
> should be used and defined?.
> Help me.
>
> Regards
> Bhaskar
>
> --- On Mon, 10/12/09, Nicholas Clark <cl...@gmail.com> wrote:
>
>
> From: Nicholas Clark <cl...@gmail.com>
> Subject: Re: Boosting of words
> To: solr-user@lucene.apache.org
> Date: Monday, October 12, 2009, 2:13 PM
>
>
> The easiest way to boost your query is to modify your query string.
>
> q=product:red color:red^10
>
> In the above example, I have boosted the color field. If "red" is found in
> that field, it will get a boost of 10. If it is only found in the product
> field, then there will be no boost.
>
> Here's more information:
>
> http://wiki.apache.org/solr/SolrRelevancyCookbook#Boosting_Ranking_Terms
>
> Once you're comfortable with that, I suggest that you look into using the
> DisMax request handler. It will allow you to easily search across multiple
> fields with custom boost values.
>
> http://wiki.apache.org/solr/DisMaxRequestHandler
>
> -Nick
>
>
> On Sun, Oct 11, 2009 at 12:26 PM, bhaskar chandrasekar <
> bas_sree@yahoo.co.in
> > wrote:
>
> > Hi,
> >
> > I would like to know how can i give boosting to search input in Solr.
> > Where exactly should i make the changes?.
> >
> > Regards
> > Bhaskar
> >
> >
> >
>
>
>
>
>
Re: Boosting of words
Posted by bhaskar chandrasekar <ba...@yahoo.co.in>.
Hi Nicholas,
Thanks for your input.Where exactly the query
q=product:red color:red^10
should be used and defined?.
Help me.
Regards
Bhaskar
--- On Mon, 10/12/09, Nicholas Clark <cl...@gmail.com> wrote:
From: Nicholas Clark <cl...@gmail.com>
Subject: Re: Boosting of words
To: solr-user@lucene.apache.org
Date: Monday, October 12, 2009, 2:13 PM
The easiest way to boost your query is to modify your query string.
q=product:red color:red^10
In the above example, I have boosted the color field. If "red" is found in
that field, it will get a boost of 10. If it is only found in the product
field, then there will be no boost.
Here's more information:
http://wiki.apache.org/solr/SolrRelevancyCookbook#Boosting_Ranking_Terms
Once you're comfortable with that, I suggest that you look into using the
DisMax request handler. It will allow you to easily search across multiple
fields with custom boost values.
http://wiki.apache.org/solr/DisMaxRequestHandler
-Nick
On Sun, Oct 11, 2009 at 12:26 PM, bhaskar chandrasekar <bas_sree@yahoo.co.in
> wrote:
> Hi,
>
> I would like to know how can i give boosting to search input in Solr.
> Where exactly should i make the changes?.
>
> Regards
> Bhaskar
>
>
>
Re: Boosting of words
Posted by Nicholas Clark <cl...@gmail.com>.
The easiest way to boost your query is to modify your query string.
q=product:red color:red^10
In the above example, I have boosted the color field. If "red" is found in
that field, it will get a boost of 10. If it is only found in the product
field, then there will be no boost.
Here's more information:
http://wiki.apache.org/solr/SolrRelevancyCookbook#Boosting_Ranking_Terms
Once you're comfortable with that, I suggest that you look into using the
DisMax request handler. It will allow you to easily search across multiple
fields with custom boost values.
http://wiki.apache.org/solr/DisMaxRequestHandler
-Nick
On Sun, Oct 11, 2009 at 12:26 PM, bhaskar chandrasekar <bas_sree@yahoo.co.in
> wrote:
> Hi,
>
> I would like to know how can i give boosting to search input in Solr.
> Where exactly should i make the changes?.
>
> Regards
> Bhaskar
>
>
>