cancel
Showing results for 
Search instead for 
Did you mean: 

SOLR and FACET

filterse
Champ in-the-making
Champ in-the-making
Dear All,
we I am trying to obtain facets from SOLR from Alfresco (4.0) . We are using the SearchService and when we build the query we add something like:

         SearchParameters mysp = searchParameters.copy();
                         ….
         String fadetField="my:experienceTag";
         FieldFacet fieldFacet = new FieldFacet(fadetField);
         mysp.addFieldFacet(fieldFacet );
No other parameter is changed to the copy of a standard query coming from the advanced search interface. The query itself looks like:

"query":"((TYPE:\"my:experience\" AND (my:experienceTag:\"applications\")) AND -TYPE:\"cm:thumbnail\" AND -TYPE:\"cm:failedThumbnail\" AND -TYPE:\"cm:rating\") AND NOT ASPECT:\"sys:hidden\""
and return six documents. However I was unable to retrieve facets, which is always empty. The request entity before for the POST method is:

/solr/alfresco/afts?q=%28%28TYPE%3A%22my%3Aexperience%22+AND+%28my%3AexperienceTag%3A%22applications%22%29%29+AND+-TYPE%3A%22cm%3Athumbnail%22+AND+-TYPE%3A%22cm%3AfailedThumbnail%22+AND+-TYPE%3A%22cm%3Arating%22%29+AND+NOT+ASPECT%3A%22sys%3Ahidden%22&wt=json&fl=*%2Cscore&rows=502&df=keywords&start=0&locale=en_US&fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON&facet=true&facet.field=my%3AexperienceTag&f.my%3AexperienceTag.facet.limit=100

and the json response:

{"response":{"start":0,"docs":[{"INTXID":["1046"],"score":10.928302,"ID":["LEAF-3266"],"ASPECT":["{http://www.alfresco.org/model/system/1.0}localized','{http://www.alfresco.org/model/content/1.0}audi...":[]}}}
Any idea on that? Anybody ever used facets from the search service successfully?
Many Thanks,

Guido
10 REPLIES 10

jpfi
Champ in-the-making
Champ in-the-making
Hi,
you'll have to use the full qualified name, e.g.:
"@{http://www.alfresco.org/model/content/1.0}content"
and eventually a special solr index field like
"@{http://www.alfresco.org/model/content/1.0}content.__"
cheers, jan

filterse
Champ in-the-making
Champ in-the-making
many thanks! It worked.
Guido

swatnew1
Champ on-the-rise
Champ on-the-rise
Hello ,

Can Solr facet be used in Alfresco 4 for improving search performance ?
If yes ,then please post example of Solr facet configuration for alfresco content model /example using api .

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

It is good to see the first cut of the facet support being used.
Look forward to more in the next release.

Note that the facet reporting will always reflect the user's permission and the query results.
At some point we will support ignoring the query results.

I will include using the short property references and default name space etc on the list of things to do.

Andy

kbonnet
Champ in-the-making
Champ in-the-making
Hi Andy,

Can you tell us a little about the plans to include SOLR's facet information in the search results? We're very anxious to be able to use them as well.

Thanks.

Koen

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

Faceting is on the list for the next release.
I can not say how it will get prioritised as this is happening at the moment.

Andy

kbonnet
Champ in-the-making
Champ in-the-making
Hi Andy,

Any more news on this? Is it already prioritized? Can we vote on this feature somewhere?

Furthermore, did you mean a major or minor release? Will it be Alfresco 5.0 or 4.1?

Thanks for your info.

Koen

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

Next means next - It is not up to me what it is called 🙂
I would be surprised if faceting was not in - but you never know….again, not down to me ….

Andy

alex_chew
Champ in-the-making
Champ in-the-making
Hi,

I am facing the same problem. I cannot retrieve facets from search result. Anything wrong with my codes?

//Add facet field
String facetField = "@{http://www.alfresco.org/model/content/1.0}originalSource";
FieldFacet fieldFacet = new FieldFacet(facetField);
sp.addFieldFacet(fieldFacet); // sp is my SearchParameter

//Start search
results = this.services.getSearchService().query(sp);

//Try to retrieve facets
List<Pair<String, Integer>> facets = results.getFieldFacet(facetField + ".__");// I used this Special Field
for (Pair<String, Integer> facet : facets) {
     logger.debug("===Facet===" + facet.getFirst() + ":" + facet.getSecond());
}

Could you please show me some tips?

Best Regards,
Alex