lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ulaganathan, Udhayakumar" <>
Subject Need help to do simple line by line indexing and search
Date Tue, 16 Sep 2014 10:31:43 GMT

I am a new user to Lucene Search

I want to index the contents of a file.
Contents of the file will be a single file name with extension (file name may contain special
While indexing, I created a new analyzer to tokenize only on new line character.

Path of the file name is -> String Field with Store.YES
Contents of the file is -> TextField with a buffered input stream

Following is the view of the terms (using Luke)


While searching for "7.txt", I need to get the 3 file paths containing the line '7.txt'.
Can anyone help me with the correct way to query this.

Using QueryParser with query string '7.txt' -> parsing it to contents:7 AND contents:txt

Analyzer analyzer = new NewLineAnalyzer (Version.LUCENE_4_9);

QueryParser parser = new QueryParser(Version.LUCENE_4_9, field, analyzer);

Following is always returning 0 matching documents

Query query = new QueryBuilder (analyzer).createBooleanQuery ("contents", queryString, BooleanClause.Occur.MUST);

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