lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruud Dozijn <rdoz...@hotmail.com>
Subject checking index for existance of paths
Date Tue, 24 Sep 2013 10:58:33 GMT
hi all,

I
 am quite new to Lucene. I have downloaded an example from a tutorial, 
adapted it for version 3.6 (which is the one I have installed) and run 
it several times.

The script indexes an array of files and adds 
them to the Lucene index. Then, the user can query the documentset by 
keying in queries.

If a file is added two times, it appears two 
time in the query results. I want to change this behaviour by first 
testing if a file is in the index already, and skipping the add if this 
is the case.

When a file is added to the index, the following code is executed:

    doc.add(new Field("contents", tekst , Field.Store.YES, Field.Index.ANALYZED));
    doc.add(new Field("path", f.getPath(), Field.Store.YES, Field.Index.NOT_ANALYZED));
    doc.add(new Field("filename", f.getName(), Field.Store.YES, Field.Index.NOT_ANALYZED));

If I want to check a certain file with for example query 'filename:/tmp/test/t1.txt', I get
no results, because the slashes are converted to spaces when doing an exact match, or the
query is split up into 'filename:tmp' , 'filename:test' and 'filename:t1.txt'. Which is _not_
what I want. 

What can I do to check for a complete file path?

thanks in advance, Ruud 		 	   		  
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message