lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Humberto Rocha <>
Subject Problems with Lucene and BrazilianAnalyzer (lucene-core-4.9.0.jar and lucene-analyzers-common-4.9.0.jar): Search returning more results that the desired
Date Wed, 25 Mar 2015 11:43:59 GMT

I'm indexing 4 .txt files using:
-Lucene (lucene-core-4.9.0.jar)
-BrazilianAnalyzer (lucene-analyzers-common-4.9.0.jar)

The files have the following content:
- File A: tecnológico
- File B: tecnologico
- File C: tecnologias
- File D: tecnolo

For the search used as well:
- Lucene (lucene-core-4.9.0.jar)
- BrazilianAnalyzer (lucene-analyzers-common-4.9.0.jar)

Using the parameter "tecnologico" get the following search result:
- File A: tecnológico
- File B: tecnologico
- File C: tecnologias

I tried the same search on the same indexes by Luke and the same results
are presented.

My question: is that correct?

Shouldn't receive only:
- File A: tecnológico
- File B: tecnologico


Is there any way to make this result stay this way?

In this context for example, I would like to receive:
- File A: tecnológico
- File B: tecnologico

-Follow code snippet used for indexing:

    . . .
    BrazilianAnalyzer analyzer = new BrazilianAnalyzer(Version.LUCENE_4_9);
    IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_4_9,
    Directory d = new SimpleFSDirectory(indexDir);
    writer = new IndexWriter(d, config);
    Document doc = new Document();
    doc.add(new TextField("filename", file.getAbsolutePath(),
    doc.add(new TextField("contents",
    . . .

- Follow code snippet used to search:

    . . .
    Directory diretorio = new SimpleFSDirectory(new
    IndexReader leitor =;
    IndexSearcher buscador = new IndexSearcher(leitor);
    BrazilianAnalyzer analisador = new
    QueryParser parser = new QueryParser(Version.LUCENE_4_9,
    Query query = parser.parse(parametro);
    TopDocs resultado =, 10);
    . . .

I appreciate the help!

Thanks a lot!


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message