Forum OpenACS Development: etp page links returned by search

Collapse
Posted by Mark Aufflick on

More searching fun! My apologies in advance for knowing so little about how openacs searchnig works - I've never really used it so far...

I am using etp (original) on my own site and I wanted to index it - seing as ther is no etp specific binding, I figured the content repository bindings would allow them to be indexed, which it did.

Prblem is, the links returned in the result set are of the form /acs-content-repository/the/actual/url?revision_id=1234

index.vuh in /acs-content-repository/ barfs BIG time because etp doesn't seem to do the appropriate cr templating stuff... I got kinda lost there

since etop renders it's own files, I put the following EXTREMELY DODGY hack at the top of packages/acs-content-repository/www/index.vuh to redirect etp pages to themselves:


  set item_id [db_string item_id "select content_item__get_id(:the_url, :content_root, 'f')"]
  set possible_pkg_id [db_string possible_pkg_id "select context_id from acs_objects where object_id = :item_id"]
  if { [db_string foo "select object_type from acs_objects where object_id = :possible_pkg_id"] == "apm_package" } {
        if { [apm_package_key_from_id $possible_pkg_id] == "edit-this-page" } {
                ad_returnredirect "/$the_url"
        }
  }

My questions are:

  1. can this problem be solved with an etp specific search binding that will override the standard cr one for etp pages? (if so I will look into it - probably for etp v2)
  2. is this problem going to occur for other packages that use the cr for their data storage? if so, how can we generically solve it?

Thanks for everyones help!

Collapse
Posted by Jun Yamog on
Hi Matt,

You would need to implement your service contract.  In particular the the URL service contract.  Or maybe just look at how DavB implemented it on this site.  You can checkout the CVS of this site openacs.org-dev.

Sorry I am a bit busy can't explain on further.  Here are useful links

https://openacs.org/doc/search/guidelines.html

Since ETP uses CR you will need to implement only the 'datasource' and 'url'.  Others are already taken cared of, no need for the triggers.

I suggest that you check out the ETP CVS code of this site.  Then cut and paste it into your code.  You can also drop by the IRC channel and look for DavB.

Collapse
Posted by Mark Aufflick on
Thanks Jun, that actually looks kinda straightforward - I will try rolling my own just to learn it.

The service contract should probably get rolled into the etp package.. I will consult the forums when I have written one.