mchangtian opened a new issue, #59658:
URL: https://github.com/apache/doris/issues/59658

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   4.0.1
   
   ### What's Wrong?
   
   I am using Doris' FULLTEXT search feature with `MATCH_ANY`, and follow the 
official example to retrieve relevance scores via `score()` function. The basic 
search works fine, but I cannot filter out records with low relevance 
scores—any attempt triggers a syntax error about `score()` being restricted to 
SELECT clause only.
   
   I want to ask:
   1. Does Doris support filtering low relevance score results for FULLTEXT 
search?
   2. If yes, what is the correct SQL syntax (based on the official demo below)?
   3. If not, is there an alternative approach (without heavy performance cost 
like temporary tables)?
   
   # Environment Information
   - Doris Version: [Output of `SELECT VERSION();` 4.0.1]
   
   I tried to filter records with relevance > 5 using the following SQL 
(ensuring score() is only in SELECT clause of subquery):
   ```
   SELECT a.* FROM (
       SELECT *, score() AS relevance
       FROM search_demo
       WHERE content MATCH_ANY '检索测试'
   ) a WHERE a.relevance > 5 ORDER BY a.relevance DESC LIMIT 10;
   ```
   Exact Error Message Encountered
   
   ```
   SQL 错误 [1105] [HY000]: errCode = 2, detailMessage = score() function can 
only be used in SELECT clause, not in WHERE clause
   ```
   
   ### What You Expected?
   
   ensure that this SQL can run
   ```
   SELECT a.* FROM (
       SELECT *, score() AS relevance
       FROM search_demo
       WHERE content MATCH_ANY '检索测试'
   ) a WHERE a.relevance > 5 ORDER BY a.relevance DESC LIMIT 10;
   ```
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to