A small mistake today caused Lucene to be unable to search for results. It is important to be careful.

Today I did an episode in search engine. I used MultiFieldQueryParser to perform query operations, but I couldn't find it no matter how I searched. Why? Mainly I made a careless mistake:

MultiFieldQueryParser queryParser = new MultiFieldQueryParser(fields, analyzer);

Query query = queryParser.parse("Lucene");

That's no problem,

This is no problem, but when I created the index, when processing the html text, I replaced all the spaces. This resulted in the text being a long, messy arrangement of letters, so I didn't use it. No Analyzer can parse it normally. This is a very secret error. Record it again. If a friend encounters this kind of problem and cannot find out the cause of the error, be sure to go through the original steps. Maybe the error is there.