Open acg10 opened 6 years ago
I think you can use Querysort().
@acg10, cfsearch
returns a query object, so you can use querySort().
Example
<cfset collectionCreate( collection="mycollection", storebody=false )>
<cfset collectionIndexPath( collection="mycollection", key="/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents", recurse=true )>
<cfsearch collection="mycollection" criteria="*" name="theSearch">
<cfdump var="#theSearch#">
<cfset querySort( theSearch, "size", "numeric" )>
<cfdump var="#theSearch#">
Thax for the replies. My problem is that im use pagination in the search (maxrows param), so my returned query object not contains all the data. Is possible say to Lucene that search in the index sorted?? Thax everybody
com/bluedreagon/search/... QueryRun -> Modify searcher with Sort class of Lucene and ignore the scores results. DocumentWrap -> Add to document SortedDocVAluesField class. https://lucene.apache.org/core/5_5_1/core/index.html thank you can close issue.
Can you show an example of how you did that? I'm curious :)
Hi MFernstrom: In Queryrun.java, before that IndexSearch call search method, can pass a Sort class to say Lucene search in the documents sorted by an field. I'm the "filename" field so before write:
String field = "title"; SortField.Type type = SortField.Type.STRING; boolean descending = true; SortField sortField = new SortField(field, type, descending); Sort sorter = new Sort(sortField);
TopDocs localTopDocs = localIndexSearcher.search(this.queryAttributes.getQuery(), localCollection.getTotalDocs(), sorter);
And Lucene return the TopDocs sorted by this field "filename". A good idea is parametrizer this field in cfsearch function to can get the results sorted in Lucene.
Thx for everthing and sorry my bad english
Nice @acg10 , thanks for sharing! And don't worry about your English, it's not my native language either, you're fine :)
Hi everybody. I'm a project that use Razuna, an DAM platform what use OpenBD. My problem is that this App use Lucene like search-engine and i can't sort the results. I see so in Adobe ColdFusion 10 is possible order the results with a new param called "orderBy", but this not work in OpenBD. Is posible use the CFSearch class to sort my results??? Thanx everybody