Replies: 1 comment 10 replies
-
Excellent write-up. off-the-shelfMy general sense is that we are under-utilizing off-the-shelf solutions. My hope is that zaprank provides enough of a quality signal that we can combine with relevance metrics available off-the-shelf to provide a satisfactory search experience. Out current search is basically two iterations of work done by me while I'm working on a bunch of other stuff - once three years ago to just get anything working, then again 18 months ago to add semantic search. So my sense is based on the fact that we haven't given search optimization a real try. trial and errorA real try probably looks like building up some set of test searches and expected results then tweaking the query until the results are satisfactory on all test searches. beyond off-the-shelfI'm also open to more elaborate solutions if it's ultimately low maintenance. I'm just out of my depth with anything bespoke. Learning-to-rank is a neat idea - I don't imagine we have enough clicks/data to train something like that too well though. Absent trial and error being good enough, or a wizard providing some low maintenance solve, it may be worth outsourcing search to a third party like algolia and washing our hands with it. My hope is and has been that we can use open source, off-the-shelf stuff but maybe the reality is that we can't. |
Beta Was this translation helpful? Give feedback.
-
Wanted to open up a discussion on search improvements (#1885), since search is a multi-objective optimization problem requiring opinionated decisions on how to weigh each objective. There are four main objectives: exact keyword matches, semantic matches, popularity (zaprank), and recency. (Do we know if people ever sort by comments or sats?)
Currently, searching by "recent" is broken because the "must" field requires a pretty precise keyword match, thus often returning no results. You can test this by changing the following lines in
api/resolvers/search.js
:stacker.news/api/resolvers/search.js
Lines 283 to 290 in c571ba0
For example, if you change
type
tomost_fields
and addfuzziness: AUTO
, searching by recent will no longer return null results while still prioritizing recency.But before fixing that, it would be helpful to think through what SN's search is trying to accomplish and how search performance should be measured. There is a lot of info out there, and the specific details of the search engines of major companies is a closely guarded secret. Thus, there isn't a one-size-fits-all or industry-standard solution.
I have a couple of thoughts on how to proceed:
Learning-to-Rank
The obvious, but heavy-lift, solution would be to use ML on users' actual searches (what they searched and what they clicked on, and whether they re-did the search) to estimate optimal weights based on SN users' behavior. If user data is not available, synthetic data could be generated for learn-to-rank, but the results aren't likely to be as robust to the actual user experience.
The downside of this approach is that it's a lot of work. The juice may not be worth the squeeze.
Off-the-shelf solution plus trial and error
The only other approach I can really think of is to take some off-the-shelf approach suggested by others, like applying a gaussian decay function to
created_at
for recency searches, combined with a hybrid keyword/neural approach for query terms. Another suggested approach is reciprocal rank fusion, which is claimed to perform quite well and is simple to implement.But even with off-the-shelf methods, some parameters will need to be chosen, like how much to weigh recency vs. relevance. However, without an obvious evaluation metric, it will be hard to know whether any changes to the search function resulted in improved searches. Here might just be where trial and error comes in: see whether a newly implemented search function results in positive or negative user feedback, as well as personal experimentation with the results.
Beta Was this translation helpful? Give feedback.
All reactions