2
votes

I plan to implement my website's search engine using Apache Solr. I have a search index built, and one of its documents is:

Virtua Fighter 2

Performing a search of: Virtua*

returns all records starting with "Virtua", as expected.

A search of "Virtua Fighter 2" returns an exact match.

I would like a search of "Virtua Fighter" to return Virtua Fighter 2 in its result set. But a phrase search of Virtua Fighter omits Virtua Fighter 2 from its result sets. And I'm unable to use a wildcard in a phrase search-- "Virtua Fighter*" does not return any results.

What type of query needs to be written to support this? Or what types of Lucene queries are used for simple website search engines?

1
Consider a copy field that you use to do your searches against. You would have to create a new field type and use the appropriate TokenizerFactories [wiki.apache.org/solr/…, but I'm not versed enough to give a proper answer.Yzmir Ramirez

1 Answers

3
votes

I'm guessing you're using a Keyword analyzer for the titles? (Or another analyzer that doesn't split on tokens.)

You should just use a Standard Analyzer, then phrase queries will work fine.