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?
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.
精彩评论