By stinis87 on
Hi!
Im trying to index a custom field in apache solr but its not working. so far i have added this to my module but when i go to administer apache solr i cant see the field anywhere in the index..
function customsolr_apachesolr_update_index(&$document, $node, $namespace) {
if($node->type == "topic_page") {
$document->fs_nodeType = $node->type;
}
}
anyone know why? im using drupal 7.
Comments
You should build the Document with new field.
HI,
To add custom field for apache solr indexing, you should build document for such node, which we are sending to apache for indexing.
Check below url for drupal apache HOOK, to add custom field to apache solr document.
http://drupalcontrib.org/api/drupal/contributions!apachesolr!apachesolr.api.php/function/hook_apachesolr_index_document_build/7
OR
you can try
Thanks,
Tushar Shantaram Bodake
Hi, this might be new since 2
Hi, this might be new since 2 years ago, but there's a more formal API for adding fields to the document before sending to Solr.
See http://www.drupalcontrib.org/api/drupal/contributions%21apachesolr%21Apa...
John
http://www.ignoredbydinosaurs.com
2 Different Approaches / Use Cases
Depending on what you're trying to do, you may not need to code this. If you're trying to get a hidden field to be searchable, try adding a custom search index display and re-indexing.
Check out the post Exposing Fields to Solr for an explanation of 2 primary use cases and their approaches.