Task #2678

Updated by Sebastien Jacquot 10 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 anyway 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 subcorpus. But in the context of Part creation they may be always equivalent?

Solution 1

1) execute the query: <sp_n="97">[] expand to sp

2) if no matches are found then execute the query: [_.sp_n="97"] expand to sp