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 Jay Ess <li...@netrogenic.com> on 2009/10/19 16:32:10 UTC
Boost with wildcard.
The boost (index time) does not work when i am searching for a word with
a wildcard appended to the end.
I stumbled on to this "feature" and its pretty much a show stopper for me.
I am implementing a live search feature where i always have an wildcard
in the last word that is currently being written by the user.
Will this be fixed anytime soon or does anyone have a workaround?
Example :
"playstation*" gives an result with unboosted items but "playstation"
gives the correct one.
Re: Boost with wildcard.
Posted by Yonik Seeley <ys...@gmail.com>.
On Mon, Oct 19, 2009 at 10:32 AM, Jay Ess <li...@netrogenic.com> wrote:
> The boost (index time) does not work when i am searching for a word with a
> wildcard appended to the end.
> I stumbled on to this "feature" and its pretty much a show stopper for me.
> I am implementing a live search feature where i always have an wildcard in
> the last word that is currently being written by the user.
> Will this be fixed anytime soon or does anyone have a workaround?
>
> Example :
> "playstation*" gives an result with unboosted items but "playstation" gives
> the correct one.
All wildcard queries use constant scoring and norms (boost, field
length, etc) aren't consulted. It's working as designed, so not a
bug, so it won't be fixed soon.
The easiest workaround for you could be something like this:
(+playstation*^0 myboostedfield:term_that_appears_in_every_document)
-Yonik
Re: Boost with wildcard.
Posted by Jay Ess <li...@netrogenic.com>.
AHMET ARSLAN wrote:
> I do not know how to solve your problem without writing custom code.
>
>
Aaargh. So now i stand between sticking my head into the source OR
writing my own engine (which is not a big deal becouse my requirements
arent that big but it will anyway set me back a week or so).
> Hope this helps.
>
It sure did. Thanx.
Re: Boost with wildcard.
Posted by AHMET ARSLAN <io...@yahoo.com>.
> The boost (index time) does not work
> when i am searching for a word with a wildcard appended to
> the end.
> I stumbled on to this "feature" and its pretty much a show
> stopper for me.
> I am implementing a live search feature where i always have
> an wildcard in the last word that is currently being written
> by the user.
> Will this be fixed anytime soon or does anyone have a
> workaround?
>
> Example :
> "playstation*" gives an result with unboosted items but
> "playstation" gives the correct one.
Javadoc of SolrQueryParser says:
<p>
* This class also deviates from the Lucene QueryParser by using
* ConstantScore versions of RangeQuery and PrefixQuery to prevent
* TooManyClauses exceptions.
* </p>
If you want to disable this behavior you can modify
protected Query getPrefixQuery(String field, String termStr)
method of SolrQueryParser. But for this to work you also need to write a class that extends QParserPlugin and uses you new SolrQueryParser. You need to define your new QParserPlugin in solrconfig.xml as described here [1]
[1] http://wiki.apache.org/solr/SolrPlugins#QParserPlugin
But prefix queries can easily cause TooManyBooleanClauses if the prefix is short like a*. Since it is going to OR all terms starting with a. Performance can be killer in such cases. I think thats why Solr uses ConstantScore versions. If you want you can increase this number (default is 1024) in solrconfig.xml <maxBooleanClauses>1024</maxBooleanClauses>
I do not know how to solve your problem without writing custom code.
Hope this helps.