Currently, wildcard queries are a bit different

Query : http://localhost:8983/solr/core1/select?fl=id&q=turpis&qf=content&debugQ...
Gives us : +(content:turpi)~0.01 ()

This is due to the analysers that deduct a word to its base form.

However

Query : http://localhost:8983/solr/core1/select?fl=id&q=turpis*&qf=content&debug...
Gives us : +(content:turpis*)~0.01 ()

We can see that this gives us a different result.

Solution?
We should add multiterm to the text analysers, or actually to any analyser where a wildcard could help with partial word matching.

How?

    <fieldType name="text" class="solr.TextField" positionIncrementGap="100" >
      <analyzer type="index">
        // stuff here
      </analyzer>
      <analyzer type="query">
        // stuff here
      </analyzer>
      <analyzer type="multiterm">
        // same content here as the query
      </analyzer>
    </fieldType>

This will give us :

Query : http://localhost:8983/solr/core1/select?fl=id&q=turpis*&qf=content&debug...
Gives us : +(content:turpi*)~0.01 ()

CommentFileSizeAuthor
#4 1879762-4.patch5.42 KBNick_vh
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nick_vh’s picture

Priority: Normal » Major
Nick_vh’s picture

Issue summary: View changes

Updated issue summary.

Nick_vh’s picture

Project: Apache Solr Search » Apache Solr Common Configurations
Version: 7.x-1.x-dev »
Issue summary: View changes
Pol’s picture

This is, I think, the best solution when you use a view with search_api and configure the query parse mode in the Views Query settings to "Direct query".

I'm using it now, and I'm very happy.

EDIT: No need to set the parse mode to "Direct query", it also works with the default mode "Multiple terms".

Nick_vh’s picture

Status: Active » Needs review
FileSize
5.42 KB

Adding a patch that adds this multiterm component.
I've tested it with solr 3.5 and it seems that solr 3.5 loads with this analyzer, even though it does not support it. Trying 3.4 also and if that does not appear to be any problem we should be ready to commit this. Solr 4 has more multitermaware components but we do not want to rely on those.,

Pol’s picture

Will try that asap !

Thanks Nick :)

Nick_vh’s picture

Status: Needs review » Fixed

Committed. Finally

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.