April 28, 2007

Update an indexed record with Zend Search Lucene.

Filed under: PHP — Marcus @ 11:00 pm

Looking at the few tutorials available off zftutorials, there’s not much in the way of a proper “here’s a usable search engine based on Zend_Search_Lucene”. So while building one, I came across the problem of updating existing documents, which Lucene handles by deleting then re-adding the document. Which is fine, you just need to have a way of uniquely identifying the document in the index. So, something like a DB’s unique ID, stored as a particular field like ‘id’ in the index maybe? Well, I thought so, till I realised that I wasn’t removing anything… turns out that the default Lucene analyzer will treat numbers as whitespace characters, so that doesn’t work too well. One option that I’ve briefly implemented (depending on speed, and whether I need proper number indexing) is to just convert each digit of the ID into a lower case character. The other is to get into a custom analyzer which will treat numbers with the respect they deserve.

Extending Search Analysis

April 27, 2007

And I was thinking, that’s so weird, ‘cos… that’s what I wanted to see. Wow, me and Hussein, we’re like this!

Filed under: Uncategorized — Marcus @ 9:59 pm

Thanks to whoever capped it. Hicks on Bush is still as relevant today as it ever was.

Bill Hicks - Bush

April 22, 2007

Filed under: Javascript, Alfresco — Marcus @ 9:44 pm

Alfresco has the ability to process server-side javascript via an external command processor (Alfresco Wiki). Any output of the script is then returned to the browser as HTML, meaning quite complex interfaces can be built without any Java code.

The following is a simple request processor that uses the idea of MVC (loosely…) with Action Controllers to process different actions and views depending on what method the user triggers. There’s some limitations as to what you can push through to the Freemarker templates, so some of the logic is needed in there, however overal it’s possible to do some quite sophisticated things.

Main entry point is JSRequest.prototype.doRequest

  • figures out what request action to execute based on an “action” parameter in the request (ie you need to specify one as a hidden field on your forms)
  • executes that action, getting a string back as the output of that action
  • wraps a global template (if it exists) around the whole lot for theming purposes.

The example includes just a simple search demonstration. The javascript is actually inside the .html files; you may need to change some of the config settings at the top of the files to make sure of the context path etc.

(Edited to add: you access it via a url like http://localhost:8080/alfresco/command/script/execute?scriptPath=/Company%20Home/web-scripts/index.html)
Javascript request processing example

April 20, 2007

Lord Puddingstone - Channel: seanhart on LiveVideo.com

Filed under: Uncategorized — Marcus @ 5:44 pm

Lord Puddingstone - Guilty!

April 11, 2007

Javascript WYSIWYG Form Editor

Filed under: Javascript — Marcus @ 12:07 am

I’ve found the need a few times for a form editor to allows users create structured forms that I can then control the results of (say, a user survey or similar). JotForm is one that struck me as being quite nice, so on a boring couple of hours got out my newly found JQuery hat and had a play around. Just like almost everyone else, I’ve been quite amazed at how simple stuff is with JQuery, with the following only a couple hours of tooling around.

Javascript Form Editor

Obviously it’s far from complete, but if anyone’s wanting a base to work from, let me know if you get anywhere with it.

« Previous PageNext Page »
.

Powered by WordPress