On 8/29/06, Jens Kraemer <[EMAIL PROTECTED]> wrote:
> On Tue, Aug 29, 2006 at 02:06:16AM +0200, Clare wrote:
> > Hi after upgrading to ferret 0.10.1 and bleeding edge aaf i'm getting
> > some strange behavior. Generally much better stability with new version
> > of ferret but when i add new items for some reason i can no longer
> > search with a *. Or rather i can but it returns no results and no
> > errors. I can search and get results normally on other searches and when
> > i rebuild the index i can search with * until i add a new item. Has
> > anyone else experienced this? I use * in my browse items page.
>
> do you mean a query only consisting of '*' or wild card queries like
> 'test*' ? The former isn't an allowed query, afaik. Don't know why it
> works before modifying the index. Here's the snippet how I reproduced
> this behavior:
>
> require 'rubygems'
> require 'ferret'
> include Ferret
> i = I.new
> i << 'just some testing'
> i.search('*').total_hits # => 1
> i << 'another testing session'
> i.search('*').total_hits # => 0
>
>
> why don't you just use find(:all) on your browse page ?
Thanks for the snippet Jens. This was a bug (quite a serious one)
which I have now fixed. As Jens said, "*" queries were not a good idea
and would fail on most indexes because of the number of terms (the got
expanded as MultiTermQueries with every single term in the index).
However, I've now modified the QueryParser to translate "*" to a
MatchAllQuery so there should be no problem, performance or otherwise
with using "*" in your queries.
I should note here that "title:*" will match all documents include
documents that don't have a :title field. If you only want documents
with a :title field you should use "title:?*". Having said that, if
you are using these types of queries there is probably a better way to
do what you are doing.
Cheers,
Dave
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk