cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve documents by sys:locale

cobol
Champ in-the-making
Champ in-the-making
Hi,

Using fts-alfresco query language I would like to retrieve all documents with a specific locale (e.g.: en_US).
I've used this query but it doesn't work.


var docQuery = "TYPE:'my:document' AND sys:locale:'en_US'";
var def = {
   query: docQuery,
   store: "workspace://SpacesStore",
   language: "fts-alfresco"
};
var docs = search.query(def);

I noticed the sys:locale field is of type d:locale and I guess it's the reason why the query doesn't work.
Querying d:text fields works perfectly btw.

Any help is greatly appreciated.

Thanks!

Loboc
1 REPLY 1

cobol
Champ in-the-making
Champ in-the-making
I noticed the locale is stored differently in the SOLR index. It is actually converted in small caps and a trailing underscore is added.
So, the working query is as follows:

var docQuery = "TYPE:'my:document' AND sys:locale:'en_us_'";
var def = {
   query: docQuery,
   store: "workspace://SpacesStore",
   language: "fts-alfresco"
};
var docs = search.query(def);


Hope this can help anyone else having the same concern…