Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
solr-frontend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
79aef93f
authored
2016-06-24 12:16:14 -0500
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Improve the api, by having applyQueryParameters() call resetParameters,
instead of resetSearch.
1 parent
14fb6444
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
11 deletions
src/scripts/solr/model/Facet.js
src/scripts/solr/model/Facets.js
src/scripts/solr/model/QueryTextField.js
src/scripts/solr/model/Solr.js
src/scripts/solr/model/Facet.js
View file @
79aef93
...
...
@@ -210,6 +210,12 @@ define(function(require) {
}
return
Facet
.
__super__
.
initialize
.
apply
(
this
,
arguments
);
},
resetSearch
:
function
(
options
)
{
this
.
get
(
'items'
).
invoke
(
'reset'
,
null
,
options
);
},
resetParameters
:
function
(
options
)
{
this
.
get
(
'items'
).
invoke
(
'set'
,
{
checked
:
false
},
options
);
},
applyFacetResults
:
function
(
facetName
,
data
,
options
)
{
options
=
options
||
{};
var
facetCounts
=
Util
.
getField
(
data
,
'facet_counts'
);
...
...
src/scripts/solr/model/Facets.js
View file @
79aef93
...
...
@@ -46,9 +46,10 @@ define(function(require) {
return
Facets
.
__super__
.
initialize
.
apply
(
this
,
arguments
);
},
resetSearch
:
function
(
options
)
{
_
.
each
(
this
.
values
(),
function
(
facet
)
{
facet
.
get
(
'items'
).
reset
(
null
,
options
);
});
_
.
invoke
(
this
.
values
(),
'resetSearch'
,
options
);
},
resetParameters
:
function
(
options
)
{
_
.
invoke
(
this
.
values
(),
'resetParameters'
,
options
);
},
applyFacetResults
:
function
(
data
,
options
)
{
options
=
options
||
{};
...
...
src/scripts/solr/model/QueryTextField.js
View file @
79aef93
...
...
@@ -10,6 +10,9 @@ define(function(require) {
fields
:
null
,
multi
:
false
},
resetParameters
:
function
(
options
)
{
this
.
set
({
query
:
null
,
queries
:
[]},
options
);
},
});
return
QueryTextField
;
});
...
...
src/scripts/solr/model/Solr.js
View file @
79aef93
...
...
@@ -11,6 +11,13 @@ define(function(require) {
//var module = require('module');
var
QueryTextFields
=
Backbone
.
Model
.
extend
({
initialize
:
function
(
data
,
options
)
{
},
resetParameters
:
function
(
options
)
{
_
.
invoke
(
this
.
values
(),
'resetParameters'
,
options
);
},
});
var
Solr
=
Pagination
.
extend
({
url
:
function
url
()
{
return
this
.
constructor
.
selectUrl
;
...
...
@@ -25,7 +32,7 @@ define(function(require) {
formNameMap
[
formName
]
=
facet
;
}
});
var
queryFields
=
new
Backbone
.
Model
();
var
queryFields
=
new
QueryTextFields
();
_
.
each
(
constructor
.
queryTextFields
,
function
(
definition
,
queryName
)
{
var
qtf
=
new
QueryTextField
({
formName
:
definition
.
formName
,
name
:
queryName
,
queries
:
[],
fields
:
definition
.
fields
,
multi
:
!!
definition
.
multi
});
var
formName
=
qtf
.
get
(
'formName'
);
...
...
@@ -49,13 +56,8 @@ define(function(require) {
var
skipOptions
=
{
skipSearch
:
true
};
var
parts
=
document
.
location
.
href
.
match
(
/.*
\?(
.*
)
/
);
var
facets
=
this
.
get
(
'facets'
);
facets
.
resetSearch
();
_
.
each
(
this
.
get
(
'queryFields'
).
values
(),
function
(
qtf
)
{
qtf
.
set
({
query
:
null
,
queries
:
[],
},
skipOptions
);
});
facets
.
resetParameters
(
skipOptions
);
this
.
get
(
'queryFields'
).
resetParameters
(
skipOptions
);
if
(
parts
)
{
var
formNameMap
=
this
.
get
(
'formNameMap'
);
...
...
Please
register
or
sign in
to post a comment