Closed kkh9000 closed 8 years ago
What a coincidence I'm also not happy with query.facets. I started making changes a while ago. Reference jQuery.PRIMO.min.js on cdn.github instead of the default library included with Primo to see what changed.
https://cdn.rawgit.com/mehmetc/jQuery.PRIMO/may2016/dist/jQuery.PRIMO.min.js
facets has the same layout as query (index,term,precision,operation) plus a new attribute "exclude"
[{
"index": "facet_rtype",
"precision": "exact",
"term": "articles",
"operator": "AND",
"exclude": false
},{
"index": "facet_creator",
"precision": "exact",
"term": "Anonymous",
"operator": "AND",
"exclude": true
}]
it translate into
jQuery.PRIMO.query.query.toText()
"(any contains water) (facet_rtype exact articles) NOT(facet_creator exact Anonymous)"
If you have suggestions let me know.
I can get the current facets (using jQuery.PRIMO.query.facets) for things that are included, but not those facets that are defined as excluding.
E.g. a search for a term and then only include articles, but excludes OneFile, the function will not return the OneFile. This could perhaps be solved with adding a pos/neg to each facet
.