[Plone-IT] rdbms mysql, plone e zcatalog

sguglia a arrows.it sguglia a arrows.it
Mar 29 Gen 2008 12:10:36 UTC


On Tuesday 29 January 2008 11:15:27 Yuri wrote:

> i permessi? :)

sto lavorando come manager e cmq sono l' owner di tutti i documenti in gioco, 
se e' questo a cui riferisci.

provo a dettagliare l' operato per chi avesse voglia di darmi una mano..


1) innanzitutto il dump del DB di test:

CREATE TABLE `Books` (
  `Number` char(8) NOT NULL,
  `Pubtitle` tinytext NOT NULL,
  `Author` tinytext NOT NULL,
  `Pubdescription` text NOT NULL,
  `Price` double NOT NULL,
) ;

INSERT INTO `Books`
(`Number`, `Pubtitle`, `Author`, `Pubdescription`, `Price`) 
VALUES 
('1', 'titolo1', 'autore1', 'descrizione1', 100.11),
('2', 'titolo2', 'autore2', 'descrizione2', 200.22);



2) in portal_catalog ho aggiunto:

- uno zsql method 'getBooksToCatalog':
SELECT
Pubtitle,
Pubdescription,
concat(Pubdescription," ",Pubtitle," ",Author) as SearchableText,
'test' as meta_type,
Number as id
FROM Books

- uno script python 'catalogBooks':
for test in container.getBooksToCatalog():
 container.catalog_object(test,'pub/getBook/'+test.id+'/bookdetails.dtml')
 print "Book # " + test.id + " " + test.pubtitle
return printed



3) eseguendo /portal_catalog/catalogBooks ottengo (in portal_catalog)

catalog (_contenuti in fondo a questo post_):
publications/getBook/1/bookdetails.dtml (type: test)
publications/getBook/2/bookdetails.dtml (type: test)

indexes:
i distinct values relativi vengono correttamente incrementati

/portal_catalog/plone_lexicon:query: contiene tutte le parole



4) creato un folder /pub che contiene:

- uno zsql method 'getBook':
SELECT *
FROM Books
WHERE <dtml-sqltest id column="Number" type=nb>
(arguments: id)

- un file 'bookdetails.dtml':
<p><dtml-var name="standard_html_header"></p>
<TABLE>
<TR>
<TD>Book Number:</TD>
<TD><dtml-var Number></TD>
</TR>
<TR>
<TD>bobobase_modification_time:</TD>
<TD><dtml-var bobobase_modification_time></TD>
</TR>
<TR>
<TD>Title:</TD>
<TD><dtml-var pubtitle></TD>
</TR>
<TR>
<TD>Description:</TD>
<TD><dtml-var pubdescription></TD>
</TR>
</TABLE>
<p><dtml-var name="standard_html_footer"></p>





------------------------------------------------------
contenuto dei /pub/getBook/x/bookdetails.dtml visti sopra:
Metadata Contents

Metadata is the information that the Catalog keeps inside of its internal 
structure so that it can answer questions quickly. This is then returned in 
the "brain" that the Catalog gives back during searches.

  	Key 	Value
  	Title 	test_sqlcatalog
  	exclude_from_nav 	
  	Type 	Plone Site
  	id 	1
  	end 	
  	Description 	
  	listCreators 	()
  	is_folderish 	False
  	getId 	portal_catalog
  	start 	
  	ExpirationDate 	None
  	Date 	2008-01-28 15:18:36
  	review_state 	
  	getRemoteUrl 	
  	location 	
  	EffectiveDate 	2008-01-28 15:18:36
  	portal_type 	Plone Site
  	expires 	2499/12/31
  	ModificationDate 	2008-01-28 14:50:15
  	getObjSize 	0 kB
  	effective 	2008/01/28 15:18:36.173 GMT+1
  	Creator 	
  	getIcon 	test_sqlcatalog/site_icon.gif
  	created 	2008/01/28 14:50:15.158 GMT+1
  	modified 	2008/01/28 14:50:15.158 GMT+1
  	meta_type 	test
  	CreationDate 	2008-01-28 14:50:15
  	Subject 	()

Index Contents

The following table gives information that is contained in the various indexes 
of the Catalog. In the case of Keyword or Text indexes, the results are 
returned as a tuple, and will show as '(one, two, three)', rather than in a 
more normal way.

  	Key 	Value
  	Title 	['test_sqlcatalog']
  	effectiveRange 	(20025498, 278752260)
  	Type 	Plone Site
  	id 	1
  	end 	
  	Description 	
  	is_folderish 	False
  	getId 	portal_catalog
  	start 	
  	is_default_page 	False
  	Date 	1075731258
  	review_state 	
  	portal_type 	Plone Site
  	expires 	1339244580
  	allowedRolesAndUsers 	['Manager', 'Anonymous']
  	getObjPositionInParent 	0
  	path 	/test_sqlcatalog/portal_catalog
  	in_reply_to 	
  	Creator 	
  	effective 	1075731258
  	getRawRelatedItems 	[]
  	getEventType 	[]
  	created 	1075731230
  	modified 	1075731230
  	SearchableText 	['descrizione1', 'titolo1', 'autore1']
  	sortable_title 	test_sqlcatalog
  	meta_type 	test
  	Subject 	[] 
------------------------------------------------------



credo di non aver dimenticato niente. Ovviamente non pretendo la pappa in 
bocca ma almeno ora e' tutto contestualizzato. Ricordo il problema: la 
ricerca tramite la ricerca veloce non funge.

Grazie!

Stefano.



Maggiori informazioni sulla lista Plone-IT