At 4:40 PM +0100 6/6/07, galo wrote:
>1. I want to use solr for some sort of live search, querying with incomplete 
>terms + wildcard and getting any similar results. Radioh* would return 
>anything containing that string. The DisMax req. hander doesn't accept 
>wildcards in the q param so i'm trying the simple one and still have problems 
>as all my results are coming back with score = 1 and I need them sorted by 
>relevance.. Is there a way of doing this? Why doesn't * work in dismax (nor ~ 
>by the way)??

DisMax was written with the intent of supporting a simple search box in which 
one could type or paste some text, e.g. a title like

    Santa Clause: Is he Real (and if so, what is "real")?

and get meaningful results.  To do that it pre-processes the query string by 
removing unbalanced quotation marks and escaping characters that would 
otherwise be treated by the query parser as operators:

    \ ! ( ) : ^ [ ] { } ~ * ?

I have a local version of DisMax which parameterizes the escaping so certain 
operators can be allowed through, which I'd be happy to contribute to you or 
the codebase, but I expect SimpleRH may be a better tool for your application 
than DisMaxRH, as long as you get it to score as you wish.

Both Standard and DisMax request handlers use SolrQueryParser, an extension of 
the Lucene query parser which introduces a small number of changes, one of 
which is that prefix queries e.g. Radioh* are evaluated with 
ConstantScorePrefixQuery rather than the standard PrefixQuery.

In issue SOLR-218 developers have been discussing per-field control of query 
parser options (some of it Solr's, some of it Lucene's).  When that is 
implemented there should additionally be a property useConstantScorePrefixQuery 
analogous to the unfortunately-named QueryParser useOldRangeQuery, but handled 
by SolrQueryParser (until CSPQs are implemented as an option in Lucene QP).

Until that time, well, Chris H. posted a clever and rather timely workaround on 
the solr-dev list:

>one work arround people may want to consider ... is to force the use of a 
>WildCardQuery in what would otherwise be interpreted as a PrefixQuery by 
>putting a "?" before the "*"
>
>ie: auto?* instead of auto*
>
>(yes, this does require that at least one character follow the prefix)

Perhaps that would help in your case?

- J.J.

Reply via email to