cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Full text search: boost results score based on node label

Layvier
Node Link

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

7 REPLIES 7

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

Layvier
Node Link

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

deepika
Node Link

@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.

neo4jeej
Node Link

I'm also trying to boost based on node label.
@prishabh35 I can't get this approach to work either. I'm also interested in any documentation regarding this.
@deepika could you elaborate on what you attempted using the WITH clause?
Layvier did you make any progress in the meantime?
Thank you all in advance!

deepika
Node Link

We have created the custom logic on the top of the lucene search to match our requirement.