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

Doesn’t anyone have any input on this?

Mattias

Mattias B. 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.

/mattias

Forgot the original message. Doesn’t anyone have any input on this?

mattias

On Thu, Jun 14, 2007 at 06:22:53PM +0200, Mattias B. wrote:

Mattias B. 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
[email protected] | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa

On 15/06/2007, at 9.35, Jens K. wrote:

I would also like to be able to sort after this when I search.
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

On Jun 15, 2007, at 5:03 AM, Mattias B. 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