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 Jugal Kolariya <ju...@rancoretech.com> on 2013/08/24 12:57:25 UTC

Delete content corresponding to FileName from INDEX and corresponding change in INDEXES FOR SUGGESTION.

Hello.

We are indexing files on the basis of following fields:

1. name
2. content
3. ValidContents.

Now for these fields, following work is done:

a. Field Name : Content -> Indexing complete document. Used for queries 
such as Boolean/WildCard etc.

b. Field Name : ValidContents -> Indexing each document line by line. 
Used for performing phrase match, phrase suggestion, infix suggester etc.



Using this MAIN INDEXES, I create indexes for Phrase Match, Did YOu Mean 
(User supplied files) and infix suggester. Lets name this CHILD INDEXES.

Problem:

Few of the files are now deleted by an operation. So, I wish to delete 
all indexes which corresponds to these filenames.

I tried using

Term term1=new Term("name","D111-123-987.txt");
Query query = new WildcardQuery(term1);
writer.deleteDocuments(query);

We are not sure, of following:

a. Deleting indexes and documents corresponding to filename will 
actually delete indexes for particular file name in "Content" and 
"ValidContents" field inside MAIN INDEXES.

b. Doing this will automatically remove indexes of provided filename 
from "CHILD INDEXES".

What we are trying here is If I Delete indexes for a file from MAIN 
INDEXES, then all indexes which are created before using that MAIN INDEX 
for given filename should also be deleted.  THIS WILL ALLOW PHRASES 
APPEARING AS SUGGESTIONS FROM DELETED FILE TO STOP APPEARING IN 
SUGGESTION. This is the ideal case.

Any guidance will be highly appreciated.,





-- 


        Thanks & regards
        /Jugal Kishore Kolariya
        /


Re: Delete content corresponding to FileName from INDEX and corresponding change in INDEXES FOR SUGGESTION.

Posted by Ian Lea <ia...@gmail.com>.
How many lucene indexes do you have?  Lucene has no concept of main or
child indexes.  To remove all docs from an index for a given indexed
field write.deleteDocuments() is the way to do it, although in your
case probably by Term, like your code sample: Term term1=new
Term("name","D111-123-987.txt") assuming that is the correct indexed
value.  Using a WildcardQuery doesn't make sense here.

Repeat for any/all indexes.


--
Ian.


On Sat, Aug 24, 2013 at 11:57 AM, Jugal Kolariya
<ju...@rancoretech.com> wrote:
> Hello.
>
> We are indexing files on the basis of following fields:
>
> 1. name
> 2. content
> 3. ValidContents.
>
> Now for these fields, following work is done:
>
> a. Field Name : Content -> Indexing complete document. Used for queries such
> as Boolean/WildCard etc.
>
> b. Field Name : ValidContents -> Indexing each document line by line. Used
> for performing phrase match, phrase suggestion, infix suggester etc.
>
>
>
> Using this MAIN INDEXES, I create indexes for Phrase Match, Did YOu Mean
> (User supplied files) and infix suggester. Lets name this CHILD INDEXES.
>
> Problem:
>
> Few of the files are now deleted by an operation. So, I wish to delete all
> indexes which corresponds to these filenames.
>
> I tried using
>
> Term term1=new Term("name","D111-123-987.txt");
> Query query = new WildcardQuery(term1);
> writer.deleteDocuments(query);
>
> We are not sure, of following:
>
> a. Deleting indexes and documents corresponding to filename will actually
> delete indexes for particular file name in "Content" and "ValidContents"
> field inside MAIN INDEXES.
>
> b. Doing this will automatically remove indexes of provided filename from
> "CHILD INDEXES".
>
> What we are trying here is If I Delete indexes for a file from MAIN INDEXES,
> then all indexes which are created before using that MAIN INDEX for given
> filename should also be deleted.  THIS WILL ALLOW PHRASES APPEARING AS
> SUGGESTIONS FROM DELETED FILE TO STOP APPEARING IN SUGGESTION. This is the
> ideal case.
>
> Any guidance will be highly appreciated.,
>
>
>
>
>
> --
>
>
>        Thanks & regards
>        /Jugal Kishore Kolariya
>        /
>

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