Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dariah
search-commons-webresources
Commits
abdd9aa9
Commit
abdd9aa9
authored
Sep 16, 2019
by
Gradl, Tobias
Browse files
1323: Implement metasearch for SRU endpoints
Task-Url:
https://pm.winseda.de/issues/1323
parent
1361870c
Changes
4
Hide whitespace changes
Inline
Side-by-side
js/search/search.js
View file @
abdd9aa9
...
...
@@ -52,6 +52,10 @@ Search.prototype.initComponents = function() {
customSearch
:
this
.
options
.
customSearch
,
responseHandler
:
this
.
responseHandler
});
this
.
metaQueryHandler
=
new
MetaQueryHandler
({
queryHandler
:
this
.
queryHandler
});
this
.
sourceSelection
=
new
SourceSelection
();
this
.
sourceSelection
.
init
();
...
...
@@ -76,6 +80,10 @@ Search.prototype.search = function() {
this
.
queryHandler
.
doSearch
();
};
Search
.
prototype
.
metasearch
=
function
(
sourceIds
,
isShowMore
)
{
this
.
metaQueryHandler
.
metasearch
(
sourceIds
,
isShowMore
);
};
Search
.
prototype
.
expandSearch
=
function
(
expression
)
{
this
.
queryHandler
.
expandSearch
(
expression
);
};
...
...
js/search/search.metaQueryHandler.js
0 → 100755
View file @
abdd9aa9
var
MetaQueryHandler
=
function
(
options
)
{
this
.
options
=
$
.
extend
({
queryHandler
:
null
,
},
options
)
};
MetaQueryHandler
.
prototype
.
metasearch
=
function
(
sourceIds
,
isShowMore
)
{
this
.
doSearch
(
sourceIds
,
isShowMore
);
};
MetaQueryHandler
.
prototype
.
doSearch
=
function
(
sourceIds
,
isShowMore
)
{
if
(
isShowMore
===
null
||
isShowMore
===
undefined
)
{
isShowMore
=
false
;
}
this
.
query
=
this
.
options
.
queryHandler
.
buildQuery
(
isShowMore
);
this
.
imageQueue
=
[];
var
metaQuery
=
$
.
extend
(
this
.
query
,
{
sourceIds
:
sourceIds
});
var
_this
=
this
;
if
(
metaQuery
!==
null
)
{
// TODO Must be special
//$("#search-loading-indicator").removeClass("fade");
$
.
ajax
({
url
:
__util
.
getBaseUrl
()
+
"
metaquery/
"
,
type
:
"
POST
"
,
dataType
:
"
json
"
,
data
:
JSON
.
stringify
(
metaQuery
),
contentType
:
"
application/json
"
,
success
:
function
(
data
,
jqXHR
,
textStatus
)
{
/*$("#search-loading-indicator").addClass("fade");
if (data==null) {
__util.processServerError(jqXHR, textStatus);
}
_this.responseHandler.process(data, isShowMore);*/
},
error
:
function
(
jqXHR
,
textStatus
,
message
)
{
//$("#search-loading-indicator").addClass("fade");
__util
.
processServerError
(
jqXHR
,
textStatus
);
}
});
}
};
\ No newline at end of file
js/search/search.queryHandler.js
View file @
abdd9aa9
...
...
@@ -55,8 +55,7 @@ var QueryHandler = function(options) {
QueryHandler
.
prototype
.
expandSearch
=
function
(
expression
)
{
if
(
expression
==
null
||
expression
===
""
)
{
return
;
}
var
_this
=
this
;
}
if
(
$
(
"
#expression
"
).
length
>
0
)
{
if
(
$
(
"
#expression
"
).
val
().
length
>
0
)
{
$
(
"
#expression
"
).
val
(
$
(
"
#expression
"
).
val
()
+
"
"
+
expression
);
...
...
@@ -69,11 +68,9 @@ QueryHandler.prototype.expandSearch = function(expression) {
$
(
facetElement
).
find
(
"
.search-facet-expression
"
).
val
(
expression
);
//_this.doSearch();
});
}
};
QueryHandler
.
prototype
.
selectFacetingSchema
=
function
()
{
this
.
schemaId
=
$
(
"
#schemaId
"
).
val
();
var
container
=
$
(
"
#facet-schema-info
"
);
...
...
@@ -129,8 +126,6 @@ QueryHandler.prototype.clearSearchFacets = function() {
$
(
"
#search-facets-container
"
).
text
(
""
);
};
QueryHandler
.
prototype
.
insertSearchFacet
=
function
()
{
var
_this
=
this
;
$
.
ajax
({
...
...
@@ -166,24 +161,24 @@ QueryHandler.prototype.removeSearchFacet = function(control) {
this
.
reorderFacets
();
};
QueryHandler
.
prototype
.
doSearch
=
function
(
isShowMore
)
{
//
if (isShowMore===null || isShowMore===undefined) {
QueryHandler
.
prototype
.
doSearch
=
function
(
isShowMore
)
{
if
(
isShowMore
===
null
||
isShowMore
===
undefined
)
{
isShowMore
=
false
;
//}
var
_this
=
this
;
}
this
.
query
=
this
.
buildQuery
(
isShowMore
);
this
.
imageQueue
=
[];
$
(
"
.wordcloud
"
).
text
(
""
);
this
.
clouds
=
[];
var
_this
=
this
;
if
(
this
.
query
!==
null
)
{
$
(
"
#search-loading-indicator
"
).
removeClass
(
"
fade
"
);
$
.
ajax
({
url
:
__util
.
getBaseUrl
()
+
"
query/
"
,
type
:
"
POST
"
,
dataType
:
"
json
"
,
data
:
JSON
.
stringify
(
_
this
.
query
),
data
:
JSON
.
stringify
(
this
.
query
),
contentType
:
"
application/json
"
,
success
:
function
(
data
,
jqXHR
,
textStatus
)
{
$
(
"
#search-loading-indicator
"
).
addClass
(
"
fade
"
);
...
...
@@ -198,6 +193,7 @@ QueryHandler.prototype.doSearch = function(isShowMore) {
}
});
}
};
QueryHandler
.
prototype
.
doSearchDelayed
=
function
()
{
...
...
@@ -213,10 +209,6 @@ QueryHandler.prototype.delaySearch = function(timestamp) {
}
};
QueryHandler
.
prototype
.
addFilter
=
function
(
queryFilter
,
html
)
{
var
match
=
false
;
...
...
@@ -255,9 +247,6 @@ QueryHandler.prototype.removeAllFilters = function() {
this
.
doSearchDelayed
();
};
QueryHandler
.
prototype
.
buildQuery
=
function
(
isShowMore
)
{
var
query
=
{
entities
:
[],
...
...
js/search/search.responseHandler.js
View file @
abdd9aa9
...
...
@@ -34,10 +34,8 @@ var ResponseHandler = function(options) {
"
~eu.dariah.de.minfba.search.view.result.no_title
"
,
"
~eu.dariah.de.minfba.search.view.result.resources.relevance_score
"
,
"
~eu.dariah.de.minfba.search.view.result.resources.hits_in_document
"
,
"
~eu.dariah.de.minfba.search.view.result.show_more
"
]);
"
~eu.dariah.de.minfba.search.view.result.show_more
"
]);
this
.
imageQueue
=
[];
};
...
...
@@ -58,6 +56,14 @@ ResponseHandler.prototype.process = function(resultArray, isShowMore) {
//_this.processResponseTerms();
//_this.processResponseSubjects();
//
}
else
if
(
data
.
resultType
==
"
META
"
)
{
var
sourceIds
=
[];
for
(
var
j
=
0
;
j
<
data
.
resultDatasources
.
length
;
j
++
)
{
sourceIds
.
push
(
data
.
resultDatasources
[
j
].
providerId
);
}
search
.
metasearch
(
sourceIds
,
false
);
}
}
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment