2

I am indexing film titles. Currently I have two fields.

One is a the pre-configured textgen and one is a string, which I altered to be case insensitive.

I use the copyfield directives to index the same data in both fields.

I am using dismax request handler.

I do this to be able to find "lord rings" in the title "the lord of the rings" but as well boost exact matches. So for example "lord or the rings" scores higher than "rings of the lord" but both is found.

Now I played with string fields which seems to be necessary to have exact matching.

But I just dont get any results. I only get results if I search for the exact string. Not even spaces are working...

  • Is it even possible to have a String customized
  • What field configuraition / analyzation would you recommend for this use case?

2 Answers 2

3

"String" fields are not tokenized (so only exact matches will work); you can try switching its data type to "text", or else add a WhitespaceTokenizer to your chain.

Also, you shouldn't need to boost exact matches manually, the scoring algorithm will do it for you.

2

Have a look at the example solr/conf/schema.xml, there are a lot of different types of fields, well documented.

For your type of search you probably need a simple tokenised lower-cased field with positions, such as:

<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.StandardFilterFactory"/>
      <filter class="solr.ASCIIFoldingFilterFactory"/>
      <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
</fieldType>

The ranking should be pretty good already with this.

For standard text search one uses "stopwords" and "stemming", to improve the ranking (as in field below) but for searching titles i would probably not do it:

 <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StandardFilterFactory"/>
        <filter class="solr.ASCIIFoldingFilterFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="stopwords_spanish.txt"
                enablePositionIncrements="true"
                />
        <filter class="solr.SnowballPorterFilterFactory" language="English">
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StandardFilterFactory"/>
        <filter class="solr.ASCIIFoldingFilterFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="stopwords.txt"
                enablePositionIncrements="true"
                />
        <filter class="solr.SnowballPorterFilterFactory" language="English"/\
>
      </analyzer>
    </fieldType>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.