Cadasta / cadasta-platform

[DEPRECATED] Main repository of the Cadasta platform. Technology to help communities document their land rights around the world.
https://demo.cadasta.org
GNU Affero General Public License v3.0
54 stars 81 forks source link

Search doesn't match on multiple terms/operators #1119

Closed amplifi closed 7 years ago

amplifi commented 7 years ago

Steps to reproduce the error

Search any project for a multi-term/operator query as outlined in the text-based search requirements in #826: "Pamela female "New York" or boston will search all records containing a text field matching with "Pamela", another text field matching with "female", and another text field matching with either "New York". Or just the records containing the word "Boston" (left-to-right). Example: search project "Chocolate Factory" for the following string: David Male "Amtali upazila" atabari

Actual behavior

No results are returned.

Expected behavior

According to the spec, the example project "Chocolate Factory" should return the party named David, because this party contains "David", "Male", "Amtali upazila", and "atabari"

Note: no results are returned for the same string without quotation marks, as in: David Male Amtali upazila atabari

dpalomino commented 7 years ago

Thanks @amplifi.

So I think this issue is related to not supporting labels in the queries (#1111). Attaching the questionnaire used for that project as a reference.

In the example, "Amtali upazila" is a label.

So:

  1. Querying: atabari male david

    • 1 result: relationship attached to party David
  2. Querying: PA inheritance generations

    • 1 result: Location Parcel
  3. Quering: atabari david inheritance

    • 0 results (this is because atabari and david are related to party attributes, and inheritance is related to location attribute).

Does it make sense? @seav, is it ok for you?

(file redacted)

amplifi commented 7 years ago

@dpalomino Would you mind sharing the questionnaire in #search instead? Let's avoid publishing partner-specific questionnaires to the public. Thanks!

amplifi commented 7 years ago

@dpalomino In the example I gave, "Amtali upazila" isn't a label. It's the value stored in the party "David" for the label "SELECT UPAZILLA"

dpalomino commented 7 years ago

@dpalomino In the example I gave, "Amtali upazila" isn't a label. It's the value stored in the party "David" for the label "SELECT UPAZILLA"

That is strange... in the xlsform I see:

upazilla | amtali | আমতলী উপজেলা | Amtali upazila upazilla | jamalpur_sadar | জামালপুর সদর উপজেলা | Jamalpur sadar upazila upazilla | mohanpur | মোহনপুর উপজেলা | Mohanpur upazila

And if we change "Amtali upazila" and use instead "amtali" then is working fine...

dpalomino commented 7 years ago

Hey @amplifi. Do you think the issue was due to label text being used in the query instead of the select_one choice name? Can we close this issue if so? Thanks!

dpalomino commented 7 years ago

I think that was related with querying a text within labels (issue #1111). Please reopen if needed.