Mattias Bud
2007-Jun-04 16:25 UTC
[Ferret-talk] Sorting and getting occurrences of search in hit
Is there any way you could get the number of occurrences of the search in one hit? In a result I get the ferret_rank and ferret_score but not how many hits the search generated in the current record. I would also like to be able to sort after this when I search. /mattias -- Posted via http://www.ruby-forum.com/.
Mattias Bud
2007-Jun-14 15:59 UTC
[Ferret-talk] Sorting and getting occurrences of search in hit
Doesn''t anyone have any input on this? Mattias -- Posted via http://www.ruby-forum.com/.
Mattias Bud
2007-Jun-14 16:22 UTC
[Ferret-talk] Sorting and getting occurrences of search in hit
Mattias Bud wrote:> Is there any way you could get the number of occurrences of the search > in one hit? > > In a result I get the ferret_rank and ferret_score but not how many hits > the search generated in the current record. > > I would also like to be able to sort after this when I search. > > /mattiasForgot the original message. Doesn''t anyone have any input on this? mattias -- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2007-Jun-15 07:35 UTC
[Ferret-talk] Sorting and getting occurrences of search in hit
On Thu, Jun 14, 2007 at 06:22:53PM +0200, Mattias Bud wrote:> Mattias Bud wrote: > > Is there any way you could get the number of occurrences of the search > > in one hit? > > > > In a result I get the ferret_rank and ferret_score but not how many hits > > the search generated in the current record. > > > > I would also like to be able to sort after this when I search.Do you mean the number of times the query occurs in a hit? There''s no such function, and for non-trivial queries consisting of more than one term - what number should it return? Here''s an example how you can retrieve how often a term occurs in a specific field of a document: http://ferret.davebalmain.com/api/classes/Ferret/Index/TermVector.html hth, Jens -- Jens Kr?mer webit! Gesellschaft f?r neue Medien mbH Schnorrstra?e 76 | 01069 Dresden Telefon +49 351 46766-0 | Telefax +49 351 46766-66 kraemer at webit.de | www.webit.de Amtsgericht Dresden | HRB 15422 GF Sven Haubold, Hagen Malessa
Mattias Bodlund
2007-Jun-15 09:03 UTC
[Ferret-talk] Sorting and getting occurrences of search in hit
On 15/06/2007, at 9.35, Jens Kraemer wrote:> On Thu, Jun 14, 2007 at 06:22:53PM +0200, Mattias Bud wrote: >> Mattias Bud wrote: >>> Is there any way you could get the number of occurrences of the >>> search >>> in one hit? >>> >>> In a result I get the ferret_rank and ferret_score but not how >>> many hits >>> the search generated in the current record. >>> >>> I would also like to be able to sort after this when I search. > > Do you mean the number of times the query occurs in a hit? There''s no > such function, and for non-trivial queries consisting of more than one > term - what number should it return? > > Here''s an example how you can retrieve how often a term occurs in a > specific field of a document: > http://ferret.davebalmain.com/api/classes/Ferret/Index/TermVector.html > > > hth, > Jens > > > --I know that this may be a bit off but the feature I''m looking for is to be able to determine how often lets say a name occurs in the complete index of an object. By default we sort results chronologically - this due to the context of the project. Thanks - i''ll look into the above. mattias
John Bachir
2007-Jun-16 18:09 UTC
[Ferret-talk] Sorting and getting occurrences of search in hit
On Jun 15, 2007, at 5:03 AM, Mattias Bodlund wrote:> > I know that this may be a bit off but the feature I''m looking for is > to be able to determine how often lets say a name occurs in the > complete index of an object. By default we sort results > chronologically - this due to the context of the project.look into things like... YourModel.aaf_index.ferret_index.reader.terms(:your_field_name) and other methods on the index reader: http://ferret.davebalmain.com/api/classes/Ferret/Index/IndexReader.html