Skip to content

Commit

Permalink
[Solr] introduces the dynamic field *_MultiString. You have to add th…
Browse files Browse the repository at this point in the history
…is field manually to your solr index and reindex the jobs by bin/console
  • Loading branch information
cbleek committed Sep 8, 2017
1 parent 077399f commit 3b1b6b7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Build status:
Requirements
------------

running [YAWIK](https://github.com/cross-solution/YAWIK)
* running [YAWIK](https://github.com/cross-solution/YAWIK)
* running Solr Server


Installation
Expand Down
5 changes: 1 addition & 4 deletions contrib/conf/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@
<field name="datePublishStart" type="date" indexed="true" stored="true"/>
<field name="description" type="text_de_splitting" indexed="true" stored="true"/>
<field name="docType" type="string" indexed="true" stored="true"/>
<field name="employmentTypeList" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="entityName" type="string" indexed="true" required="true" stored="false"/>
<field name="exportId" type="long" indexed="false" stored="true"/>
<field name="geoLocation" type="location_rpt" multiValued="true" indexed="true" stored="true"/>
Expand All @@ -472,20 +471,18 @@
<field name="points" type="location" multiValued="true" indexed="true" stored="true"/>
<field name="portalList" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="portals" type="string" docValues="true" multiValued="true" indexed="true" stored="true"/>
<field name="positionList" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="postalCode" type="string" indexed="true" stored="true"/>
<field name="professionList" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="professionPath" type="text_path" multiValued="true" indexed="true" stored="true"/>
<field name="reference" type="string" indexed="false" stored="true"/>
<field name="region" type="string" indexed="true" stored="true"/>
<field name="regionList" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="regionText" type="text_general" indexed="true" stored="true"/>
<field name="subTitle" type="html" indexed="true" stored="true"/>
<field name="text" type="text_de_splitting" multiValued="true" indexed="true" stored="false"/>
<field name="text_rev" type="text_general_rev" multiValued="true" indexed="true" stored="false"/>
<field name="timestamp" type="date" default="NOW" multiValued="false" indexed="true" stored="true"/>
<field name="title" type="text_de_splitting" indexed="true" stored="true"/>
<field name="zipCityCountryList" type="text_path" multiValued="true" indexed="false" stored="true"/>
<dynamicField name="*_MultiString" type="string" multiValued="true" indexed="true" stored="true"/>
<dynamicField name="portalDatePublishStart*" type="date" multiValued="false" indexed="false" stored="true"/>
<dynamicField name="portalDatePublishEnd*" type="date" multiValued="false" indexed="true" stored="true"/>
<dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/>
Expand Down
13 changes: 9 additions & 4 deletions src/Solr/Filter/EntityToDocument/JobEntityToSolrDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
use Solr\Bridge\Util;
use Zend\Filter\StripTags;



class JobEntityToSolrDocument implements FilterInterface
{
/**
Expand Down Expand Up @@ -80,12 +82,15 @@ public function filter($job)
$document->addField('html', "$description " . $job->getTitle() ." $requirements $qualification $benefits");

foreach($job->getClassifications()->getProfessions()->getItems() as $profession) { /* @var $profession \Jobs\Entity\Category */

$document->addField('professionList', $profession->getName());
$document->addField('profession_MultiString', $profession->getName());
}
foreach ($job->getClassifications()->getEmploymentTypes()->getItems() as $employmentType) { /* @var $employmentType \Jobs\Entity\Category */
$document->addField('employmentTypeList', $employmentType->getName());
$document->addField('employmentType_MultiString', $employmentType->getName());
}
foreach ($job->getClassifications()->getIndustries()->getItems() as $industry) { /* @var $employmentType \Jobs\Entity\Category */
$document->addField('industry_MultiString', $industry->getName());
}


return $document;
}
Expand Down Expand Up @@ -146,7 +151,7 @@ public function processLocation(JobEntity $job, SolrInputDocument $document)
$loc->addField('country', $location->getCountry());
$loc->addField('region', $region);
$loc->addField('postalCode', $location->getPostalCode());
$document->addField('regionList', $region);
$document->addField('region_MultiString', $region);
$document->addChildDocument($loc);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Solr/Filter/JobBoardPaginationQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public function createQuery(array $params, SolrDisMaxQuery $query, Facets $facet
$q = $search; //\SolrUtils::escapeQueryChars($search);
$query->addSortField('score', SolrQuery::ORDER_DESC);
$query->addSortField('title', SolrQuery::ORDER_ASC);
$query->addQueryField('title', '1');
$query->addQueryField('title', '4');
$query->addQueryField('text', '1');
$query->addQueryField('organizationName', '2');
$query->addQueryField('location', '0.2');
} else {
Expand Down

0 comments on commit 3b1b6b7

Please sign in to comment.