Hi all, 

I want to compute the co-occurrence frequency of two phrases within a
certain distance. 

I also get the information from the website that SpanNearQuery can also
implement this, and some snippet code as follow: 

 

SpanQuery   phrA = new SpanTermQuery(new Term("contents","Jean"));
SpanQuery[] phrB = new SpanQuery[2];
 
phrB[0] = new SpanTermQuery(new Term("contents","great"));
phrB[1] = new SpanTermQuery(new Term("contents","actor"));
 
SpanNearQuery query=new SpanNearQuery(new SpanQuery[]{phrA,phrB},20,false);

 

But in my program the error "incompatible type " happened at the last line,
as phrB is an array, while phrA is only a common variable. 

 

Any solution to problem?  Or some other ways? 

 

Best, 

Allen

 

Reply via email to