To edit pages or tickets please login with username/password: aaf/aaf

Ticket #88 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

query_for_record fails with single_index in r143.

Reported by: cch1@hapgoods.com Assigned to: anonymous
Priority: major Milestone:
Component: 0plugin Version:
Keywords: single_index query_for_record Cc:

Description

As of revision 143, the query_for_record method fails when working in a single_index environment. The problem starts with the parameters -query_for_record only receives the id of record to be queried. It then attempts to construct the class with aaf_configuration[:class_name] but this approach will not work with polymorphic index members. The klass and id should be passed to query_for_record.

For example, if records of class Medium and Person is stored in the single_index, then calling query_for_record will only ever work with the one class that is stored in aaf_configuration[:class_name].

Attachments

fix_single_index_remove.diff (2.4 kB) - added by cch1@hapgoods.com on 02/04/07 03:01:00.
simple-minded patch -not tested to be free of side-effects.

Change History

02/04/07 03:01:00 changed by cch1@hapgoods.com

  • attachment fix_single_index_remove.diff added.

simple-minded patch -not tested to be free of side-effects.

02/08/07 10:01:04 changed by jk@jkraemer.net

  • owner changed from somebody to anonymous.
  • status changed from new to assigned.

right, it's pointless to store the class name in aaf_configuration with a shared index. I'll fix this soon.

02/08/07 21:42:21 changed by jk@jkraemer.net

  • status changed from assigned to closed.
  • resolution set to fixed.

fixed

02/09/07 23:09:08 changed by cch1@hapgoods.com

  • status changed from closed to reopened.
  • resolution deleted.

I am still seeing failures with single_index when deleting records -the same high-level symptom I was seeing before when the cause was as documented on this ticket.

I have single_index configured for AR models Medium, Portfolio, Place and Person. Here is an excerpt from my Unit test that fails:

require File.dirname(__FILE__) + '/../test_helper'
require 'uuidtools'

class ActiveRecordTest < Test::Unit::TestCase
  fixtures :users, :places, :people, :media, :portfolios, :placements, :medium_portfolios, :authorizations

  def setup
    index = Medium.aaf_index.ferret_index
    index.size.times {|i| index.delete(i)}
    Medium.rebuild_index(Person, Place, Portfolio)
  end
  
  def test_search_after_delete
    results = Medium.find_id_by_contents("Collection", {:models => :all})
    assert_equal 2, results.first
    Portfolio.destroy(portfolios(:myCollection))
    results = Medium.find_id_by_contents("Collection", {:models => :all})
    assert_equal 1, results.first
  end
end

My setup just rebuilds the index from scratch -I know of no better way to run tests on the functionality of AAF. Note that I start with TWO fixtures with the word "Collection" in them. The first assertion is true -no problem. One of the two matching fixtures is portfolios(:myCollectio), which is then deleted. Unfortunately, the second assertion fails with "1 expected, but was 2".

Note that I have some other AAF related tests (adds, simple AR updates) and they all work fine.

-Chris

02/10/07 08:17:59 changed by jk@jkraemer.net

  • status changed from reopened to closed.
  • resolution set to fixed.

now really fixed, thanks for the test case.

To edit pages or tickets please login with username/password: aaf/aaf