7

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!

andy
  • 8,775
  • 13
  • 77
  • 122
  • 1
    Some info I found about this: http://old.nabble.com/Wildcard-on-q.alt-with-Dismax-td17722791.html http://www.mail-archive.com/solr-user@lucene.apache.org/msg21518.html however it would seem that they were fixed for 1.4. I'll keep looking... – Mauricio Scheffer Mar 10 '10 at 22:18
  • cool, cheers Mauricio. I've found quite a lot of info on this topic, but the discussions never address what parameters i need to use, or if i can still use highlighting, scoring, spellchecking etc. cheers though – andy Mar 10 '10 at 23:44

2 Answers2

8

From what I know you can't use wildcards with the dismax handler, see http://wiki.apache.org/solr/DisMaxRequestHandler#q.

To simulate wildcard searching I used EdgeNGrams following some of the instructions here: http://www.lucidimagination.com/blog/2009/09/08/auto-suggest-from-popular-queries-using-edgengrams/. Actually I really only added the edgytext fieldtype to schema.xml and changed the fieldtype of the field I wanted to search.

Hope this helps!

jimmystormig
  • 10,672
  • 1
  • 29
  • 28
5

Or you can grab the latest nightly build and use edismax (ExtendedDismaxQParser).

It handles both trailing and leading wildcards.

Jem
  • 551
  • 3
  • 2
  • cool, thanks Jem, I'll check that out. By the way, are you on the Solr mailing list forum thing? It would be good if Solr could make SO they're official Q&A place... those mailing lists are really unintuitive – andy May 23 '10 at 23:31