On Thu, Mar 29, 2007 at 07:28:36PM +0100, Alex Fenton wrote:
> Jens Kraemer wrote:
> > On Wed, Mar 28, 2007 at 07:30:36PM +0100, Alex Fenton wrote:
> >   
> >> I'd like to be able to run fairly simple queries. I then need to look at 
> >> each term match, and get its document id and the character (not byte) 
> >> position at which it occurs in the source document.
> >>     
> > Without fully understanding what you want to achieve, I guess
> > TermVectors are what you're looking for. 
> Thank you - that class has exactly the data I need. Is there any way to 
> extract the individual TermVectors implied by a set of search results?
> 
> #highlight seems to do this internally, but the only ruby way I've found 
> to access TVs is via index.reader.term_vector(docid_id, :field). I'd 
> like to be able to find the terms in results of eg a fuzzy or phrase search.

you will get the doc_ids back from your search, so wouldn't it work to
just do a search_each and retrieve the term vectors inside the block?

index.search_each(query) do |doc_id, score|
  tv = index.reader.term_vector(doc_id, :field)
end

Jens

-- 
Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[EMAIL PROTECTED] | www.webit.de
 
Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to