Alfanous-team / alfanous

Alfanous is an Arabic search engine API provides the simple and advanced search in Quran , more features and many interfaces...
http://www.alfanous.org/
GNU Affero General Public License v3.0
251 stars 89 forks source link

Logical relations shows not related results using API #526

Closed iTarek closed 3 years ago

iTarek commented 3 years ago

Example: https://www.alfanous.org/api/search?query=سورة:الإخلاص+أحد

And it same things on all logical relations

I did not find anyway to search on one sura using the API always give results from other suras too

Can you help and give me working API query that search on sura, I am sure it's working because the website give correct results.

sneetsher commented 3 years ago

Welcome. It is missing the logic keyword in the query. The supported AND logic operators are: + (URL encoded to %2B), AND or و inside query, Example:

  1. و

  2. +

  3. AND

For OR logic operators: |, OR or أو. By the way, OR is the default logic operation, so you may drop/omit it from the query. So this works fine:

iTarek commented 3 years ago

Thank you, you are right just have to encode ( + ) in the url

This did the trick (Swift)

        urlComponents.percentEncodedQuery = urlComponents.percentEncodedQuery?
            .replacingOccurrences(of: "+", with: "%2B")