Thanks Nick.

With worked with term and its value. 

-----Original Message-----
From: Gupta, Rajiv [mailto:rajiv.gu...@netapp.com] 
Sent: Wednesday, November 23, 2016 9:02 PM
To: user@lucy.apache.org
Subject: RE: [lucy-user] Doc id from hits and remove redundant documents

Thanks for your reply Nick. 

I wanted to delete the old documents that is why I was trying to get the doc_id 
and use that to delete it. However, that does not help it deleted other 
documents and keep changing the document. I wanted to use delete by term but in 
my doc I don't have any primary key. 

I add document like this:

$indexer->add_doc({
                title    => $mytitle,
                content  => substr($mybodytext,0,1024),
                url      => $onlyfilename,
                urlpath  => $filpath,
                position => $fileseektostart,
                linenum  => $filelinenumtostart,
                jobtype  => $self->{_logfile_hash}{$filetoindex}[5] ,
            });

The title is the key that I use to query for any search. Will term be its value?

The title key values are [1,2,3,4] then will that work?

$indexer->delete_by_term(
    field => 'title'  # required
    term  => 4   # required
);

Thanks,
Rajiv

-----Original Message-----
From: Nick Wellnhofer [mailto:wellnho...@aevum.de]
Sent: Wednesday, November 23, 2016 8:55 PM
To: user@lucy.apache.org
Subject: Re: [lucy-user] Doc id from hits and remove redundant documents

On 23/11/2016 16:11, Nick Wellnhofer wrote:
> Typically, you use one of the fields in your schema as primary key and 
> delete documents using delete_by_term:
>
>     $indexer->delete_by_term(my_primary_key => $value);

Oops, this should have been:

     $indexer->delete_by_term(
         field => 'my_primary_key',
         term  => $value,
     );

Nick

Reply via email to