java - How to delete old documents from lucene index (filter by Date parameter) -


i new lucene (i'm using java) , i've tried read existing answers in order find out solution problem. unfortunately didn't fix problem, try ask again question:

i have date parameter. need delete documents inside lucene index older date parameter. how can it? i've found 1 solution method isdeleted but, unfortunately, deprecated. in advice!

you can delete documents matching query indexwriter.deletedocuments method, such as:

string datestring = datetools.datetostring(mycutoffdate, datetools.resolution.day); query datequery = termrangequery.newstringrange("datefield", null, datestring, false, false); myindexwriter.deletedocuments(datequery); 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

python - GitPython: check if git is available -

c# - ASP.NET MVC Enumerable to delimited HTML in Razor -