lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allison, Timothy B." <>
Subject RE: Trouble GetSpans lucene 4
Date Wed, 08 Apr 2015 00:17:00 GMT
Oh, ok, if that's just a regular query, you will need to convert it to a SpanQuery, and you
may need to rewrite the SpanQuery after conversion.

If you're trying to do a concordance or trying to retrieve windows around the hits, take a
look at ConcordanceSearcher within:

With any luck, I should find the time to get back to the Solr wrapper under solr-5411 that
Jason Robinson initially developed.  

-----Original Message-----
From: Test Test [] 
Sent: Tuesday, April 07, 2015 3:51 PM
Subject: Re: Trouble GetSpans lucene 4

origQuery is a Query object, i got it from a ResponseBuilder object, passed by the method
ResponseBuilder rb // it's method parameterQuery origQuery = rb.getQuery(); 
Thanks for the link, i'll keep you informed.

     Le Mardi 7 avril 2015 20h26, "Allison, Timothy B." <> a écrit

 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 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

-----Original Message-----
From: Compte Poubelle [] 
Sent: Tuesday, April 07, 2015 1:53 PM
Subject: Re: Trouble GetSpans lucene 4


Best regards.

> On 6 avr. 2015, at 21:32, Test Test <> 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"."" 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 ( == true) {//}
> Thanks.Regards.

View raw message