11-04-2016 06:42 AM
I want to perform operation like storing the search results to file for this we need search query from where we will get the query.After that we will pass this query into webscript.If any done with this guide me how to perform.
11-05-2016 01:04 PM
You could solve this requirement in two main ways using WebScripts:
1. Implementing a DeclarativeWebScript using Alfresco JavaScript API
You can implement your JavaScript controller executing the query and then iterating results for creating a CSV or XML content file, for example you can take a look at the following snippet:
var luceneQuery = "TYPE:\"cm:content\" AND @cm\\:name:\"yourContentName*\"";
var results = search.luceneSearch(luceneQuery);
var csvOutputContent = "Name;Description"; //csv header
for (var i=0; i<results.length; i++) {
var currentResult = results[i]; //this is the result node reference
csvOutputContent += currentResult.name+";"+currentResults.properties["cm:description"]+"\n"; //create the single row for the CSV content
}
var outputContentNode = companyhome.createFile("report.csv"); //create the report node in the repo
outputContentNode.content = csvOutputContent; //write the content in the node
Other informations about WebScript Script controller here:
Web script controller script | Alfresco Documentation
2. Implementing a Declarative WebScript using Alfresco Java API
In this way you can implement your own Java Controller using for example Apache POI for creating any kind of Microsoft Office files such as Word or Excel and dropping it into the repository.
Java approach to web scripts | Alfresco Documentation
Hope this helps
11-04-2016 09:34 AM
If you are talking about the faceted search page (you really should provide a bit more detailed information), then you can add a custom Aikau widget which listens to the ALF_SET_SEARCH_TERM and/or ALF_ADVANCED_SEARCH topics to extract the current search term / query. Such a widget could be a button you add to the toolbar of the result list. If the user clicks that button you can use the search term / query you previously extracted from those events to call a custom web script of yours that executes the query and generates the list document in the format you require.
11-06-2016 12:43 PM
Actually what I am trying to do is adding export search button at out of box search operation after performing the search operation who can I get the search query in search-min.js to write the java backend.
11-06-2016 12:45 PM
Which Alfresco version are you using? Because out-of-the-box search action in current Alfresco versions is not provided by search-min.js - that file was last used in 4.x as far as I know.
11-06-2016 01:03 PM
I am using community 4.2 version
11-05-2016 01:04 PM
You could solve this requirement in two main ways using WebScripts:
1. Implementing a DeclarativeWebScript using Alfresco JavaScript API
You can implement your JavaScript controller executing the query and then iterating results for creating a CSV or XML content file, for example you can take a look at the following snippet:
var luceneQuery = "TYPE:\"cm:content\" AND @cm\\:name:\"yourContentName*\"";
var results = search.luceneSearch(luceneQuery);
var csvOutputContent = "Name;Description"; //csv header
for (var i=0; i<results.length; i++) {
var currentResult = results[i]; //this is the result node reference
csvOutputContent += currentResult.name+";"+currentResults.properties["cm:description"]+"\n"; //create the single row for the CSV content
}
var outputContentNode = companyhome.createFile("report.csv"); //create the report node in the repo
outputContentNode.content = csvOutputContent; //write the content in the node
Other informations about WebScript Script controller here:
Web script controller script | Alfresco Documentation
2. Implementing a Declarative WebScript using Alfresco Java API
In this way you can implement your own Java Controller using for example Apache POI for creating any kind of Microsoft Office files such as Word or Excel and dropping it into the repository.
Java approach to web scripts | Alfresco Documentation
Hope this helps
11-06-2016 12:43 PM
Actually what I am trying to do is adding export search button at out of box search operation after performing the search operation who can I get the search query in search-min.js to write the java backend.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.