Task #2678

Updated by Serge Heiden 7 months ago

Queries of type: @[_.sp_n="97"] expand to sp@
are very heavy.

There are some optimization in /org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/SubcorpusCQLQuery.java to avoid them when the part is of "text" level:

if ("text".equals(structure.getName())) { // optimisation only for the text structure
queryString = "<"+property.getFullName()+"=\""+CQLQuery.addBackSlash(value)+"\">[] expand to "+structure.getName();
} else {
queryString = "[_."+property.getFullName()+"=\""+CQLQuery.addBackSlash(value)+"\"] expand to "+structure.getName();

to generate a query of type: @<text_booktitle="Waterloo">[] expand to text@
Is there a way to extend this optimization?
eg. @[_.sp_n="97"] expand to sp@
is equivalent to:
@<sp_n="97">[] expand to sp@

NOTE: after discussion with MD, the 2 queries are not always equivalent. The optimized query "@<sp_n="97">[] expand to sp@" may not work on a subcorpus. But in the context of Part creation they may always be equivalent?

h3. Solution 1

* manage all structures levels
* be able to know if the structure is sometimes out of the current corpus, if not use the <structure> query

h3. Solution 2

# execute the query: @<sp_n="97">[] expand to sp@
# if no matches are found then execute the query: @[_.sp_n="97"] expand to sp@