Wildcard searching and highlighting with Solr 1.4

Posted by andy on Stack Overflow See other posts from Stack Overflow or by andy
Published on 2010-03-10T01:35:58Z Indexed on 2010/05/23 22:50 UTC
Read the original article Hit count: 439

Filed under:
|
|

Hey guys,

I've got a pretty much vanilla install of SOLR 1.4 apart from a few small config and schema changes.

<requestHandler name="standard" class="solr.SearchHandler" default="true">
    <!-- default values for query parameters -->
    <lst name="defaults">
        <str name="defType">dismax</str>
        <str name="echoParams">explicit</str>
        <str name="qf">
            text
        </str>
        <str name="spellcheck.dictionary">default</str>
        <str name="spellcheck.onlyMorePopular">false</str>
        <str name="spellcheck.extendedResults">false</str>
        <str name="spellcheck.count">1</str>
    </lst>
</requestHandler>

The main field type I'm using for Indexing is this:

<fieldType name="textNoHTML" class="solr.TextField" positionIncrementGap="100">
        <analyzer type="index">
            <charFilter class="solr.HTMLStripCharFilterFactory" />
            <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            <filter class="solr.StopFilterFactory"
                    ignoreCase="true"
                    words="stopwords.txt"
                    enablePositionIncrements="true"
            />
            <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
        </analyzer>
        <analyzer type="query">
            <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
            <filter class="solr.StopFilterFactory"
                    ignoreCase="true"
                    words="stopwords.txt"
                    enablePositionIncrements="true"
            />
            <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
        </analyzer>
    </fieldType>

now, when I perform a search using

"q=search+term&hl=on"

I get highlighting, and nice accurate scores.

BUT, for wildcard, I'm assuming you need to use "q.alt"? Is that true? If so my query looks like this:

"q.alt=search*&hl=on"

When I use the above query, highlighting doesn't work, and all the scores are "1.0".

What am I doing wrong? is what I want possible without bypassing some of the really cool SOLR optimizations.

cheers!

© Stack Overflow or respective owner

Related posts about solr

Related posts about highlighting