Disable search match on model id

Hi,

Given a numerical search term I want to avoid matching the model id as
this has no real world significance when returned in the results (in
this instance).

For example the user may enter ‘13’ when looking for a product code.
Presently they will also get back the product that has id 13.

I have tried:

acts_as_ferret :fields => {:id => { :index => :no }, :description => {},
:manufacturer_code => {}}

However this fails with “You can’t store the term vectors of an
unindexed field”.

As the id is likely a special case do I need to instead limit the search
somehow when calling the find_by_contents method? Presently I simply
have:

@products = Product.find_by_contents(@phrase, :num_docs => 200)

Any advice much appreciated.

Andrew.

On Wed, Jan 24, 2007 at 04:13:11AM +0100, Andrew E. wrote:

Hi,

Given a numerical search term I want to avoid matching the model id as
this has no real world significance when returned in the results (in
this instance).

For example the user may enter ‘13’ when looking for a product code.
Presently they will also get back the product that has id 13.

what version of aaf do you use? the id is not supposed to be included in
queries, however it might be that this is the case in older versions.

[…]

acts_as_ferret :fields => {:id => { :index => :no }, :description => {},
:manufacturer_code => {}}

However this fails with “You can’t store the term vectors of an
unindexed field”.

I don’t know if not indexing the id would be a good idea, since it is
used as a key field and needed for updates (delete old document by id,
add new one).

Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

Thanks, I have just updated the project plugin to the trunk version. It
now works as described.

I think I might of had some confusion over project plugin and system gem
versions. Either way it is now resolved. Thanks again.

Andrew.