This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello all, Today I've started to implement full text search, after a noticeable time it was working. But I ran into a problem. I want to apply filtering on search results. The user is able to full text search but I'd like to filter on the property: "PhysiotherapistId". I'm working with the following code:
Whenever searching on Users whom are linked to PhysiotherapistId 4 the Console.WriteLine returns expected values (ie 2 - 2, 1 - 1 etc). Although, searching on Users who are linked to another physotherapist I get unexpected values (ie 0 - 1, 0 - 2). In other words, the: Database.Instance.UnitOfWork.Count Thanks in advance :-) |
|
|
Sorry for a bumb, but anyone? Thanks! |
|
|
Hi Mark, Could you please try the following:
The reason for this is that search returns a container for the results since search results could contain many different entity types. You need to pass a search query through the Search() method, not through Find(). I hope that helps and sorry for the delay. Let me know if it works out for you! John-Daniel |
|
|
Hello John, Thanks for the reply! I've tried your solution but unfortunately it doesn't work. For clarification, I added a picture: Once more, thanks! |
|
|
Hello Mark, We've been trying to reproduce this issue without success. Could you post the generated SQL for the queries please? This may clarify how a result with a PhysiotherapistId of 5 is getting selected when your query specifies a value of 4. You can capture the generated SQL by setting If nothing jumps out of that then could you send us a minimal repro project please? We would need:
Thanks! |
|
|
Hello Ivan, I noticed something remarkable, while I was reproducing the behaviour I might have found the problem. It has something todo with other queries being executed. MySQL-query when no other query is executed:
The query in the top is works like a charm. But after executing a: Database.Instance.UnitOfWork.Find Thanks! EDIT: I've attached a test project plus test database, inside the unit tests i've reproduced the error. Please let me know if the test project doesn't work or anything like that. |
|
|
I think you've nailed it -- we had a bug where if the full text search returned exactly one hit, and the corresponding entity was already part of this unit of work, we just returned that entity without checking whether it passed the QueryExpression criteria. This bug will be fixed in the next nightly build, available from about 1200 GMT. I wasn't sure whether your production issue always happened on the 'only one hit from the full text search' scenario, or whether you also saw it when there were multiple FTS matches, so do let us know if the update doesn't solve your production issue. |
|
|
Thanks ivan! The bug fix solves the problem. Now I can happily use the full text search :-). |
|