Aishwarya V
Aishwarya V

Reputation: 63

Wildcard Queries with multiple words in Lucene

I am developing a sample API that accepts the ColumnName and value that is to be searched. The API searches and returns the related results in XML format. I am using StandardAnalyser of Lucene. I have a search phrase "Central West*" for a COMPANYNAME field. I have 2 records withCOMPANYNAME field set to "CentralWest" in my database. When I search with the above stated search phrase, I am getting those two records as my result. But when I search with "Central We*" I am getting no results. I dont know thats the problem I am facing. I read like using QueryParser is the best way. Is there is no way to provide the solution for the problem in StandardAnalyser and whats the problem am I facing?

Upvotes: 2

Views: 1341

Answers (1)

Karsten R.
Karsten R.

Reputation: 1758

You are using StandardAnalyzer and have results for phrase "Central West*" but not for Central We*.

First of all: StandardAnalyzer does not split CentralWest. So you can not match CentralWest with phrase "Central West" (WordDelimiter Filter would do).

Most likely you are using a query parser without wildcard support. And there are few query parsers with wildcard support in phrases like ComplexPhraseQueryParser.

Without wildcard support the StandardAnalyzer does not differ between ´West*´ and ´West´ so you have a match. We*and We are treaded like we, so you have no match.

Upvotes: 3

Related Questions