Skip to content

Suport findAndRerank on a collection with vector / vectorize but without lexical index. #2585

Description

@amorton

A findAndRerank query that does not explicitly ask for a lexical leg should succeed so long as the collection has a vector.

Examples of queries that should work without a lexcial index, but currently fail:

[
	{
		"findAndRerank": {
			"filter": {
			},
			"projection": {
			},
			"sort": {
				"$hybrid": "I like cheese!"
			},
			"options": {
				"limit": 10,
			}
		}
	},
{
		"findAndRerank": {
			"filter": {
			},
			"projection": {
				"_id": 1,
				"$vectorize": 1
			},
			"sort": {
				"$hybrid": {
					"$vectorize": "0-dimensional biomaterials lack inductive properties."
                                 }
			},
			"options": {
				"limit": 20,
				"includeScores": false,
				"includeSortVector": false
			}
		}
	},
	{
		"findAndRerank": {
			"filter": {
			},
			"projection": {
				"_id": 1,
				"name": 1,
				"$vectorize": 1
			},
			"sort": {
				"$hybrid": {
					"$vector": [
						0.030776024
					]
				}
			},
			"options": {
				"rerankQuery": "I like cheese",
				"rerankOn": "content",
				
				"limit": 10,
				"hybridLimits": {
					"$lexical": 15,
					"$vector": 35
				},
				"includeScores": true,
				"includeSortVector": false
			}
		}
	}
]

In the above, non of the explicitly as for a lexical sort.

NOTE: the $lexical in hybridLimits should be ignored if the sort does not ask for a lexical.

below is the user explicitly asking for a lexical sort, this should Fail if the collection does not have an index:

	{
		"findAndRerank": {
			"filter": {
			},
			"projection": {
				"_id": 1,
				"$vectorize": 1
			},
			"sort": {
				"$hybrid": {
					"$vectorize": "0-dimensional biomaterials lack inductive properties.",
					"$lexical": "tissue"
				}
			},
			"options": {
				"limit": 20,
				"includeScores": false,
				"includeSortVector": false
			}
		}
	}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions