Lucene query OK in node browser but returns none in JS

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2010 05:01 AM
Hello all,
I have a lucene query which works fine when used with the Node Browser. However, when used in the controller .js of my webscript, I get 0 result.
Here is the query (using some of my custom types):
Here is the javascript:
Any idea?
I have a lucene query which works fine when used with the Node Browser. However, when used in the controller .js of my webscript, I get 0 result.
Here is the query (using some of my custom types):
TYPE:"{http://intranet/model/content/mysys/1.0}statements" +@\{http\://intranet/model/content/mysys/1.0\}db_source:"PROD" +@\{http\://www.alfresco.org/model/content/1.0\}modified:[NOW TO NOW]
Here is the javascript:
function do_count() { var alfQry = 'TYPE:"{http://intranet/model/content/mysys/1.0}statements" +@\{http\://intranet/model/content/mysys/1.0\}db_source:"PROD" +@\{http\://www.alfresco.org/model/content/1.0\}modified:[NOW TO NOW]'; var encodedQry = search.ISO9075Encode(alfQry); var qryDefinition = { query: encodedQry, language: "lucene" }; var nodes = search.query(qryDefinition); logger.log("Number of nodes returned: " + nodes.length); return nodes.length;
Any idea?
Labels:
- Labels:
-
Archive
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2010 11:24 AM
What does the encodedQry look like? And does this work in the Node Browser?
Cheers,
Colin.
Cheers,
Colin.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2010 11:40 AM
And would you expect NOW to NOW to ever find anything?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2010 12:11 PM
try escaping \ in your query

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2010 05:55 AM
What does the encodedQry look like? And does this work in the Node Browser?Encoded query looks like this:
Cheers,
Colin.
11:53:49,058 User:admin DEBUG [repo.jscript.ScriptLogger] Encoded query: TYPE_x003a__x0022__x007b_http_x003a__x002f__x002f_intranet_x002f_model_x002f_content_x002f_apsys_x002f_1.0_x007d_statements_x0022__x0020__x002b__x0040__x007b_http_x003a__x002f__x002f_intranet_x002f_model_x002f_content_x002f_apsys_x002f_1.0_x007d_db_source_x003a__x0022_PROD_x0022__x0020__x002b__x0040__x007b_http_x003a__x002f__x002f_www.alfresco.org_x002f_model_x002f_content_x002f_1.0_x007d_modified_x003a__x005b_NOW_x0020_TO_x0020_NOW_x005d_
Works perfect in node browser.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2010 05:55 AM
And would you expect NOW to NOW to ever find anything?Yes. It actually does work in node browser, and these keywords are also documented in the wiki.
Edit: Actually, in the node browser, just +@cm\:created:TODAY or +@cm\:created:NOW also works without using the TO range keyword.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2010 06:08 AM
