gplx/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/JSONScript/TestCases/q-0104.json

280 lines
6.8 KiB
JSON

{
"description": "Test `_txt`/`~` with enabled full-text search support (only enabled for MySQL, SQLite)",
"setup": [
{
"namespace": "SMW_NS_PROPERTY",
"page": "Has text",
"contents": "[[Has type::Text]]"
},
{
"page": "Example/Q0104/1",
"contents": "{{#subobject: |Has text=MySQL vs MariaDB database}} {{#subobject: |Has text=Oracle vs MariaDB database}} {{#subobject: |Has text=PostgreSQL vs MariaDB database and more of}} {{#subobject: |Has text=MariaDB overview}}"
},
{
"page": "Example/Q0104/2",
"contents": "{{#subobject: |Has text=Elastic search}} {{#subobject: |Has text=Sphinx search}}"
},
{
"page": "Example/Q0104/3",
"contents": "{{#subobject: |Has text=...a hyphenated phrase that has special significance when it appears at the beginning of text...}} {{#subobject: |Has text=...a hyphenated phrase that has NOT any special significance when it appears at the beginning of text...}}"
},
{
"page": "Example/Q0104/4",
"contents": "{{#subobject: |Has text=Text with a category|@category=Q0104}} {{#subobject: |Has text=Text without a category}}"
}
],
"beforeTest": {
"job-run": [
"SMW\\SearchTableUpdateJob"
]
},
"tests": [
{
"type": "query",
"about": "#0 with boolean include/not include",
"condition": "[[Has text::~+MariaDB -database]]",
"printouts": [],
"parameters": {
"limit": "10"
},
"assert-queryresult": {
"count": 1,
"results": [
"Example/Q0104/1#0##_55b020117d21e4b7967cf5bf78cf6b32"
]
}
},
{
"type": "query",
"about": "#1",
"condition": "[[Has text::~+database]]",
"printouts": [],
"parameters": {
"limit": "10"
},
"assert-queryresult": {
"count": 3,
"results": [
"Example/Q0104/1#0##_7980f674d00e51fbc91cc663a43054c5",
"Example/Q0104/1#0##_507a001e2e9e0e7659aa33e8c4b2d471",
"Example/Q0104/1#0##_1a377960fd7e6c287e97c519278761b4"
]
}
},
{
"type": "query",
"about": "#2 (plus sorting)",
"condition": "[[Has text::~DATA*]]",
"printouts": [],
"parameters": {
"limit": "10",
"sort": {
"Has_text": "DESC"
}
},
"assert-queryresult": {
"count": 3,
"results": [
"Example/Q0104/1#0##_1a377960fd7e6c287e97c519278761b4",
"Example/Q0104/1#0##_507a001e2e9e0e7659aa33e8c4b2d471",
"Example/Q0104/1#0##_7980f674d00e51fbc91cc663a43054c5"
]
}
},
{
"type": "query",
"about": "#3 (plus sorting)",
"condition": "[[Has text::~sear*]]",
"printouts": [],
"parameters": {
"limit": "10",
"sort": {
"Has_text": "ASC"
}
},
"assert-queryresult": {
"count": 2,
"results": [
"Example/Q0104/2#0##_977ae79c0c362dc7a2ceaf94859178e7",
"Example/Q0104/2#0##_29a504fbd2492700363d5491902958e9"
]
}
},
{
"type": "query",
"about": "#4 include/not include",
"condition": "[[Has text::~sear*, -elas*]]",
"printouts": [],
"parameters": {
"limit": "10",
"sort": {
"Has_text": "DESC"
}
},
"assert-queryresult": {
"count": 1,
"results": [
"Example/Q0104/2#0##_29a504fbd2492700363d5491902958e9"
]
}
},
{
"type": "query",
"about": "#5 same as #4",
"condition": "[[Has text::!~elastic*, +sear*]]",
"printouts": [],
"parameters": {
"limit": "10"
},
"assert-queryresult": {
"count": 1,
"results": [
"Example/Q0104/2#0##_29a504fbd2492700363d5491902958e9"
]
}
},
{
"type": "query",
"about": "#6 phrase matching",
"condition": "[[Has text::~\"phrase that has special\"]]",
"printouts": [],
"parameters": {
"limit": "10"
},
"assert-queryresult": {
"count": 1,
"results": [
"Example/Q0104/3#0##_1aa6fcbe946e44dc061627ce545e0cd9"
]
}
},
{
"type": "query",
"about": "#7 similar to #5 but not used in phrase matching mode",
"condition": "[[Has text::~phrase that has special]]",
"printouts": [],
"parameters": {
"limit": "10"
},
"assert-queryresult": {
"count": 2,
"results": [
"Example/Q0104/3#0##_1aa6fcbe946e44dc061627ce545e0cd9",
"Example/Q0104/3#0##_682a8c9f798c14548a4599b68d83b78e"
]
}
},
{
"type": "query",
"about": "#8 free search (wide proximity)",
"skip-on": {
"sqlite": "works different in comparison to MySQL, see #9",
"elastic": "Uses a multi_field phrase match"
},
"condition": "[[~~with a category]]",
"printouts": [],
"parameters": {
"limit": "10"
},
"assert-queryresult": {
"count": 2,
"results": [
"Example/Q0104/4#0##_5a524a435267f6e6d2d45d64a419c1da",
"Example/Q0104/4#0##_9f7e6f010523ae7a6d1639d40773e379"
]
}
},
{
"type": "query",
"about": "#8.elastic free search (wide proximity)",
"skip-on": {
"elastic": [ "not", "Different behaviour as SQL on the exact phrase `with a category` " ]
},
"condition": "[[~~with a category]]",
"printouts": [],
"parameters": {
"limit": "10"
},
"assert-queryresult": {
"count": 1,
"results": [
"Example/Q0104/4#0##_9f7e6f010523ae7a6d1639d40773e379"
]
}
},
{
"type": "query",
"about": "#9 free search (wide proximity)",
"condition": "[[~~with* a category]] [[~Example/Q0104/*]]",
"printouts": [],
"parameters": {
"limit": "10"
},
"assert-queryresult": {
"count": 2,
"results": [
"Example/Q0104/4#0##_5a524a435267f6e6d2d45d64a419c1da",
"Example/Q0104/4#0##_9f7e6f010523ae7a6d1639d40773e379"
]
}
},
{
"type": "query",
"about": "#10 free search (wide proximity)",
"condition": "[[~~with a category]] [[Category:Q0104]]",
"printouts": [],
"parameters": {
"limit": "10"
},
"assert-queryresult": {
"count": 1,
"results": [
"Example/Q0104/4#0##_9f7e6f010523ae7a6d1639d40773e379"
]
}
},
{
"type": "query",
"about": "#11 retain spaces on +/- operators",
"condition": "[[Has text::~+*maria* -postgres*]]",
"printouts": [],
"parameters": {
"limit": "10"
},
"assert-queryresult": {
"count": 3,
"results": [
"Example/Q0104/1#0##_7980f674d00e51fbc91cc663a43054c5",
"Example/Q0104/1#0##_507a001e2e9e0e7659aa33e8c4b2d471",
"Example/Q0104/1#0##_55b020117d21e4b7967cf5bf78cf6b32"
]
}
}
],
"settings": {
"smwgEnabledFulltextSearch": true,
"smwgFulltextDeferredUpdate": false,
"smwgFulltextSearchIndexableDataTypes": [
"SMW_FT_BLOB",
"SMW_FT_URI"
],
"smwgElasticsearchConfig": {
"indexer": {
"raw.text": false
}
}
},
"meta": {
"skip-on": {
"postgres": "Fulltext not supported by PostgreSQL.",
"sesame": "Fulltext not supported by SPARQLStore (Sesame).",
"virtuoso": "Fulltext not supported by SPARQLStore (Virtuoso).",
"fuseki": "Fulltext not supported by SPARQLStore (Fuskei).",
"blazegraph": "Fulltext not supported by SPARQLStore (Blazegraph)."
},
"version": "2",
"is-incomplete": false,
"debug": false
}
}