cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the list of all keywords sentences that begin with a particular keyword

sporuri
Confirmed Champ
Confirmed Champ

Alfresco can be used to store documents. I am trying to fetch list of matching indexes.

For example " sainik, sainik welfare, sainik department etc., " exists in these documents. Now, How will I get the list of all words / sentences that begin with sainik?  Please note that I am not looking for documents that contain the word sainik? I am looking for list of all words that begin across all the documents in the repositories?

How can I achieve the above requirement with Alfresco rest api ? or with with extensions?

4 REPLIES 4

angelborroy
Community Manager Community Manager
Community Manager

Not sure about your requirement.

So you want to perform a Query and to get a list of sentences from the content of the document that starts with "sainik"?

This is not available out of the box, as SOLR returns the whole document that matches your search criteria.

Probably you have to inspect all these results and to extract the sentence you are looking for.

Hyland Developer Evangelist

If it's not out of box, how is it being implemented by Alfresco Share application . if you go to the top right most corner in alfresco share application, after login, there is a search box available. If you type in sainik then shows all the sentences or words that start with sainik. How is this done?

Nice catch! I didn't remember about that.

You can use SOLR Suggester Service, what finds shingles for a term.

You can perform tests at SOLR Web Console to guess if it was you were looking for.

For instance, following SOLR request...

http://localhost/solr/alfresco/suggest?indent=on&q=video&wt=json 

... returns results starting with "video" in this way

{
"responseHeader":{
"status":0,
"QTime":0},
"suggest":{"shingleBasedSuggestions":{
"video":{
"numFound":10,
"suggestions":[{
"term":"video",
"weight":4,
"payload":""},
{
"term":"video provides",
"weight":2,
"payload":""},
{
"term":"video provides a",
"weight":2,
"payload":""},
{
"term":"video that",
"weight":2,
"payload":""},
{
"term":"video that best",
"weight":2,
"payload":""},
{
"term":"video you",
"weight":2,
"payload":""},
{
"term":"video you can",
"weight":2,
"payload":""},
{
"term":"video you want",
"weight":2,
"payload":""},
{
"term":"video files",
"weight":1,
"payload":""},
{
"term":"video files related",
"weight":1,
"payload":""}]}}}}
Hyland Developer Evangelist

Thanks a lot Angel Borroy. I have been looking for this solution for close to a month. It's not mentioned any where in the documents . I posted it few times in our forum also. You are a rock star. i will give you a treat in case you are coming to India.