Full text search: boost results score based on node label

Hi,

I have a use case where I'm doing a full text search across several types of entities, and I'd like the results to promote one of those entities (something like ^2 from Apache Lucene).

Is such a thing possible ? I didn't find anything in the docs.

Thanks in advance,
Olivier

Hello Layvier,

Could you please explain it with an example or elaborate little more? how you are doing the full text search and how you want to promote it.

Thanks,
Rishabh

So basically I'm creating a fulltext index, as described here: Fulltext search in Neo4j - Knowledge Base

Here's the created index:

CALL db.index.fulltext.createNodeIndex("titlesAndDescriptions",["Movie", "Book"],["title", "description", "review"])

I am then querying it like this:

CALL db.index.fulltext.queryNodes("titlesAndDescriptions", "title:matrix^3  description:matrix") YIELD node, score
RETURN node.title, node.review, score

Here I'm boosting the score using ^ so that the score get higher if a match happens on the title field.

What I would like is to boost the score in the same way if the node is of label Movie, so that my search prioritises movies over books.

Hope it's clearer :)

@Layvier
Did you tried using labels like below. Not 100% sure about it but mostly it should work.

CALL db.index.fulltext.queryNodes("titlesAndDescriptionsLabel","label:Movie^3 label contain 'Movie'") YIELD node, score
RETURN node.title, node.review, score

I couldn't make it work :/ .
I don't recognise the syntax of the query you provided, can you forward me some documentation regarding that ? I only found this: Apache Lucene - Query Parser Syntax

@Layvier, we have similar kind of requirement, we are multiple nodes on the search. We tried using WITH clause and order by clause to achieve this but still it seems more refinement.