Well, you're not giving us much to go on here other than code inspection.
It would be much more useful to give us the exception trace, try using
e.printStackTrace();
As an added benefit, that often allows me to figure out the problem
myself, which is faster.....

But at a guess, you're destroying your index with the call
FSDirectory directory = FSDirectory.getDirectory(indexDir,true)

because the second parameter is set to true, causing a new
directory to be created or the old one to be erased. This call
as been deprecated in Lucene 2.1, what version are you using?

And the line
System.out.println("The value of Deleted Document is " +directory);

confuses me a lot since directory is an FSDirectory, not a string.

Best
Erick

On 4/7/07, Ratnesh,V2Solutions India <[EMAIL PROTECTED]>
wrote:


Hi,
I am trying like this in my code but  control is going in catch instead of
try block

else {
                        //if (LOG.isInfoEnabled())
                                //LOG.info("Document " + url + " has no
OBJECT links.");
                                try{
                                        //LOG.info("Document " + url + "
has no OBJECT links.");
                                        surl1=url.toString();

                                String
indexDir="E:\\eclipse\\310307\\objtest\\crawl-result\\index";
                                FSDirectory directory =
FSDirectory.getDirectory(indexDir,true);
                                //LOG.info("Document " + directory + " is
the  DIRECTORY VALUES.");
                                IndexReader reader = IndexReader.open
(directory);
                                if(true){
                                System.out.println("The value of Deleted
Document is " +directory);
                                Term term = new Term("url", surl1);
                            int deleted = reader.deleteDocuments(term);

                                }
                                directory.close();
                            reader.close();
                                }
                                catch(Exception e){System.out.println("Exception
Found In Block");}

                                //IndexReader ir=new IndexReader(dir);
                                //setNonObjectUrl(surl1);
                                //return surl1;
                }

                return doc;

can you brief me where did I go wrong??

Ratnesh, V2Solutions India

Otis Gospodnetic wrote:
>
> Hi Ratnesh,
>
> 1. There is no need to use that many question marks, really.
> 2. Use java-user list, not java-dev
> 3. You cannot delete using negative criteria.  You can delete 1 Document
> using its document ID, or you can delete 1 or more Documents using a
Term
> where you specify a field name and a value.  So, you can delete all
> Documents that have a field X with value Y, but you cannot delete
> Documents that do *not* have a value Y in field X.
>
> This must be in the FAQ, is it not?
>
> Otis
>  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> Simpy -- http://www.simpy.com/  -  Tag  -  Search  -  Share
>
> ----- Original Message ----
> From: "Ratnesh,V2Solutions India" <[EMAIL PROTECTED]
>
> To: java-dev@lucene.apache.org
> Sent: Friday, April 6, 2007 9:39:23 AM
> Subject: IndexReader.deleteDocuement(); How to use it with our code??
>
>
> HI,
> I have written a plugin which finds out "object" tags url and store it
in
> the index with "objects" fields.
> I am intrested in getting only those url's which has "object" tag but
> instead I get all the urls to be indexed.
>
> So what I want is to delete some unwanted urls which don't have "object"
> tag.
>
> So how shall I do it??
>
> Can nybody help me resolving this issue???
>
>
> Ratnesh, V2Solutions India
> --
> View this message in context:
>
http://www.nabble.com/IndexReader.deleteDocuement%28%29--How-to-use-it-with-our-code---tf3536867.html#a9872410
> Sent from the Lucene - Java Developer mailing list archive at Nabble.com
.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

--
View this message in context:
http://www.nabble.com/Re%3A-IndexReader.deleteDocuement%28%29--How-to-use-it-with-our-code---tf3537305.html#a9882808
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]


Reply via email to