lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allison, Timothy B." <talli...@mitre.org>
Subject RE: Trouble GetSpans lucene 4
Date Tue, 07 Apr 2015 18:25:54 GMT
What class is origQuery?

You will have to do more rewriting/calculation if you're trying to convert a PhraseQuery to
a SpanNearQuery.

If you dig around in org.apache.lucene.search.highlight.WeightedSpanTermExtractor in the Lucene
highlighter package, you might get some inspiration.

I have a hack for converting regular queries to SpanQueries here (this is largely based on
WeightedSpanTermExtractor):

https://github.com/tballison/lucene-addons/blob/master/lucene-5317/src/main/java/org/apache/lucene/search/spans/SimpleSpanQueryConverter.java


-----Original Message-----
From: Compte Poubelle [mailto:andymishima@yahoo.fr] 
Sent: Tuesday, April 07, 2015 1:53 PM
To: solr-user@lucene.apache.org
Subject: Re: Trouble GetSpans lucene 4

Up.
Anyone?

Best regards.

> On 6 avr. 2015, at 21:32, Test Test <andymishima@yahoo.fr> wrote:
> 
> Hi, 
> I'm working on TamingText's book.I try to upgrade the code from solr 3.6 to solr 4.10.2.At
the moment, i have a problem about the method "getSpans"."spans.next()" returns always "false".Anyone
can helps?
> SpanNearQuery sQuery = (SpanNearQuery) origQuery;SolrIndexSearcher searcher = rb.req.getSearcher();IndexReader
reader = searcher.getIndexReader();//AtomicReader wrapper = SlowCompositeReaderWrapper.wrap(reader);Map<Term,
TermContext> termContexts = new HashMap<Term, TermContext>();//Spans spans = sQuery.getSpans(wrapper.getContext(),
new Bits.MatchAllBits(reader.numDocs()), termContexts);while (spans.next() == true) {//}
> 
> Thanks.Regards.
> 

Mime
View raw message