-
-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
And operator not working when 2 indices have to match different values #470
Comments
Unfortunately the readme is a bit outdated. I'm almost finished with the updated version, probably coming the next days. The boolean property was removed. There is a new This is a snippet from my dev files: // some test data
const data = [{
"tconst": "tt0000001",
"titleType": "short",
"primaryTitle": "Carmencita",
"originalTitle": "Carmencita",
"isAdult": 0,
"startYear": "1894",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Documentary",
"Short"
]
},{
"tconst": "tt0000002",
"titleType": "short",
"primaryTitle": "Le clown et ses chiens",
"originalTitle": "Le clown et ses chiens",
"isAdult": 0,
"startYear": "1892",
"endYear": "",
"runtimeMinutes": "5",
"genres": [
"Animation",
"Short"
]
}];
// create the document index
const index = new Document({
document: {
id: "tconst",
store: true,
index: [{
field: "primaryTitle",
tokenize: "forward",
encoder: Charset.LatinBalance
},{
field: "originalTitle",
tokenize: "forward",
encoder: Charset.LatinBalance
}],
tag: [{
field: "startYear"
},{
field: "genres"
}]
}
});
// add test data
for(let i = 0; i < data.length; i++){
index.add(data[i]);
}
// perform a query + enrich results
const result = new Resolver({
index: index,
query: "karmen",
pluck: "primaryTitle",
//enrich: true,
}).or({
index: index,
query: "clown",
pluck: "primaryTitle",
}).and({
index: index,
query: "karmen",
field: "primaryTitle",
suggest: true
}).not({
index: index,
query: "clown",
pluck: "primaryTitle",
enrich: true,
resolve: true
});
// display results
console.log(result); Each resolver stage can access on a different field/index. |
Thanks for the quick response @ts-thomas. Let me test this new API later. For now, I'm just filtering results manually. |
Given a document saving the
documentId
as a index field with strict tokenization config and another index field for the document content namedcontent
, after adding some data to the document, when we search usingbool: "and"
in our query, the result includes matches for individual index results instead of results matching both.This is the document structure:
This is the data we add:
This is the query we execute:
The result obtained shows one array with 2 entries, one for the first index and another one for the second index, where I would be expecting a single result entry with matches for both indices:
Actual result:
Expected result:
I don't really know if the
bool
property as part of the document query, is just one API that I didn't understand when reading the documentation or it should work as I detailed above, but reading the docs, looks like the intention is to apply logical operators to a search query.I think there is a new API introduced in version
0.8.0
named resolvers, but I don't know if this is the one I should use. I tried to make it work with no luck tbh.BWT @ts-thomas and the rest of the contributors, thank you for the hard work on the library and your contributions to the open-source community 😃
The text was updated successfully, but these errors were encountered: