lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "fzsu" <>
Subject SpanNearQuery for phrases
Date Fri, 30 Nov 2007 12:45:19 GMT
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? 





  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message