|
|
Rank: Enthusiast
Joined: 9/6/2007 Posts: 10
|
I have a table that is replicated from another database every night. This table consists of FAQ questions/answers. I have a usercontrol that renders the Category names and if you click on any of those, you will see the questions/answers in that category. The category you click is passed by a the querystring and posted to the same page.
I want to be able to search this data with the XSLTSearch.
I wonder is there a simple way to add some nodes to the existing node tree (GetXmlAll) that Umbraco provides and let the XSLTSearch search this too? (It would be great if I didn't have to modify and recompile the whole Umbraco, since then I have to do this everytime there is an update).
From XSLTSearch.xslt (v2.5) --- <xsl:when test="number(//macro/source/@nodeID)=-1"> <!-- using ALL nodes --> <xsl:call-template name="search"> <xsl:with-param name="items" select="umbraco.library:GetXmlAll()"/> </xsl:call-template> </xsl:when> ---
Is there some other approach to this?
I'm thinking of creating Umbraco content nodes out of the database rows. How could this script easily be executed on a regular basis? Can this be schedueled at the windows 2003 server?
If I choose this approach, we have the problem with inconsistency. I've created some usercontrols that batch-creates nodes and publishes them using umbraco.presentation.nodeFactory.Node objects. This is really slow and lags the server pretty bad. Perhaps creating a verifyer that can iterate through all rows in the table and make sure these nodes exists and are not changed. If a changed node occurs, update it and add new nodes that has been added to the table.
|
|
 Rank: Enthusiast
Joined: 1/12/2007 Posts: 31 Location: Germany
|
Jesper wrote: I'm thinking of creating Umbraco content nodes out of the database rows. How could this script easily be executed on a regular basis? Can this be schedueled at the windows 2003 server?
For the scheduling part, you could easily execute an .aspx with the scheduler if you have windows powershell (free download @ microsoft) installed on the windows server 2003. create a simple myscript.cs1 and issue a http get: Code: $nullget = (new-object System.Net.WebClient).DownloadString("http://hostname/foo/bar.aspx")
without powershell, there are several other concepts (app start events, etc.), but I'd recommend downloading wget for windows and use this via the integrated scheduler ("at" command). Overall, I can only congratulate microsoft on the powershell - perfect for us .net developers... ;-) For the part on XSLTsearch, that's really not my topic - interesting though. :-) //M mindrevolution - applied communication science
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 811 Location: Århus, Denmark
|
Actually you can also schedule events inside umbraco itself. If you place the usercontrol on a page in umbraco, then you can set up a scheduled call in the umbracoSetting.config file. If you want to avoid the part where you create new pages in umbraco for each row, then you might want to create an xslt extension that returns the FAQ data as xml, and merge that xml with the getallxml using the EXSLT libraries that are included in V3.
|
|
 Rank: Administration
Joined: 7/25/2006 Posts: 425 Location: vipperoed, denmark
|
Hi Jesper, I'm using xslt to search xml containing members. It works great. If you have a table to search I would probably fetch the data (maybe using jesper.umbracoSQL) and then modify xsltsearch to search that ... Kindly, Jesper ps. You almost got me thinking that I wrote the posting in the first place. (Please consider adding your lastname). webbureau jesper.com doing webdesign / development / umbraco implementations / 2007&2008 MVP / umbraco certified
|
|
 Rank: Enthusiast
Joined: 1/12/2007 Posts: 31 Location: Germany
|
Morten Bock wrote: Actually you can also schedule events inside umbraco itself.
If you place the usercontrol on a page in umbraco, then you can set up a scheduled call in the umbracoSetting.config file.
Cool! I didn't know that... :-) You're talking about "<scheduledTasks>", right? Do you have any idea how this is implemented? What if the site is inactive or a recycle happens? :hmm: Can anyone shed some light on this? Would save me a bunch of schedules scripts if this is implemented robust... //M mindrevolution - applied communication science
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 811 Location: Århus, Denmark
|
Marc Stoecker wrote: Cool! I didn't know that... :-) You're talking about "<scheduledTasks>", right? Do you have any idea how this is implemented? What if the site is inactive or a recycle happens? :hmm:
Can anyone shed some light on this?
Would save me a bunch of schedules scripts if this is implemented robust...
//M
That's the one I'm talking about. I must admit I don't know how it is implemented. Just tried flicking through the source, but I cant seem to find any info. Maybe some of the core people can give us a hint?
|
|
 Rank: Enthusiast
Joined: 1/12/2007 Posts: 31 Location: Germany
|
*bump* anyone? :-) //M mindrevolution - applied communication science
|
|
 Rank: Addict
Joined: 3/17/2008 Posts: 980 Location: Nyborg, Denmark
|
Marc Stoecker wrote: What if the site is inactive or a recycle happens? :hmm:
umbraco keeps the site alive by calling a special page with a short interval in order to keep build-in scheduled tasks (like automated publishing/removal of content) running. However, if the webserver is shut down or the app pool is restarted, the scheduled tasks won't become alive until the first time the site is called. If you need a more robust solution, the only way is a Windows Service. Hope this helps! /n
Jeeeez, did I really start this :-)
|
|
 Rank: Fanatic
Joined: 7/19/2006 Posts: 496 Location: Göteborg, Sweden
|
Niels Hartvig wrote: However, if the webserver is shut down or the app pool is restarted, the scheduled tasks won't become alive until the first time the site is called.
An off-site / semi-solution to that might be to use a site monitoring service like http://www.host-tracker.com that will ping your site regularly and therefore assure that the site won't be asleep longer that the scheduled interval... // ;) Kalle
" - Yeah I'd like to share your point of view, as long as it's my view too... ( http://www.d-a-d.dk/lyrics/pointofview)
|
|
 Rank: Enthusiast
Joined: 1/12/2007 Posts: 31 Location: Germany
|
Niels Hartvig wrote: umbraco keeps the site alive by calling a special page with a short interval in order to keep build-in scheduled tasks (like automated publishing/removal of content) running. However, if the webserver is shut down or the app pool is restarted, the scheduled tasks won't become alive until the first time the site is called.
Thanks for making this clear, Niels! :thumbup: I assume most of us are running (HTTP-) monitoring anyways, so the site will defacto never be "really" offline and the internal umbraco scheduling will work quite well. If one doesn't use monitoring, a simple script (i.e. with PS as I wrote above) calling the umbraco-Website will suffice. Good to know. :-) //M mindrevolution - applied communication science
|
|
Rank: Enthusiast
Joined: 9/6/2007 Posts: 10
|
Thank you all for the info, much appriciated!
I solved the problem by doing the following:
Since every row/node has a unique id, my solution is:
Creating a script that goes through the SQL Server Table and compares the rows with the nodes in the umbraco node tree.
If the row has been changed, the node will be updated with new data+published. If a row has been removed, the node will be unpublished then removed. If a row has been added, a new node will be added/published.
Now the FAQ questions/answers will be included in the XSLSearch (ofcourse!).
Why did I not go the easy way and delete all rows and re-create them all over from the table?
First of all: I like the FAQ items not to change umbracoID and its pretty neat to be able to track when the nodes has been added (i dont have this info in the table). Secondly: I had problems when changing/publishing a few thousand nodes before, causing the site to lag pretty bad for 10 minutes or so. Publishing nodes seems to be cpu consuming for the server and (ofcourse) I want to keep the cpu at lowest possible load. Does this have to do with Umbraco writing the xml-tree to file for every publish?
If publishing multiple nodes, am I supposed to save the nodes and republish the whole tree after adding/removing/updating nodes?
Perhaps an easy configurable piece of code could be created for this purpose? I suppose others like to synchronize nodes/tables?
regards / Jesper Wigelius
|
|
Rank: Enthusiast
Joined: 9/6/2007 Posts: 10
|
Thank you all for the info, much appriciated!
I solved the problem by doing the following:
Since every row/node has a unique id, my solution is:
Creating a script that goes through the SQL Server Table and compares the rows with the nodes in the umbraco node tree.
If the row has been changed, the node will be updated with new data+published. If a row has been removed, the node will be unpublished then removed. If a row has been added, a new node will be added/published.
Now the FAQ questions/answers will be included in the XSLSearch (ofcourse!).
Why did I not go the easy way and delete all rows and re-create them all over from the table?
First of all: I like the FAQ items not to change umbracoID and its pretty neat to be able to track when the nodes has been added (i dont have this info in the table). Secondly: I had problems when changing/publishing a few thousand nodes before, causing the site to lag pretty bad for 10 minutes or so. Publishing nodes seems to be cpu consuming for the server and (ofcourse) I want to keep the cpu at lowest possible load. Does this have to do with Umbraco writing the xml-tree to file for every publish?
If publishing multiple nodes, am I supposed to save the nodes and republish the whole tree after adding/removing/updating nodes?
Perhaps an easy configurable piece of code could be created for this purpose? I suppose others like to synchronize nodes/tables?
regards / Jesper Wigelius
|
|
|
Guest |