Closed janezomgzomg closed 8 years ago
@janezomgzomg looks great mostly, Could use more comments, and moving code around to make organization better. But overall looks great.
@JoshEllinger I've made the requested changes and added comments. I've updated the PR description.
I do have some ideas on how to make this code cleaner, and more scalable to other situations. But in interests of getting something in, i think this looks fine, as it works.
In the future, i think it makes more sense not to use localParams syntax at all outside of querybuilder, which should handle all syntax issues. Also appending tag in front of keys is probably an unnecessary constraint, and has the possibility affect some untested edge cases.
@janezomgzomg great job on a tough part of View and solr 🚀
PR created for visibility. This is currently implemented only in field facets.
Basics
LocalParamsService
.getLocalParams
: processesresponseHeader.params
and returns thelocalParams
for the various facet types. Onlyfield
andrange
is supported in this service.getLocalParamTag
: returns thetag
that is present in the facet objecttag
is set for each individual facet infacetList
. This is retrieved fromresponseHeader.params
and is processed inLocalParamsService
.facet-tag
/facetTag
is passed intofacetFieldDirective
fromfacetList
as a scope variable.keyValue
,join
,wrapper
transformers forlocalParams
keyValue
->localParamKeyValTransformer
: generates the basickeyVal
for the filter query.{!tag=dc}parsing_time_l:("10")
join
->localParamJoinTransformer
: modifies the existing fq with the newly added/removed filter value.{!tag=dc}parsing_time_l:("10" OR "11")
wrapper
->localParamWrapperTransformer
: stringifies the filter valueAdding a filter
tag
is set in the keyObj inaddQueryFacet
. It can be either thetag
value or null.key
={!tag=tagname} + key
transformer
=localParams
checkIfMultiSelectFQExists()
checks if a query facet exists with the keyname and the tag specified.Removing a filter
key && fq:field
||{!tag=tagname}key && localParams
to remove the correct filter.Query Builder
SeegetTransformerFn
can now handle an array of transformers.EDIT
.TODO:
EDIT
EDIT: