Project

General

Profile

Actions

bug #6296

closed

Simple search for common names returns duplicates

Added by Andreas Kohlbecker about 7 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Highest
Assignee:
Category:
cdmlib
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Severity:
critical
Found in Version:

Description

This is a bug the cdmlib-services

For example:

http -b http://api.cybertaxonomy.org/salvador/portal/taxon/find.json\?doTaxaByCommonNames\=1\&doMisappliedNames\=0\&doSynonyms\=0\&doTaxa\=0\&pageNumber\=0\&pageSize\=25\&query\=amate\&tree\=b010c84d-6049-45f4-9f13-c065101eaa26 | jq '.records[].titleCache'

NOTE: The http command is from httpie

Broken queries:

TODO:

  1. Implement tests for theses search mode combinations. DONE: cdmlib|cc95089
  2. fix the bug
Actions #1

Updated by Andreas Müller about 7 years ago

  • Assignee changed from Andreas Müller to Katja Luther
  • Priority changed from New to Highest
  • Target version changed from Unassigned CDM tickets to Release 4.5
Actions #2

Updated by Katja Luther about 7 years ago

This is a problem in the lucene search, if a taxon has two common names starting with "amate" the lucene search returns the taxon two times. We need to add a duplicate filter.

Actions #3

Updated by Katja Luther about 7 years ago

tested findByEverythingFullText(), but this works fine also with more than one common name starting with the same word.
@AK which service method is called for the simple search?

Actions #4

Updated by Andreas Kohlbecker about 7 years ago

The method in question is

Pager<IdentifiableEntity> eu.etaxonomy.cdm.api.service.TaxonServiceImpl.findTaxaAndNames(IFindTaxaAndNamesConfigurator configurator)

so this issue has nothing to do with the free text search.

The results of the common names search is simply added to the result set in findTaxaAndNames after the search by accepted name, synonym, misapplied name has been done. The first search process already returns a pager object of the desired size. Adding the results of the common name search completely breaks the paging mechanism. The search for common names thus must be integrated into the preceding search step.

Actions #5

Updated by Katja Luther about 7 years ago

The commonNameSearch is now integrated into the taxa and synonym search query.

Actions #6

Updated by Katja Luther about 7 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 50
Actions #7

Updated by Andreas Kohlbecker about 7 years ago

  • Status changed from Resolved to In Progress

With the test case mentioned in #6317 an exception is thrown:

2017-01-09 15:26:32.283:WARN:oejs.ServletHandler:/portal/taxon/find.json
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: f near line 1, column 196 [select t.id from eu.etaxonomy.cdm.model.taxon.Taxon t  join t.taxonNodes as tn join t.descriptions d join d.descriptionElements e join e.feature f  WHERE  tn.classification = :classificationAND  f.supportsCommonTaxonName = true and e.name LIKE :queryString]
    at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:74)
    at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:91)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:288)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:187)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:142)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:115)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:76)
    at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:150)
    at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:302)
    at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:240)
    at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1894)
    at eu.etaxonomy.cdm.persistence.dao.hibernate.taxon.TaxonDaoHibernateImpl.prepareQuery(TaxonDaoHibernateImpl.java:398)
    at eu.etaxonomy.cdm.persistence.dao.hibernate.taxon.TaxonDaoHibernateImpl.prepareTaxaByName(TaxonDaoHibernateImpl.java:601)
    at eu.etaxonomy.cdm.persistence.dao.hibernate.taxon.TaxonDaoHibernateImpl.countTaxaByName(TaxonDaoHibernateImpl.java:658)
Actions #8

Updated by Katja Luther about 7 years ago

  • Status changed from In Progress to Resolved
  • Assignee changed from Katja Luther to Andreas Kohlbecker
Actions #9

Updated by Andreas Kohlbecker about 7 years ago

  • Status changed from Resolved to In Progress
  • Assignee changed from Andreas Kohlbecker to Katja Luther
  • Target version changed from Release 4.5 to Release 4.6

This works now in general but searching only for common names causes an exception:

http://api.cybertaxonomy.org/salvador/portal/taxon/find.json?doTaxaByCommonNames=1&pageNumber=0&pageSize=25&query=amate&tree=b010c84d-6049-45f4-9f13-c065101eaa26

(By the way, this is exactly the example request given in the issue description)

please implement a test for this case

Actions #11

Updated by Katja Luther about 7 years ago

  • Status changed from In Progress to Resolved
Actions #12

Updated by Katja Luther about 7 years ago

  • Status changed from Resolved to In Progress

bugs are fixed and tests are added

Actions #13

Updated by Andreas Kohlbecker about 7 years ago

There are at least two other problems. I extended the according service tests. You will find in the cdmlib|cc95089 some FIXME sections which are commented which contain the failing test cases.

Actions #14

Updated by Katja Luther about 7 years ago

  • Status changed from In Progress to Resolved
Actions #15

Updated by Andreas Kohlbecker about 7 years ago

  • Description updated (diff)
Actions #16

Updated by Katja Luther about 7 years ago

  • Target version changed from Release 4.6 to Release 4.5
Actions #17

Updated by Andreas Müller over 6 years ago

  • Assignee changed from Katja Luther to Andreas Kohlbecker

Andreas K, could you please review if this is fully fixed now?

Actions #18

Updated by Andreas Müller over 6 years ago

if not, please open new ticket with remaining issues

Actions #19

Updated by Andreas Kohlbecker almost 6 years ago

  • Assignee changed from Andreas Kohlbecker to Katja Luther
  • % Done changed from 50 to 100

duplicates are no longer returned, so this issue can in principle be closed, however, as last step cleaning up commented lines in the committed code would be great!
@Katja, please close this issue once the code cleaning is done.

Actions #20

Updated by Andreas Müller over 2 years ago

Katja, can you have a look? Closing this ticket is needed to cleanup open Salvador issues and to finally close the according milestone.

Actions #21

Updated by Katja Luther over 2 years ago

  • Status changed from Resolved to Closed

Code cleaning done.

Actions

Also available in: Atom PDF