java - How to transfer lucene36 to lucene 40 -


here code:

 public int docscontainterm(term tm) throws ioexception {   termdocs termdocs = indexreader.termdocs(tm);     //docsenum termdocs = indexreader.     int count = 0;     while (termdocs.next()) {         if (indexreader.docfreq(tm) != 0) {             count++;         }     }     return count; }  public int tf(term tm, string docname) throws ioexception {     termdocs termdocs = indexreader.termdocs(tm);     while (termdocs.next()) {         document doc = indexreader.document(termdocs.doc());         if (doc.get("filename").equals(docname)) {             return termdocs.freq();         }     }     return 0; } public static void main(string[] args) throws corruptindexexception, ioexception {     string indexdir = "indexdir";     string docs = "docs";     string query = "kennedy administration pressure on ngo dinh diem stop suppressing buddhists";     directory dir = fsdirectory.open(new file(indexdir));     indexreader indexreader = indexreader.open(dir);     bm25 bm25 = new bm25(indexreader, docs);     system.out.println(bm25.getcontent("171"));     system.out.println(bm25.htmlgetcontent("171", query.tolowercase())); } 

}

i have searched it, should change termdocs docsenum,but don't know how change. here error: exception in thread "main" java.lang.error: unresolved compilation problem:

at bm25.main(bm25.java:269) 

from apache lucene migration guide,

  1. terms binary in nature (arbitrary byte[]), represented bytesref class (which provides offset + length "slice" existing byte[]).

  2. fields separately enumerated (fields.iterator()) terms within each field (termenum).

  3. termdocs renamed docsenum.

  4. termpositions renamed docsandpositionsenum, , no longer extends docs enumerator (docsenum).

  5. deleted docs no longer implicitly filtered docs/positions enums. instead, pass bits skipdocs (set bits skipped) when obtaining enums. also, can ask reader deleted docs.

  6. the docs/positions enums cannot seek term. instead, termsenum able seek, , request docs/positions enum termsenum.

  7. termsenum's seek method returns more information.

  8. termsenum has ord() method, returning long numeric ordinal (ie, first term 0, next 1, , on) term it's not positioned to. there corresponding seek(long ord) method. note these methods optional; in particular multifields termsenum not implement them.

  9. how obtain enums has changed. primary entry point fields class. likewise docsandpositionsenum.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -