Forum: Ferret Confused about Search Results

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
JT K. (Guest)
on 2007-01-05 18:54
Hi everyone,

I'm pretty new to Lucene and Ferret, so I feel that this is most likely
myself not completely understanding the correct way to do this.  I haved
indexed ~2200 text files (of various sizes), and I am now running
searches on the index to get a feel for Lucene and Ferret.

In my first program, which is using Lucene I search for 'influenza' and
get the following result plus a listing of all the filenames:

     Found 210 document(s) that matched query 'influenza

Here is the Lucene code specific to searching:

     Directory fsDir = FSDirectory.getDirectory(indexDir, false);
     IndexSearcher is = new IndexSearcher(fsDir);

     QueryParser qp = new QueryParser("contents", new
StandardAnalyzer());
     Query query = qp.parse(q);
     Hits hits = is.search(query);

For my second program, I use Ferret to search an index of the same
files, which was made using Ferret.

I get the following results (id and score):

     Searching for 'influenza'...
     CDC Influenza Update with score of 0.897013485431671.
     CDC Influenza Update with score of 0.897013485431671.
     CDC Influenza Update with score of 0.897013485431671.
     CDC Influenza Update with score of 0.897013485431671.
     CDC Influenza Update with score of 0.897013485431671.
     CDC Update 4.3.06 (Avian & Seasonal Influenza) with score of
0.776836454868317.
     CDC Update 4.3.06 (Avian & Seasonal Influenza) with score of
0.776836454868317.
     CDC Update 4.3.06 (Avian & Seasonal Influenza) with score of
0.776836454868317.
     CDC Update 4.3.06 (Avian & Seasonal Influenza) with score of
0.776836454868317.
     CDC Update 4.3.06 (Avian & Seasonal Influenza) with score of
0.776836454868317.

As you can see, there are only 10 results, and they are from two
different files.  Does Ferret only return 10 search results at a time or
something?  I've reindexed and stuff a few times, and the results
changed slightly, but there are always 10 results.  Here is my code:

     searcher.search_each(Search::TermQuery.new(:content,
"influenza"),{}) do |id, score|
        puts "#{searcher[id][:title]} with score of #{score}."
     end

What do I need to do to get the same results as I did using Lucene?
I've read through every tutorial about Ferret I could find (that was
about 4 or 5 of them), read through several threads here, and read the
API, but I'm still not 100% clear on what to do.

Thanks,

JT
William M. (Guest)
on 2007-01-06 20:30
(Received via mailing list)
Excerpts from Jt Kimbell's message of Fri Jan 05 08:54:44 -0800 2007:
> As you can see, there are only 10 results, and they are from two
> different files.  Does Ferret only return 10 search results at a time or
> something?

http://ferret.davebalmain.com/api/classes/Ferret/I...

>      searcher.search_each(Search::TermQuery.new(:content,
> "influenza"),{}) do |id, score|

search_each(Search::TermQuery.new(:content, "influenza"), :limit =>
:all)

(Or :limit => 1000, etc.)
Jan P. (Guest)
on 2007-01-06 20:30
(Received via mailing list)
Hi Jt,

please have a look at the :limit symbol of the options-hash =>
http://ferret.davebalmain.com/api/classes/Ferret/S...

Cheers,
Jan P.
JT K. (Guest)
on 2007-01-08 16:07
Thanks so much to both of you!  Sorry I missed that.

JT
This topic is locked and can not be replied to.