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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -