> You have to extend Ferret's Query Parser to achieve this. If you don't
> want to mess around with the grammar stuff the parser code is
> generated
> from, you could also preprocess user queries to modify them
> accordingly
> before giving them to the QueryParser. Can get complicated, too ;-)
I do not enjoy writing parsers, and am not especially good at it. I
think first I'll check out the grammar for the parser and see if I
can modify that. Perhaps creating a SynonymQuery class?
I did consider preprocesing user queries and then just grouping the
resulting or'd query in parens: 'rabbit %{ferret}' would parse to
'rabbit (ferret|"black-footed ferret"|etc|etc)' but I'm sure there
are situations where that would not be good but it's an option.
>
> So you don't really want to specify your SynonymAnalyzer for aaf as
> the
> analyzer to use for indexing and searching (aaf doesn't support
> different analyzers for indexing/searching bec. in general it's a good
> idea to use the same analyzer in both cases).
Thanks, I was looking at aaf wondering how I could specific a
different analyzer to use for searches. I didn't find anything that
would really let me get a hold of the QueryParser to change the
analyzer used. Glad I wasn't just missing it.
>
> If you used plain Ferret and wanted Synonyms everywhere or in a
> specific
> field, but for ALL queries, you could use your Analyzer at indexing
> time,
> but not for Query parsing. In your case, using your WordnetEngine in a
> customized QueryParser or a custom query preprocessor would be the
> better way.
Since this isn't for anything but fun right now (at work I'm stuck
using Oracle's full text engine which has its own set of problems)
first I'll try modifying the QueryParser grammar to account for a new
query type. My C is not very good so hopefully won't have to do much,
but I like that solution better then having to write a pre-processor
for queries.
>
> That's really cool stuff, would you mind posting this to Ferret's Wiki
> so other people can more easily find it? If you included the
> WordnetSynonymEngine that would be even better :-)
>
> Cheers,
> Jens
Thanks, I've posted it to the Ferret wiki. It's quite long but I hope
that's not a problem. I included the wordnetSynonymEngine and created
a YAMLSynonymEngine just to show how it can be pluggable.
Thanks for the tips I'll see what I can accomplish,
Curtis
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk