lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "O. Olson" <olson_...@yahoo.it>
Subject Re: Negative Boosting documents with a certain word
Date Fri, 01 May 2015 20:19:51 GMT
Thank you very much Chris. I'm sorry I could not get back to you because I
did not have the time to try this.

	If I change my query from q=laptops   to     
q=laptops%20(*:*%20-Refurbished)^10%20(*:*%20-Recertified)^10       I get
exactly what I want! Thank you!!

 Is there anyway to handle a list of such words. If I have about 10 to 15
words, this query would keep getting longer and longer. Is there a better
way to handle this?

Right now, I specify the boost for my request handler as:
<requestHandler name="/select" class="solr.SearchHandler">
  .....
  <str name="boost">ln(qty)</str>
  ....
 </requestHandler>

Is there a way to specify this boost in the Solrconfig.xml?

I tried: <str name="boost">(*:* -Refurbished)^10</str>   and I get the
following exception: 

ERROR - 2015-05-01 15:13:41.609; org.apache.solr.common.SolrException;
org.apache.solr.common.SolrException: org.apache.solr.search.SyntaxError:
Expected identifier at pos 0 str='(*:* -Refurbished)^10'
	at
org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:204)
	at
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:204)
	at
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
	at org.apache.solr.core.SolrCore.execute(SolrCore.java:1976)
	at
org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:777)
	at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:418)
	at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:207)
	at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
	at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
	at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
	at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
	at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
	at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
	at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
	at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
	at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
	at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
	at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
	at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
	at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.Server.handle(Server.java:368)
	at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
	at
org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
	at
org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942)
	at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1004)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at
org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
	at
org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
	at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
	at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.solr.search.SyntaxError: Expected identifier at pos 0
str='(*:* -Refurbished)^10'
	at
org.apache.solr.search.QueryParsing$StrParser.getId(QueryParsing.java:771)
	at
org.apache.solr.search.QueryParsing$StrParser.getId(QueryParsing.java:750)
	at
org.apache.solr.search.FunctionQParser.parseValueSource(FunctionQParser.java:345)
	at org.apache.solr.search.FunctionQParser.parse(FunctionQParser.java:68)
	at org.apache.solr.search.QParser.getQuery(QParser.java:149)
	at
org.apache.solr.search.ExtendedDismaxQParser.getMultiplicativeBoosts(ExtendedDismaxQParser.java:448)
	at
org.apache.solr.search.ExtendedDismaxQParser.parse(ExtendedDismaxQParser.java:211)
	at org.apache.solr.search.QParser.getQuery(QParser.java:149)
	at
org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:147)
	... 31 more


I'm using Solr 4.10.3
	
Thank you once again
O. O.


Chris Hostetter-3 wrote
> https://wiki.apache.org/solr/SolrRelevancyFAQ#How_do_I_give_a_negative_.28or_very_low.29_boost_to_documents_that_match_a_query.3F
> 
> The general principle you need to follow is to boost documents that do 
> *not* match your keyword...
> 
> 	(*:* -Refurbished)^10
> 
> -Hoss
> http://www.lucidworks.com/





--
View this message in context: http://lucene.472066.n3.nabble.com/Negative-Boosting-documents-with-a-certain-word-tp4203224p4203488.html
Sent from the Solr - User mailing list archive at Nabble.com.

Mime
View raw message