You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Ulaganathan, Udhayakumar" <ud...@siemens.com> on 2014/09/16 12:31:43 UTC
Need help to do simple line by line indexing and search
Hi,
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 characters)
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)
[cid:image001.png@01CFD1C6.C3D8D150]
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);
Re: Need help to do simple line by line indexing and search
Posted by atawfik <co...@gmail.com>.
Hi,
Can you share the implementation of your analyzer. It might be the problem.
It will be helpful to share also a sample of your indexed documents.
Regards
Ameer
--
View this message in context: http://lucene.472066.n3.nabble.com/Need-help-to-do-simple-line-by-line-indexing-and-search-tp4159172p4159524.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org