cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Lucene Search Sort by Date Issue

jboss
Champ in-the-making
Champ in-the-making
We are building a webapp using Alfresco Surf, and are using a Lucene search to return results from the database.  All the searches work fine with out sorting functionality except date.  When we sort by modified date or created date then the first 3 pages are returned correctly (10 results per page as specified), but page 4-50 or so are all identical results.  This only happens using date sorting, and the first pages are always fine. Another interesting thing is that if I allow all the results to be displayed at once, then all 500 appear in order correctly, so it has something to do with pagination.   Alfresco 3.4c Community Edition. Anyone have any advice? Thanks!
3 REPLIES 3

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

Can you please post the query/language etc … and the results from the full search so there is some related test data.

It could be that datetime is only indexed to the date resolution and so does a post sort in Java.
If could be this and paging is confused somethow - but the sort should be done before any paging etc is applied

You can configure in fuill date time resolution - and reindex -  then the sort will be all in lucene (if we change the default everyone has to reindex)
You can wait for 4.0 and use SOLR which is configured to use full datetime out of the box (you have to build the SOLR index anyway)
SOLR paging is much more efficient as it keeps a few more results around in the query cache for this small number paging use case.

Andy

jboss
Champ in-the-making
Champ in-the-making
Andy,

Thanks for the quick response.  I'll work on getting you the actual queries and response data so you have some more information to work with.  I did want to clarify that we are using Lucene sorting by passing in criteria like cm:modified to the sort parameter of the query. 

On another note, I did want to look at trying to configure date/time resolution in the DB and reindexing, how would I go about that process?

Thanks for the help, Jon

simonefresco
Champ in-the-making
Champ in-the-making
HI,
try to check "webapps/alfresco/WEB-INF/classes/alfresco/model/dataTypeAnalyzers.properties"

if the analyzer for datetime (cm:created/cm:modified) is set to DateAnalyzer change it to:

"d_dictionary.datatype.d_datetime.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DateTimeAnalyser"

That will solve the problem.

Bye.