That sounds perfect, I look forward to 3.5, many thanks. On Thursday, 30 May 2019 15:47:48 UTC+1, Andrey Abramov wrote: > > Hi Dave, > > That's possible in 3.5, check out the following example: > > *FOR d in myView * > *SEARCH d.name <http://d.name> IN [ 'foo', 'bar', 'baz' ] * > *SORT BM25(d)*d.rating DESC // DESC is important to get the most relevant > results first* > *RETURN d* > > you can return evaluated value as well: > > *FOR d in myView * > *SEARCH d.name <http://d.name> IN [ 'foo', 'bar', 'baz' ] * > *LET score = BM25(d)*LOG(d.rating+1)* > *SORT score DESC* > *RETURN { d, score }* > > you can also use query time boost to modify overall score based on your > search condition: > > LET importance = 42 > *FOR d in myView * > *SEARCH BOOST(**d.name <http://d.name> == 'importantName', importance) > || **d.name <http://d.name> IN [ 'foo', 'bar', 'baz' ] * > *LET score = BM25(d)*LOG(d.rating+1)* > *SORT score DESC* > *RETURN { d, score }* > > On Thursday, 30 May 2019 13:02:50 UTC+3, Dave Challis wrote: >> >> For example, say I've got collection of products containing data such as: >> >> {"name": "headphones", "rating": 4} >> >> Is there any way (using a fulltext index, or search view, or custom >> function) to boost/modify the searches on the "name" field based on the >> "rating" field? >> >> I'd like to allow the most relevant products to be found, but then also >> apply a small upwards boost for things with a high rating field. >> >
-- You received this message because you are subscribed to the Google Groups "ArangoDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/arangodb/4d3f7c1e-ee45-4780-86a8-08bffc2b5ed5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
