day 340 — code 365
Fri 18 Nov 2016
Managed to implement basic sorting by relevance instead of alphabetically. It involved using an ngram analyzer and tokenizer. I found it incredibly frustrating sifting through many methods to try to get this working. I played around with wildcard queries, query_string queries, match queries, and many others. I really felt like it was an exponential number of possible solutions, and it was very daunting.
A turning point was realising that all my scores were set to 1, which meant that I wasn’t giving ES anything useful to sort by. This led to moving my search query outside of the filter clause, and into the must clause. I also added:
inside of my sortBy clause.
I need to implement multi-field searching next so that, for example, we can search by fullName and email with the one search query.
I decided that it would be a good idea to send some foundational programming questions to my mentee:
1. With regards to objects, what is a property, key, value?
2. What are the data types in JS?
3. What is an object literal?
4. What is a method?
When I had gotten a clearer understanding of concepts / jargon like those, it definitely helped me a LOT. Hopefully they will find it helpful too!