Alfresco 5.0.a/b doubled facets for d:mltext - search

It seems that facets doesn't work properly with multi language properties.
I did a simple test in Alfresco 5.0.a and 5.0.b on clean installation:
Created a text document in site.
Put description in English.
Changed browser language to French.
Added French version of the description.
Searched for the file name.
Found only one document which was just created.
The problem is that in Description facet on the left panel I have two descriptions - one English and one French.
Both points to the same file, but logically there should be only one description (depends on the browser's language).
Did anybody faced this problem? It seems like a bug.

Hi I'm not sure if it's a bug, but technically it looks like it should be.
Multilingual fields contains multiple text definitions of the same field. Solr indexes the field and sees there are 2 values (even though for the same field) so he creates a facet out of them.
Sure it's possible in the UI to filter out, Alfresco probably will need to do it (raise a JIRA so they can take a look). But in case of technical faceting/filtering it works like it should.

I raised an issue ALF-21249
And also found a workaround, which is a bit dirty, but works well.
Let's say you have a property with name ccm:property which has type d:mltext and you want to have facet for this property in English and French.
Define an aspect with two d:text properties: ccm:propertyEn and ccm:propertyFr
Apply this aspect to the type.
When you set the ccm:property set also ccm:propertyEn and ccm:propertyFrproperties
Modify variable facets in faceted-search.get.js so that depends on the user's language one or another facet are shown:
if (locale.substring(0, 2)== "fr")
facetQName = "{http://www.ccm.com/model/ccm/1.0}propertyFr.__.u";
else
facetQName = "{http://www.ccm.com/model/ccm/1.0}propertyEn.__.u";
facets.unshift(
{
id: "FCTSRCH_FACET_DOCUMENT_TYPE",
name: "alfresco/search/FacetFilters",
config: {
label: msg.get("faceted-search.facet-menu.facet.docType"),
facetQName: facetQName,
sortBy: "ALPHABETICALLY",
hitThreshold: 1,
minFilterValueLength: 5,
maxFilters: 10,
useHash: false
}
});
Done! :)

Related

Smart search results behaviour of compound index of multiple page types

Can someone confirm the behaviour of the Smart search results webpart when using a Smart search filter on a particular field, documentation here, when the index, and the expected results, are compound of multiple page types?
In my scenario I have 2 page types, one is always a child of the other, my hypothetical scenario would be a Folder and File types as an example.
I've configured the index with Pages type and Standard analyzer to include all Folder and File types under the path /MyOS/% on the tree.
The search page, includes the Smart search results webpart and a Smart search filter, a checkbox for the File's field FileIsHidden.
What I'm trying to ascertain is the possibility for the results to include all folders that have a hidden field, as well as the files?
Client has a v8.2 license and now has a requirement similar to this scenario.
Thanks so much for any help in advance.
Firstly what i would do is download the latest version of LUKE, it's a lucene inspector that allows you to run queries, inspect the data, etc.
https://code.google.com/archive/p/luke/downloads
Your search indexes are in the App_Data/Modules/SmartSearch/[SearchName], now i am not sure if LUKE can query 2 indexes as the same time, however you can run hte same query against both and see if it's filtering out results one way or another.
If you are trying to query where a field must be a value, and the other page type does not have the field, it probably is filtered out. What you need to do is use the lucene syntax to say "(classname = 'cms.file' and fileonlyproperty = '' OR classname <> 'cms.file')" so to say.
You'll have to test, but say the class name is cms.file and cms.folder, and the property is FileIsHidden, i think the syntax would be:
+((FieldIsHidden:(true) and classname:('cms.file')) OR (NOT classname:('cms.file'))
But you'll have to test that.

How to preserve the order or terms in Orchard TaxonomyField

I have a Content Part in Orchard, to which I added a Taxonomy Field and set it to allow multiple terms. When I save a content item, it looks like the terms are re-ordered in alphabetical order. But I would like to preserve the order in which they were authored in the field.
E.g. here is what I author in my Taxonomy field:
Contributors: [Sebastien Ros] [Bertrand Le Roy]
And here is what it turns into after saving:
Contributors: [Bertrand Le Roy] [Sebastien Ros]
Is there a way to prevent terms re-ordering? If this is by design, does anyone familiar with implementation know if this can be patched easily? Would it make sense to create a pull-request and contribute a patch to Orchard? I mean, would it be useful for other users, so that the fix has a chance to be included in core. (Otherwise, I would have to maintain a modified version of Orchard and have problems upgrading to new versions, which is undesirable of course).
Thanks!
You should never count on the order in which the records are stored in the database. It is way too brittle, and has never been designed for this. If you need to have control over the order of terms, and have different orders depending on context, you need to use something else. The latest source code version of Vandelay.Industries has a projection filter that lets you drag and drop items in the order you want, for that specific projection.
If you go to the taxonomy section and look for the term itself, you will see a property call Weight which says..: 'If specified, it will be used to sort terms at the same level'.
That should do it.

Solr Schema Advice for Dynamic Facetable Fields

I haven't used Solr for about three years, and I see that it has now jumped up to 3.5.
The "Documents" that I am trying to add to my Index are properties.
The majority of all properties will have about ten of the same types of fields. Such as
Longitude
Latitude
Name
Location Name.. etc
However, I also want to add in attributes about the property which should be facetable.
Property receive features, which are grouped into ten of so categories. Such as...
(Entertainment, Attractions, General, Kitchen, Spa etc). And then the user when adding their property would select items from a pre defined list.
So that for example, if they are adding General features, they might check:
✓ Heating, ✓ Balcony, ✓ Garage, ✓ Washing Machine etc.
Then on my presentation layer, These options might be displayed under the heading General with all of the available facets that fall within the General category.
So, this is my problem... if I make a facet field called "general" I would actually want to add a lot of values to this field. But then can you facet over a multi valued field?
And then I would want to do exactly the same for "spa" where the user might check that the property has a Swimming Pool, Sauna and a load of other features etc.
Any advice as to how I should construct my schema would be appreciated.
Yes, you can facet over multivalued field. Watch this presentation by Solr's developer about facets:
The Many Facets of Apache Solr by Yonik Seeley
I hope that this will have all answers you need. Only thing you need to do in schema is to set the field as multivalued (and maybe also make some processing if this is text not ids, but this is showed nicely in presentation and slides

How to implement faceted search suggestion with number of relevant items in Solr?

Hi
I have a very specific need in my company for the system's search engine, and I can't seem to find a solution.
We have a SOLR index of items, all of them have the same fields, with one of the fields being "Type", (And ofcourse, "Title", "Text", and so on).
What I need is: I get an Item Type and a Query String, and I need to return a list of search suggestion with each also saying how meny items of the correct type will that suggested string return.
Something like, if the original string is "goo" I'll get
Goo 10
Google 52
Goolag 2
and so on.
now, How do I do it?
I don't want to re-query SOLR for each different suggestion, but if there is no other way, I just might.
Thanks in advance
you can try edge n-gram tokenization
http://search.lucidimagination.com/search/document/CDRG_ch05_5.5.6
You can try facets. Take a look at my more detailed description ('Autocompletion').
This was implemented at http://jetwick.com with Solr ... now using ElasticSearch but the Solr sources are still available and the idea is also the identical https://github.com/karussell/Jetwick
The SpellCheckComponent of Solr (that gives the suggestions) have extended results that can give the frequency of every suggestion in the index - http://wiki.apache.org/solr/SpellCheckComponent#Extended_Results.
However, the .Net component SolrNet, does not currently seem to support the extendedResults option: "All of the SpellCheckComponent parameters are supported, except for the extendedResults option" - http://code.google.com/p/solrnet/wiki/SpellChecking.
This is implemented using a facet field query with a Prefix set. You can test this using the xml handler like this:
http://localhost:8983/solr/select/?rows=0&facet=true&facet.field=type&f.type.prefix=goo

How can I automatically enable content approval on a SharePoint list?

I'm trying to create a feature that both creates a list template and an instance of that list (using the <ListTemplate> and <ListInstance> elements. I would like for content approval to be turned on by default. According to the docs on ListTemplate, setting the EnableModeration attribute to TRUE should do it. However, when I try to install the solution, I get the following error:
The 'EnableModeration' attribute is
invalid - The value 'TRUE' is invalid
according to its datatype
'http://schemas.microsoft.com/sharepoint/:TrueFalseMixed'
- The Enumeration constraint failed.
A bit more searching reveals that the value accepted is actually "True", not "TRUE". That installs fine, but it seems to have no effect when the list is created - it still doesn't require content approval. Any idea what I'm doing wrong?
Edit: If anyone could even confirm for me if they've seen "True" or "TRUE" work before, that would at least narrow down my search.
Update: I've found that I can enable content approval using code in a feature receiver:
list.EnableModeration = true;
list.Update();
That's a bit of a hack, so it'd still be nice to be able to do this through the XML instead.
I ended up just using the feature receiver approach, since I just needed to move on. However, I later found that the List element used for defining your list schema also has ModeratedList and ModerationType properties that look like they probably have something to do with this. So if anyone else is having the same problem, I would recommend giving those a shot.
Does your custom list have a field of type 'ModStat' on it?
ModStat Specifies Content Approval
status. Corresponds to the
SPFieldModStat class and to the
ModStat field type that is specified
on the Field element. Value = 23.
from the SPFieldType Enumeration docs
I set ModeratedList="TRUE" ModerationType="TRUE" for List element and EnableModerate="True" for ListTemplate element . It works for me. Well it does not matter to use TRUE or True both are same.
You only have to set ModeratedList="TRUE" for List element and EnableModerate="True" for ListTemplate element. I just checked that and work fine for me. But this only will be affected for new list instances.
I had similar question - where to enable versioning and moderation from code.
In ListInstance, go to <ListTemplate> and set following attributes:
VersioningEnabled="TRUE" for versioning and EnableModeration="True" for automatic moderation.
Link: http://msdn.microsoft.com/en-us/library/ms462947.aspx

Resources