Hi this is my code snippets. I am using Lucene 1.9.1 API . and Getting the
following exception please someone help me .....................,,, Getting
over from this problem
/**
* Adds searchable fields to a document, that can be used to find if the
* document has links to OBJECT tag information or not.
*/
public class OBJECTLinkIndexingFilter implements IndexingFilter {
public static final Log LOG =
LogFactory.getLog(OBJECTLinkIndexingFilter. class);
public static String FIELD = "objects";
private String surl1;
private String surl;
int doc;
private Configuration conf;
/**
* Searches through the parse object's metadata to add the indexing
links
* references.
*/
public Document filter(Document doc, Parse parse, UTF8 url,
CrawlDatum datum, Inlinks inlinks) throws
IndexingException {
Metadata metadata = parse.getData().getParseMeta();
// index if the object has RDF metadata or not
String hasOBJECT = metadata.get(OBJECT.HAS_OBJECT_LINK);
if (hasOBJECT != null && hasOBJECT.equals( "true")) {
if (LOG.isInfoEnabled()) {
LOG.info( "OBJECT: document " + url + " has OBJECT
links");
}
// For each metadata tag beginning with our RDF prefix,
add it to
// the
// searchable fields
for (String s : metadata.names()) {
if (s.startsWith(OBJECT.HAS_OBJECT_LINK)) {
surl = url.toString();
addFeature(doc, surl );
if (LOG.isInfoEnabled()) {
LOG.info( "\ts");
}
}
}
} else {
try{
surl1=url.toString();
String
indexDir="E:/eclipse/310307/objtest/crawl-result/index/" ;
FSDirectory directory =
FSDirectory.getDirectory(indexDir,false );
IndexReader reader =
IndexReader.open(directory);
Term term = new Term("url" , surl1 );
int deleted = reader.deleteDocuments(term);
LOG.info( "Document is the RATNESH
SRIVASTAVA."+deleted);
directory.close();
reader.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
return doc;
}
/**
* Adds an index field to the document.
*/
private void addFeature(Document doc, String feature) {
doc.add( new Field( FIELD, feature, Field.Store.YES,
Field.Index.UN_TOKENIZED));
}
public void setConf(Configuration conf) {
this.conf = conf;
}
public Configuration getConf() {
return this.conf;
}
Instead of true , I made Boolean call inside getDirectory to false. and if I
give path
String indexDir=
"E:/eclipse/310307/objtest/crawl-result/indexes/part-00000"; it does not
show
any exception Instead doing nothing?? But mentioning as above for "index"
directory gives exception .
java.io.IOException: E:\eclipse\310307\objtest\crawl-result\index not a
directory
at org.apache.lucene.store.FSDirectory.init(FSDirectory.java:180)
at org.apache.lucene.store.FSDirectory.getDirectory
(FSDirectory.java:141)
at
org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:117)
at
in.v2solutions.com.OBJECTLinkIndexingFilter.filter(OBJECTLinkIndexingFilter.java:88)
at
org.apache.nutch.indexer.IndexingFilters.filter(IndexingFilters.java:72)
at org.apache.nutch.indexer.Indexer.reduce(Indexer.java:235)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:247)
at
org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:112
Why is this?? Please bear with me as I am new bie to face the problem with
Lucene indexes.
Regards,
--
View this message in context:
http://www.nabble.com/IndexReader.deleteDocuement%28%29--How-to-use-it-with-our-code---tf3547568.html#a9903109
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]