Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Bone" works well when autocomplete=true but breaks when autocomplete=false #142

Open
gaurav opened this issue Feb 2, 2024 · 0 comments

Comments

@gaurav
Copy link
Contributor

gaurav commented Feb 2, 2024

When autocomplete is set to true, we set the query parameter query to e.g. (water) OR (water*) so that we can include cases where the search query is incomplete (e.g. (bloo) OR (bloo*) lets us find blood).

When autocomplete is false, we set query to just (water). In most cases this works fine, but sometimes this presents very different results. Compare:

We can restore the previous results by repeating the search query twice as before, i.e. (bone) OR (bone). I tried that out in a branch and confirmed that it does work:

query = f"({string_lc_escaped}) OR ({string_lc_escaped})"

Looking at the explain output, it looks like both queries set off a search for "bone bone", which might be pulling the correct UBERON term higher up:

    "rawquerystring":"(bone) OR (bone*)",
    "querystring":"(bone) OR (bone*)",
    "parsedquery":"+(DisjunctionMaxQuery((names:bone | (preferred_name_exactish:bone)^10.0 | preferred_name:bone)) DisjunctionMaxQuery((names:bone* | preferred_name:bone* | (preferred_name_exactish:bone*)^10.0))) DisjunctionMaxQuery(((names:\"bone bone\")^2.0 | (preferred_name:\"bone bone\")^3.0))",
    "parsedquery_toString":"+((names:bone | (preferred_name_exactish:bone)^10.0 | preferred_name:bone) (names:bone* | preferred_name:bone* | (preferred_name_exactish:bone*)^10.0)) ((names:\"bone bone\")^2.0 | (preferred_name:\"bone bone\")^3.0)",
    "rawquerystring":"(bone) OR (bone)",
    "querystring":"(bone) OR (bone)",
    "parsedquery":"+(DisjunctionMaxQuery((names:bone | (preferred_name_exactish:bone)^10.0 | preferred_name:bone)) DisjunctionMaxQuery((names:bone | (preferred_name_exactish:bone)^10.0 | preferred_name:bone))) DisjunctionMaxQuery(((names:\"bone bone\")^2.0 | (preferred_name:\"bone bone\")^3.0))",
    "parsedquery_toString":"+((names:bone | (preferred_name_exactish:bone)^10.0 | preferred_name:bone) (names:bone | (preferred_name_exactish:bone)^10.0 | preferred_name:bone)) ((names:\"bone bone\")^2.0 | (preferred_name:\"bone bone\")^3.0)",

So the real solution here would be to improve the search so that we don't need to duplicate terms. The clique count I'm currently testing might help with that, but the scores might also be different enough that that doesn't make a difference. If that's the case, we'll need to be smarter about this.

gaurav added a commit that referenced this issue Apr 25, 2024
This PR combines several improvements to search, results and filtering:
* It updates the search query to no longer duplicate the search query when doing an autocomplete query (see #142).
  * This breaks hyphenated search terms in the autocomplete query, and I can't figure out why. For now, I've set it up so that we replace special characters with spaces in the autocomplete query (i.e. beta-secretase becomes `(beta secretase*)`) but we escape special characters in the non-autocomplete query (i.e. beta-secretase becomes `(beta\-secretase*)` since that still appears to work. I'll dig into this more deeply in #146.
* It adds taxon and clique identifier count to values indexed during data loading.
* It incorporates clique identifier count into both the returned results as well as the boosting and sorting of the returned results. It also tweaks the boosting values used in query fields and phrase fields.
* It adds an `only_taxa` input field that allows filtering results to a list of NCBITaxon taxon identifiers (note that this will only work for terms that have taxon information, which at the moment is only cliques containing NCBIGene identifiers).
@gaurav gaurav added this to the NameRes May 2024 milestone May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant