MDL-53579 search: Fix conflict with eDisMax parser and indexed files

This commit is contained in:
Eric Merrill
2016-04-06 14:09:35 -04:00
parent 4fc04cfeaf
commit 546c0af511
3 changed files with 21 additions and 3 deletions
+10 -2
View File
@@ -63,17 +63,25 @@ class document extends \core_search\document {
'solr_fileid' => array(
'type' => 'string',
'stored' => true,
'indexed' => false
'indexed' => true
),
'solr_filecontenthash' => array(
'type' => 'string',
'stored' => true,
'indexed' => false
'indexed' => true
),
// Stores the status of file indexing.
'solr_fileindexedcontent' => array(
'type' => 'int',
'stored' => true,
'indexed' => true
),
// Field to index, but not store, file contents.
'solr_filecontent' => array(
'type' => 'text',
'stored' => false,
'indexed' => true,
'mainquery' => true
)
);
+6 -1
View File
@@ -234,7 +234,7 @@ class engine extends \core_search\engine {
$fields = $documentclass::get_default_fields_definition();
$dismax = false;
if ($query instanceof SolrDisMaxQuery) {
if ($query instanceof \SolrDisMaxQuery) {
$dismax = true;
}
@@ -764,6 +764,11 @@ class engine extends \core_search\engine {
// This will prevent solr from automatically making fields for every tika output.
$url->param('uprefix', 'ignored_');
// Control how content is captured. This will keep our file content clean of non-important metadata.
$url->param('captureAttr', 'true');
// Move the content to a field for indexing.
$url->param('fmap.content', 'solr_filecontent');
// These are common fields that matches the standard *_point dynamic field and causes an error.
$url->param('fmap.media_white_point', 'ignored_mwp');
$url->param('fmap.media_black_point', 'ignored_mbp');
+5
View File
@@ -165,6 +165,11 @@ class search_solr_engine_testcase extends advanced_testcase {
$this->assertEquals($USER->id, $results[0]->get('userid'));
$this->assertEquals(\context_system::instance()->id, $results[0]->get('contextid'));
// Do a test to make sure we aren't searching non-query fields, like areaid.
$querydata->q = \core_search\manager::generate_areaid('core_mocksearch', 'role_capabilities');
$this->assertCount(0, $this->search->search($querydata));
$querydata->q = 'message';
sleep(1);
$beforeadding = time();
sleep(1);