using ^n on a field is only valid syntax for lycene. This caused the name field to never be search which resulted in channels not being searchable. I added the boost parameter which is what is supposed to be used. I made the weight 5 based tests around "super" which is a query that returns 1800 hits. The intention is to make sure that channels show up first in the results.

This commit is contained in:
Mark Beamer Jr 2018-03-13 21:37:57 -04:00
parent 674dddca8a
commit 00a41e9e19

View file

@ -18,7 +18,6 @@ const eclient = new elasticsearch.Client({
},
});
function getResults (input) {
if (input.size === undefined) input.size = 10;
if (input.from === undefined) input.from = 0;
@ -31,7 +30,10 @@ function getResults (input) {
'should': [
{
'match': {
'name^100': '*' + input.s.trim() + '*',
'name': {
'query': '*' + input.s.trim() + '*',
'boost': 100,
},
},
},
{
@ -89,12 +91,12 @@ function getResults (input) {
function getIndex () {
// ideally, data is inserted into elastic search with an index that helps us query it faster/better results
// A simple start is to default queries to be within the n months, and to make a new index each month.
return;
}
function getRoutingKey () {
// This is the most important field for performance. Being able to route the queries ahead of time can make typedowns insanely good.
return;
}
function getAutoCompleteQuery (query) {
@ -108,16 +110,16 @@ function getAutoCompleteQuery(query) {
'name',
'value.stream.metadata.author',
'value.stream.metadata.title',
'value.stream.metadata.description'
]
}
'value.stream.metadata.description',
],
},
};
}
function getFilter (query) {
// this is the best place for putting things like filtering on the type of content
// Perhaps we can add search param that will filter on how people have categorized / tagged their content
return;
}
function getAutoComplete (query) {
@ -131,9 +133,9 @@ function getAutoComplete(query) {
query: {
bool: {
must : getAutoCompleteQuery(query),
filter: getFilter(query)
}
}
filter: getFilter(query),
},
},
},
size: query.size,
from: query.from,
@ -191,7 +193,7 @@ class LighthouseControllers {
}
}
var clean = new Array();
var clean = [];
for (var i = 0; i < cResults.length; i++) {
if (cResults[i] && cResults[i].length > 3 && clean.indexOf(cResults[i]) === -1) {
clean.push(cResults[i]);