Skip to content

Commit 6888f45

Browse files
committed
Synchronized with the source at 5ae45c1.
1 parent 1effa02 commit 6888f45

File tree

4 files changed

+41
-12
lines changed

4 files changed

+41
-12
lines changed

_sources/publications.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Publications using DiffPy-CMI
2424
The following papers made use of DiffPy developed software for analysis
2525
and/or modeling.
2626

27-
* |citePrillAca15|
27+
* |citePrillAca16|
2828

2929
* |citeTerbanNan15|
3030

_static/searchtools.js

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212

13+
/* Non-minified version JS is _stemmer.js if file is provided */
1314
/**
1415
* Porter Stemmer
1516
*/
@@ -373,8 +374,7 @@ var Search = {
373374
}
374375

375376
// lookup as search terms in fulltext
376-
results = results.concat(this.performTermsSearch(searchterms, excluded, terms, Scorer.term))
377-
.concat(this.performTermsSearch(searchterms, excluded, titleterms, Scorer.title));
377+
results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms));
378378

379379
// let the scorer override scores with a custom scoring function
380380
if (Scorer.score) {
@@ -538,23 +538,47 @@ var Search = {
538538
/**
539539
* search for full-text terms in the index
540540
*/
541-
performTermsSearch : function(searchterms, excluded, terms, score) {
541+
performTermsSearch : function(searchterms, excluded, terms, titleterms) {
542542
var filenames = this._index.filenames;
543543
var titles = this._index.titles;
544544

545-
var i, j, file, files;
545+
var i, j, file;
546546
var fileMap = {};
547+
var scoreMap = {};
547548
var results = [];
548549

549550
// perform the search on the required terms
550551
for (i = 0; i < searchterms.length; i++) {
551552
var word = searchterms[i];
553+
var files = [];
554+
var _o = [
555+
{files: terms[word], score: Scorer.term},
556+
{files: titleterms[word], score: Scorer.title}
557+
];
558+
552559
// no match but word was a required one
553-
if ((files = terms[word]) === undefined)
560+
if ($u.every(_o, function(o){return o.files === undefined;})) {
554561
break;
555-
if (files.length === undefined) {
556-
files = [files];
557562
}
563+
// found search word in contents
564+
$u.each(_o, function(o) {
565+
var _files = o.files;
566+
if (_files === undefined)
567+
return
568+
569+
if (_files.length === undefined)
570+
_files = [_files];
571+
files = files.concat(_files);
572+
573+
// set score for the word in each file to Scorer.term
574+
for (j = 0; j < _files.length; j++) {
575+
file = _files[j];
576+
if (!(file in scoreMap))
577+
scoreMap[file] = {}
578+
scoreMap[file][word] = o.score;
579+
}
580+
});
581+
558582
// create the mapping
559583
for (j = 0; j < files.length; j++) {
560584
file = files[j];
@@ -576,14 +600,19 @@ var Search = {
576600
// ensure that none of the excluded terms is in the search result
577601
for (i = 0; i < excluded.length; i++) {
578602
if (terms[excluded[i]] == file ||
579-
$u.contains(terms[excluded[i]] || [], file)) {
603+
titleterms[excluded[i]] == file ||
604+
$u.contains(terms[excluded[i]] || [], file) ||
605+
$u.contains(titleterms[excluded[i]] || [], file)) {
580606
valid = false;
581607
break;
582608
}
583609
}
584610

585611
// if we have still a valid result we can add it to the result list
586612
if (valid) {
613+
// select one (max) score for the file.
614+
// for better ranking, we should calculate ranking by using words statistics like basic tf-idf...
615+
var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]}));
587616
results.push([filenames[file], titles[file], '', null, score]);
588617
}
589618
}

publications.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ <h1>Publications using DiffPy-CMI<a class="headerlink" href="#publications-using
144144
and/or modeling.</p>
145145
<ul class="simple">
146146
<li>Dragica Prill, Pavol Juhas, S. J. L. Billinge and Martin U. Schmidt,
147-
<a class="reference external" href="http://journals.iucr.org/a/">Solution and refinement of organic crystal structures by fitting to
147+
<a class="reference external" href="https://dx.doi.org/10.1107/S2053273315022457">Solution and refinement of organic crystal structures by fitting to
148148
the atomic pair distribution function (PDF)</a>,
149-
<em>submitted to Acta Crystallogr. A</em>, (2015).</li>
149+
<em>Acta Crystallogr. A</em> <strong>72</strong>, 62-72 (2016).</li>
150150
<li>Maxwell W. Terban, Matthew Johnson, Marco Di Michiel and Simon J. L.
151151
Billinge, <a class="reference external" href="http://dx.doi.org/10.1039/C4NR06486K">Detection and characterization of nanoparticles in suspension at
152152
low concentrations using the X-ray total scattering pair distribution

0 commit comments

Comments
 (0)