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
--
Posted via http://www.ruby-forum.com/.