parisholley / wordpress-fantastic-elasticsearch

Improve wordpress search performance/accuracy and enable faceted search by leveraging an ElasticSearch server.
MIT License
162 stars 64 forks source link

Small change = Big help #116

Closed nebojsa-simic closed 9 years ago

nebojsa-simic commented 9 years ago

Hi,

First of all big thank you for the plugin, it's really fantastic. One small code change in the Indexer would help a lot. If you could add a check in the method addOrUpdate after getting the $data from the _build_document:

if (!empty($data)) {
           $type->addDocument(new \Elastica\Document($post->ID, $data));        
}

That would allow us to return an empty $document from the "elasticsearch_indexer_build_document" filter and exclude items from the index based on certain criteria (specific post_type, meta_value etc.)

parisholley commented 9 years ago

Add the change as a pull request, and I'll merge :)