cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with the lucene search

djimenez
Champ in-the-making
Champ in-the-making
Hi all,

I need to make a lucene query to find an list of nodes, and I need sort this list by fields as the creation date, modified date, … in descending and ascending order. I'm using freemarker to make a webscript that list information of the nodes with different criterion.

Now I can sort by the name property: <#assign docs=companyhome.childrenByLuceneSearch[queryString]?sort_by('name') > but when I sort by creation date, property "created" it is produce the next error:
freemarker.template.TemplateModelException: ?sort_by(…) failed: The "created" subvariable was not found.

Also I want to know How can it limit the result size of the lucene query? I see that in the config file it is possible, there are other possibility using webscripts.

Thanks,

David
3 REPLIES 3

xerox
Champ in-the-making
Champ in-the-making
yes, that's normal.
you should do this with
sort_by(["properties","created"])

djimenez
Champ in-the-making
Champ in-the-making
thank u,

I have seen that with the modifer ?reverse it is can sort a node list descending in freemarker.
sort_by(["properties","created"])?reverse.

I don't know How can it limit the result size of the lucene query?

Tranks

andy
Champ on-the-rise
Champ on-the-rise
Hi

There is no way of limiting the number of results found be the query.
Lucene is by default ranking by the best match, so considers everything If you are sorting by some other crieria this is possible in theory but I do not think is available in lucene. I will check up on this.

Andy