简体   繁体   中英

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 with COMPANYNAME 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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM