Re: Boosting by facets with standard query
On Fri, Apr 17, 2009 at 2:02 AM, ashokc wrote: > q=(+(content:umts)+OR+(title:umts)^2+OR+(urltext:umts)^2)+AND+(doctype:white_papers)^2+AND+(filetype:pdf)^2 > [...] > What we need is for the white_papers & pdfs to be boosted, but if and only > if such doucments are valid results to the search term in question. Make the entire query part mandatory and the doctype boost optional. Assuming that the default query operator is OR... this would look like: +(content:umts title:umts^2 urltext:umts^2) doctype:white_papers^2 filetype:pdf^2 You may also want to look at the dismax query parser, which can make constructing queries like this a lot easier. &defType=dismax &q=umts &qf=content title^2 urltext^2 &bq=doctype:white_papers^2 filetype:pdf^2 -Yonik http://www.lucidimagination.com
Re: Boosting by facets with standard query
Thanks for the tip. Looks like a neat idea. I have never used the sort feature, so I have to create a new numeric key with values 1 or 2 - value 1 for white_papers/pdfs & 2 for others? The problem also is that the facets I need to boost can vary by query. That is, if the query term 'a', boost the facets 'facet1 & facet2'. If the query term is 'b', then boost the facets 'facet4 & facet5'. Perhaps I can identify the most freqently used boost order, and create as many fields as there are orders. That would be the way right? - ashok Shalin Shekhar Mangar wrote: > > On Fri, Apr 17, 2009 at 11:32 AM, ashokc wrote: > >> >> What we need is for the white_papers & pdfs to be boosted, but if and >> only >> if such doucments are valid results to the search term in question. How >> would I write my above 'q' to accomplish that? >> > > Thanks for explaining in detail. > > Basically, all you want to do is sort the results in the following order: > 1. White papers > 2. PDFs > 3. Others > > or maybe #1 and #2 are equivalent and can be intermingled. > > Easiest way to do this is to index a new field whose values (when sorted) > give you the desired order. Then you can simply sort on that field and > score. > > -- > Regards, > Shalin Shekhar Mangar. > > -- View this message in context: http://www.nabble.com/Boosting-by-facets-with-standard-query-tp23084860p23123288.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Boosting by facets with standard query
On Fri, Apr 17, 2009 at 11:32 AM, ashokc wrote: > > What we need is for the white_papers & pdfs to be boosted, but if and only > if such doucments are valid results to the search term in question. How > would I write my above 'q' to accomplish that? > Thanks for explaining in detail. Basically, all you want to do is sort the results in the following order: 1. White papers 2. PDFs 3. Others or maybe #1 and #2 are equivalent and can be intermingled. Easiest way to do this is to index a new field whose values (when sorted) give you the desired order. Then you can simply sort on that field and score. -- Regards, Shalin Shekhar Mangar.
Re: Boosting by facets with standard query
What you indicated here is for a different purpose, is it not? I already do something similar with my 'q'. For example a sample query logged in 'catalina.out' looks like webapp=/search path=/select params={rows=15&start=0&q=(+(content:umts)+OR+(title:umts)^2+OR+(urltext:umts)^2)} when the search term is "umts". I am looking for this term "umts" in the fields - (a) content, (b) title (boosted by a factor of 2) and (c) urltext (boosted by a factor of 2). So the presense of the term "umts" in title or url is weighed more than its presense in the regular content. So far so good. Now, I have other fields as well, like document type, file type etc... that serve as facets to telescope down. Among the above set of search results, I want to boost a specific document type 'white_papers' & a specific file type "pdf". By boosting I mean that these white_paper & pdf documents should float to the top of the heap in the search results, if such documents are at all present in the search results. So would I simply add the following to the above "q"? q=(+(content:umts)+OR+(title:umts)^2+OR+(urltext:umts)^2)+AND+(doctype:white_papers)^2+AND+(filetype:pdf)^2 But wouldn't the above give 0 results if there are no white_papers & pdfs (because of the AND)? If I use OR, then the meaning of the query is lost altogether. What we need is for the white_papers & pdfs to be boosted, but if and only if such doucments are valid results to the search term in question. How would I write my above 'q' to accomplish that? Thanks - ashok Shalin Shekhar Mangar wrote: > > On Fri, Apr 17, 2009 at 1:03 AM, ashokc wrote: > >> >> I have a query that yields results binned in several facets. How can I >> boost >> the results that fall in certain facets over the rest of them that do not >> belong to those facets? I use the standard query format. Thank you > > > I'm not sure what you mean by boosting by facet. Do you mean that you want > to boost documents which match a term query? > > If yes, you can use your_field_name:value^2.0 in the q parameter. > -- > Regards, > Shalin Shekhar Mangar. > > -- View this message in context: http://www.nabble.com/Boosting-by-facets-with-standard-query-tp23084860p23091586.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Boosting by facets with standard query
On Fri, Apr 17, 2009 at 1:03 AM, ashokc wrote: > > I have a query that yields results binned in several facets. How can I > boost > the results that fall in certain facets over the rest of them that do not > belong to those facets? I use the standard query format. Thank you I'm not sure what you mean by boosting by facet. Do you mean that you want to boost documents which match a term query? If yes, you can use your_field_name:value^2.0 in the q parameter. -- Regards, Shalin Shekhar Mangar.