It's all about the analyzer you use. The StandardAnalyzer
does some complicated things with dotted names, in an attempt to "Do What You Mean". Perhaps the WhitespaceAnalyzer
will be a better match for your needs.
public static void main(String[] args) throws Exception {
RAMDirectory dir = new RAMDirectory();
IndexWriter iw = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("text", "A.B.C.D DEF", Field.Store.YES, Field.Index.ANALYZED));
iw.addDocument(doc);
iw.close();
IndexSearcher searcher = new IndexSearcher(dir);
QueryParser queryParser = new QueryParser("text", new WhitespaceAnalyzer());
// prints 0
System.out.println(searcher.search(queryParser.parse("ABCD"), 1).totalHits);
// prints 1
System.out.println(searcher.search(queryParser.parse("A.B.C.D"), 1).totalHits);
}