On 4/3/07, Jens Kraemer <[EMAIL PROTECTED]> wrote:
> On Mon, Apr 02, 2007 at 11:57:37AM -0700, Ryan King wrote:
> > On 3/28/07, Ryan King <[EMAIL PROTECTED]> wrote:
> [..]
> >
> > FWIW, I upgraded to 0.11.3 on my test box and it didnt' change
> > anything. Are my assumptions about PFA wrong? Or is there a bug?
>
> I guess that's a bug - I can perfectly reproduce that behaviour here.
>
> The funny thing is that this does not necessarily mean that it doesn't
> work as intended. Just for fun I wrote an analyzer that completely
> ignores the input it should analyze, and always uses a fixed text
> instead:
>
> class TestAnalyzer
>   def token_stream field, input
>     ts = LetterTokenizer.new("senseless standard text")
>     puts "token_stream for :#{field} and input <#{input}>: #{ts.inspect}\n 
> #{ts.text}"
>     ts
>   end
> end
>
> a = TestAnalyzer.new
> ts = a.token_stream :test, 'foo bar'
> puts ts.text                           # 'senseless standard text' as expected
>
> pfa = PerFieldAnalyzer.new(StandardAnalyzer.new())
> pfa[:test] = TestAnalyzer.new
> ts = pfa.token_stream :test, 'foo bar'
> puts ts.text                           # surprise: 'foo bar'
>
> I guess the pfa does not give the text to analyze via the token_stream
> method, but sets it later by using the Tokenizer's text=() method.

I don't think so. I've tried overriding #text=, but it never gets called.

-ryan
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to