cancel
Showing results for 
Search instead for 
Did you mean: 

request in Alfresco database

cyr
Champ in-the-making
Champ in-the-making
Hi, i am really new in alfresco and
I am having problems to make requests in alfresco database.
i am using alfresco 4.0.2 and a postgresql database
I followed this tutorial: http://wiki.alfresco.com/wiki/3.4_JavaScript_API,and created a simple js file for the request.

<import resource="classpath:alfresco/extension/myutils.js">
<import resource="/Company Home/Data Dictionary/Scripts/mylib.js">
function requestSearch(){
var nodes = search.luceneSearch("TEXT:alfresco");
return nodes;
}

$(function() {

$("#articles").click( function(){
alert( requestSearch());
});
});
with just a simple request to display alfresco text.
but it doesn't work, and when i debug, an error is shown at the import of librairies.
i checked the location of theses libraries files in "/Company Home/Data Dictionary/Scripts/, but they don't exist in that location and i didn't manage to find where they are.
Does anyone know where are they located?
or am i on the wrong way to make requests in database
Thx
1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator
It isn't clear to me what you are trying to do from your code snippet. The requestSearch() function is using server-side objects (ie, search). But then the rest of your code block appears to be using jQuery, which is a client-side technology.

If you have a page in a browser and you want to do a query against Alfresco, you'll need something on the server-side and something on the client-side. The code on the client-side can make the call against the server-side.

Ideally, you would use the browser binding in CMIS to do this. But you are using 4.0.2 and the browser binding isn't available until 4.2. So instead you need to write a web script (look at the documentation on web scripts or the various tutorials that exist). The web script will run the search and return node data as JSON (or whatever format you want).

Then, on the client side you can use jQuery to make an HTTP GET request against the web script to fetch your data.

Jeff