Why not using tags? We only tokenize tags by comma and you can also change it on index creation (notice that you will have to escape the spaces on queries).
We need to utilize the stemming of TextField to do some prefix search. For example, we would like to search “Harry Po*” and get “Harry Potter” as a result, but we also want to make “Harry Potter” become a single word, so when the user search for “Potter” only, they won’t get any result. I believe TagField cannot fulfill this requirement.
Best,
Nha.
Vào 15:02:48 UTC+7 Thứ Ba, ngày 15 tháng 1 năm 2019, me...@redislabs.com đã viết:
Sorry I did not test it carefully. Look like the order is determined by the order when inserting the documents (in my case, last in first out,) and not affected by the $weight in my query. Is this a bug?
Thank you.
Vào 17:58:52 UTC+7 Thứ Ba, ngày 15 tháng 1 năm 2019, me...@redislabs.com đã viết:
I realized the default scorer (tf*idf) give the infinity score if the target tag is found, that’s why the ranking didn’t work because it could not compare inf numbers. So I changed the scorer to BM 25 and I got very nice results.
best.
Vào 16:41:19 UTC+7 Thứ Tư, ngày 23 tháng 1 năm 2019, me...@redislabs.com đã viết:
Hi, it is not really related to my original issue, but since you mentioned about scorer function, I think posting it here is appropriate.
I would like to write a custom scorer, but after reading your documents and examples, I still can’t figure out how to include some custom data to calculate the score. Your scorer function signature is: double MyScorer(RSScoringFunctionCtx *ctx, RSIndexResult *h, RSDocumentMetadata *dmd, double minScore)
Now I would like to include 2 types of data to calculate the score:
A dynamic data: for example, we have many users with different weights that affect the final score, how could I inject a user’s weight into MyScorer?
A static data: some data belong to the document and will be included in the payload, but how can I get them from the payload, please give me a concrete example.
Thank you so much.
Vào 16:53:29 UTC+7 Thứ Tư, ngày 23 tháng 1 năm 2019, me...@redislabs.com đã viết:
So I agree our extension api is not well documented and we should fix it. Regarding you questions, you should import redisearch.h file (all the structs you need should be there)
you can add this dynamic data on the ft.search request using payload, then you can access this payload using the given RSScoringFunctionCtx (ctx->payload)
you can put the static data on the document payload and then access it using the give RSDocumentMetadata (dmd->payload)
Hope this answer your question, let me know if you need any further clarification.